Jump to content


Photo

PHP Error 'unexpected T_STRING' . . .


  • Please log in to reply
3 replies to this topic

#1 snapper64

snapper64
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 30 May 2006 - 08:01 PM

Hi Guys,

I have got a problem and i cant figure out why. Basically i have created a page that will connect to a database and modify the information within it. You can see my file below:
<?php

// Include init file
include 'init.php';

$md5 = md5($_GET['hash']);
$base = base64_decode($_GET['stamp']);

$sql = 'UPDATE `users`'
        . ' SET `status` = `1`
        . ' WHERE `password` = `$md5`' AND `timestamp` = `$base`;

// And lastly, store the information in the database
mysql_query ($sql) or die ('Activation Failed');

?>
Unfortunately it is throwing up this error:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: syntax error, unexpected T_STRING in /path/to/my/file.php on line 11[/quote]

Any ideas???

Thanks,

Charlie

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 30 May 2006 - 08:06 PM

The $sql definition looks mangled to me. Try this instead:
$sql = 'UPDATE `users`'
        . ' SET `status` = `1`'
        . ' WHERE `password` = `$md5` AND `timestamp` = `$base`';

Legend has it that reading the manual never killed anyone.
My site

#3 jworisek

jworisek
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 30 May 2006 - 08:09 PM

[!--quoteo(post=378495:date=May 30 2006, 03:01 PM:name=snapper64)--][div class=\'quotetop\']QUOTE(snapper64 @ May 30 2006, 03:01 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]

$sql = 'UPDATE `users`'
        . ' SET `status` = `1`
        . ' WHERE `password` = `$md5`' AND `timestamp` = `$base`;
[/quote]

I could be wrong, but that doesn't look right...

try this:
$sql ="UPDATE users SET status = '1' WHERE password = '$md5' AND timestamp = '$base'";




#4 snapper64

snapper64
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 30 May 2006 - 08:12 PM

It works. Thanks for the speedy reply !




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users