Jump to content

PHP Error 'unexpected T_STRING' . . .


snapper64

Recommended Posts

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:
[code]<?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');

?>[/code]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
Link to comment
Share on other sites

The $sql definition looks mangled to me. Try this instead:
[code]$sql = 'UPDATE `users`'
        . ' SET `status` = `1`'
        . ' WHERE `password` = `$md5` AND `timestamp` = `$base`';[/code]
Link to comment
Share on other sites

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

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

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

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


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.