HELP with my UPDATE statement

Codes here !

Moderators: macek, egami, gesf

User avatar
frogrocker
New php-forum User
New php-forum User
Posts: 98
Joined: Mon Jul 07, 2003 10:30 pm
Location: Manchester
Contact:

HELP with my UPDATE statement

Postby frogrocker » Wed Jul 09, 2003 10:55 pm

Code: Select all

<?php
    $link = mysql_connect("localhost", "user", "pass")
        or die("Could not connect: " . mysql_error());
    print ("Connected successfully");
?>
<?php
$confirm = 1;
$id = $HTTP_COOKIE_VARS['MM_id'];
mysql_select_db('neo_studio', $link);
mysql_query(UPDATE trans SET trans.confirm=$confirm WHERE trans.id=$id);
?>


What's wrong with this code??? It wont work!

Joel
New php-forum User
New php-forum User
Posts: 193
Joined: Sat Mar 29, 2003 11:57 pm
Location: Auckland, New Zealand
Contact:

Postby Joel » Thu Jul 10, 2003 2:38 am

It would've helped if you posted the error, but this is what you should try...

Code: Select all

mysql_query("UPDATE `trans` SET `confirm`='$confirm' WHERE `id`='$id'") or die(mysql_error());


This way, it'll also tell you the error, which is occuring.

liquedus
php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Postby liquedus » Thu Jul 10, 2003 3:47 am

most likely your error is that you dont have your SQL statements in quotes

ie mysql_query("UPDATE...");

:P


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron