FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Whats the problem of my code? Help please





fizzo
Code:
<?php
$con = mysql_connect("localhost","db_name","db_pass");
mysql_select_db('db_name');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
echo $_POST["Slot"];
mysql_query("UPDATE Player SET ROSTERPOS = 'Slot';
header('Location:http://ayc.frih.net/WBA/Depth_Charts.php');
mysql_close($con);
?>


What is wrong with my code? It gives me back a error...
Arrow
Quote:
Parse error: syntax error, unexpected $end in /home/fizzo/domains/ayc.frih.net/public_html/WBA/rostereditprocess.php on line 12


Its part of a Form submission and database update script... heres the other script that will pass the datas thru the above codes..


Code:
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";

opentable("WBA l ");
$con = mysql_connect("localhost","db_name","db_pass");
mysql_select_db('db_name');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
$TEAM = $_GET['PLAYERID'];
$player = mysql_query("SELECT * FROM Players WHERE PLAYERID = '$PLAYERID'");
echo "<b><font size=6>PLAYER CONFIGURATION</font>
<tr>
<th style=border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium bgcolor=black><font size=1 face=Verdana color=white>PLAYER</th>
<th style=border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium bgcolor=black><font size=1 face=Verdana  color=white >SLOT</th>
<th style=border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium bgcolor=black><font size=1 face=Verdana  color=white >CURRENT SLOT</th>
</tr></font>";
while($row = mysql_fetch_array($player))
   {
echo "<tr>";
  echo "<td bgcolor=#666666>" .$row['ROSTERPOS']. "</td>";
  echo "<td>"."<b>"."<a href=http://www.ayc.frih.net/WBA/PlayerPage.php?PLAYERID=".$row['PLAYERID'].">".$row['FNAME'] . " " . $row['NAME']."</a>" ."</b>"."<br>". "<b>#"."</b>".$row['NUMBER']."</td>";
  echo "<td bgcolor=#666666>" ."<form method=POST action=rostereditprocess.php>
  <select size=1 name=Slot>
  <option value=0>01</option>
  <option value=1>02</option>
  <option value=2>03</option>
  <option value=3>04</option>
  <option value=4>05</option>
  <option value=5>06</option>
  <option value=6>07</option>
  <option value=7>08</option>
  <option value=8>09</option>
  <option value=9>10</option>
  <option value=10>11</option>
  <option value=11>12</option>
  <option value=12>IR1</option>
  <option value=14>IR2</option>
  <option value=13>IR3</option>
  </select><input type=submit value=Submit name=B1></p>
</form>". "</td>";
  echo "<td bgcolor=#666666>" . $row['ROSTERPOS'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
//echo "<input type=submit value=Submit name=B1>";

mysql_close($con);
closetable();

require_once "side_right.php";
require_once "footer.php";
?>
fromegame
Code:
mysql_query("UPDATE Player SET ROSTERPOS = 'Slot'

To
Code:
mysql_query("UPDATE Player SET ROSTERPOS = 'Slot'");


Smile
fizzo
Code:
<?php
$con = mysql_connect("localhost","fizzo_League","feb586");
mysql_select_db('fizzo_League');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
echo $_POST["Slot"];
mysql_query("UPDATE Player SET ROSTERPOS = 'Slot'");
echo "<a href=http://ayc.frih.net/WBA/Depth_Charts.php>Go back to Depth Charts</a>";
mysql_close($con);
?>


I already changed it.. but it seems that its not updating the database for new data.. why?

http://ayc.frih.net/WBA/Depth_Charts.php

The above link is the site were this scripts are placed click the edit link ..try looking thanks a lot...
blueray
Code:
echo $_POST["Slot"];
mysql_query("UPDATE Player SET ROSTERPOS = 'Slot'");


Just to make sure. What is the field type of the slot ?
Also, do you wish to update the table with posted value with specific entry ?


Anyway, let assumed the field type is char type.

Code:
$slot_value = isset($_POST['slot']) ? $_POST['slot'] : null;
if ($slot_value)
{
    mysql_query("UPDATE player SET ROSTERPOS = '$slot_value' WHERE FIELD=VALUE");
    echo (int) mysql_affected_rows($con);
}


Did the above statements show the number of rows updated ?
Also, did you tried update the database with mysql command line interface ?


Hope this help
Related topics
wordpress problem :( need help.. :(
Admins help please, My domain wont work! (its my domain.)
Major Problem with COmputer. Help Please
My page dosn't work in IE, is the problem, help please
PHP Help please
THIS IS DRIVING ME INSANE!! PLEASE HELP!
I am having alot of trouble with forms! Urgent help please!
I need some help please!
encrypt and decrypt PROBLEM plss HELP!
PLEASE HELP!!.......PLEASE
help please
Help please! I can't login to my blog admin panel
PHP and MySQL noob need help please!
Hmmmm, Favicon not working, check it out and help please
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.