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
https://forums.phpfreaks.com/topic/75752-solved-update-more-than-one-field/
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();
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.