Forum Moderators: coopster

Message Too Old, No Replies

unexpected T_VARIABLE

html forms used to modify sql databases

         

jack crombie

12:56 am on Jun 6, 2003 (gmt 0)

10+ Year Member



I am having problems with SQL UPDATE function
when i submit the form the it goes to the action page and then tells me of an "unexpected T_VARIABLE on line 3"

here is the code that is giving me grief:
<html>
<?
line 3 starts on the next line
$sql = "UPDATE albums SET albums.cat_title = '" . $_POST['genre'] . "', album_title = '" . $_POST["album"] . "', album_artist = '" . $_POST["artist"] . "', album_tracks = '" . $_POST["tracks"] . "' WHERE (((albums.article_id)='"$_POST['article_id'];"'))";
line 3 ends here
$odbc = odbc_connect ('access', 'root', '') or die( "Could Not Connect to ODBC Database!" );

//echo $odbc ;
echo $sql ;

odbc_execute($odbc, $sql) or die(odbc_errormsg()) ;
//odbc_execute($sql) or die( "Could Not update Table" )
?>
</html>
I have been slaving over this all yesterday and some direction would be of great help.
Thanks, Jack

[edited by: jack_crombie at 1:29 am (utc) on June 6, 2003]

jatar_k

1:03 am on Jun 6, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld jack_crombie,

try switching all the double quotes to singles

$_POST["album"]
to
$_POST['album']

that should fix it I think

olwen

1:08 am on Jun 6, 2003 (gmt 0)

10+ Year Member



I think the problem is in
WHERE (((albums.article_id)='"$_POST['article_id'];"'))";

which should be
WHERE (((albums.article_id)='".$_POST['article_id']."'))";

jatar_k

1:15 am on Jun 6, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



nice catch olwen, I missed that one.

jack crombie

1:23 am on Jun 6, 2003 (gmt 0)

10+ Year Member



thanks guys i'm just trying that now

jack crombie

1:28 am on Jun 6, 2003 (gmt 0)

10+ Year Member



thanks guys it's all happy smiley

jack crombie

1:32 am on Jun 6, 2003 (gmt 0)

10+ Year Member



the quotes were fine but my WHERE statement was lacking the "." on either side, I also had it looking for a $_POST variable that didn't exits thanks for the help