[SOLVED] Odd parse error (mysql)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adrigen
Forum Newbie
Posts: 9
Joined: Tue Oct 07, 2003 3:32 am
Contact:

Odd parse error (mysql)

Post by adrigen »

Hi,
I get the error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /usr/local/wwwroot/ftpjamesnik/AddSup4.php on line 19

and i can't imagine what's wrong. I get this error before i even submit any values to the page.
Could anyone sugest why the code is being run? Or why i would get this error anyway?

Code: Select all

<html>

<body>



<?php



if (!empty($_POST&#1111;'submit'])) &#123;

  // process form

$db = mysql_connect("www.x.com.au", "x", "x");

mysql_select_db("ftpjamesnik",$db);

  $sql = "INSERT INTO employees (first,last,address,position) VALUES ($_GET&#1111;'first'],$_GET&#1111;'last'],$_GET&#1111;'address'],$_GET&#1111;'position'])";

  $result = mysql_query($sql);

  echo "Thank you! Information entered.\n";

&#125; else&#123;



  // display form



  ?>



<form method="post" action="<?php echo $_SERVER&#1111;'PHP_SELF'] ?>">

  First name:<input type="Text" name="first"><br>

  Last name:<input type="Text" name="last"><br>

  Address:<input type="Text" name="address"><br>

  Position:<input type="Text" name="position"><br>

  <input type="Submit" name="submit" value="Enter information">

  </form>



  <?php



&#125; // end if



?>



</body>



</html>
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Code: Select all

$sql = "INSERT INTO employees (first,last,address,position) VALUES ($_GET&#1111;'first'],$_GET&#1111;'last'],$_GET&#1111;'address'],$_GET&#1111;'position'])";
should look like:

Code: Select all

$sql = "INSERT INTO employees (first,last,address,position) VALUES ('$_GET&#1111;first]','$_GET&#1111;last]','$_GET&#1111;address]','$_GET&#1111;position]')";
:arrow: reference
adrigen
Forum Newbie
Posts: 9
Joined: Tue Oct 07, 2003 3:32 am
Contact:

Post by adrigen »

Brilliant! thanks
Post Reply