Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

HELP with my UPDATE statement

Codes here !

Moderators: macek, egami, gesf

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!
User avatar
frogrocker
New php-forum User
New php-forum User
 
Posts: 98
Joined: Mon Jul 07, 2003 10:30 pm
Location: Manchester

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.
Joel
New php-forum User
New php-forum User
 
Posts: 193
Joined: Sat Mar 29, 2003 11:57 pm
Location: Auckland, New Zealand

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
liquedus
php-forum Active User
php-forum Active User
 
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada


Return to mySQL & php coding

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.