Jump to content

[SOLVED] Update more than one field


jaxdevil

Recommended Posts

I am trying to insert data into multiple fields in multiple rows, I have it working where I can submit to multiple entries, but when i try to update more than one field I get an error. The first code below works, but only lets me update one section of each row, the second code is what I am trying to use to update several columns in those fields....

 

<?php
// connect to the database and select the correct database
mysql_connect(localhost,xxx_xxx,xxxxxx);
mysql_select_db(auction_asset) or die("Unable to select database");

$query = "UPDATE checkout SET ref='$authxyz' WHERE bidnum=$custidxyz AND paid='no'";
mysql_query($query) or die ("Error in query: $query");
print "data<br /><br /><em>Updated!</em><br /><br />";

mysql_close();
?>

 

 

<?php
// connect to the database and select the correct database
mysql_connect(localhost,xxx_xxx,xxxxxx);
mysql_select_db(auction_asset) or die("Unable to select database");

$query = "UPDATE checkout SET ref='$authxyz' AND SET paid='yes' AND SET type='cc' WHERE bidnum=$custidxyz AND paid='no'";
mysql_query($query) or die ("Error in query: $query");
print "data<br /><br /><em>Updated!</em><br /><br />";

mysql_close();
?>

Link to comment
Share on other sites

Thanks. I figured it out...

 

<?php
// connect to the database and select the correct database
mysql_connect(localhost,xxx_xxx,xxxxxx);
mysql_select_db(auction_asset) or die("Unable to select database");

$query = "UPDATE checkout SET paid='yes', ref=$authxyz, type='cc' WHERE paid='no' AND bidnum=$custidxyz";
mysql_query($query) or die ("Error in query: $query");
print "data<br /><br /><em>Updated!</em><br /><br />";

mysql_close();
?>

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.