You need to separate the SET arguments with commas, not ANDs...
It's really doing something like this:
UPDATE shop_customer SET eu_vat_number = (SK1234567890 AND vat_amount = 0
AND total_amount = 8.4925) WHERE customer_id = 7 AND hash=dcd5e751
(SK1234567890 AND vat_amount = 0 AND total_amount =
Message-
From: Jenaro Centeno Gómez [mailto:[EMAIL PROTECTED]
Sent: 04 March 2006 17:35
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL update statement problem
Maybe I am wrong, biut isn´this the rigth way to do this:
UPDATE shop_customer SET eu_vat_number = SK1234567890, vat_amount =
0
This is not the problem.
The query fails when there is, as examples, an invalid syntax in the query
or the table is not found.
However, if the query executes but updates nothing. How can I know when the
update has changed a row or not? Not changing a row does not return a
failure.
Matt's
Please forgive me as I've been working with C# recently so my PHP is a
little rusty. But if I'm reading this correctly...
If your query fails outright, your function is going to return false:
if (!(@ mysql_query($query, $connection))) {
$this-errors = array(mysql_errno(), mysql_error());
On Thu, 9 Jun 2005, Ron Piggott wrote:
I created a PHP based mailing list that sends out a Bible verse and a
quotation each day. Today's verses were:
[snip]
Let me show you some code:
It selects a Bible verse:
SELECT * FROM bible ORDER BY RAND() LIMIT 1
On a side note, this is going to
$query = UPDATE tablename SET ;
foreach($_POST AS $key = $value)
$query .= $key = '$value',;
$query[strlen($query)-1] = ;
$query .= WHERE id = '$_GET[id]';
Or something?
On Tue, 2002-11-12 at 13:58, David Rice wrote:
Making an update query that adapts to the number of fields that
How about:
function do_query ($table, $fields, $where)
{
$sql = 'update ' . $table . ' Set ';
foreach ($fields as $k=$v)
$sql = $k . ' = \'' . $v . '\',';
return mysql_query ($sql);
}
Not sure if it adapts 100% to your case but you can probably fix it
I didn't get your attachements. Maybe paste them in a row into the email?
-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 10:07 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] MySQL Update failing...
In need of some help. I
Figured it out. Thanks to anyone who started looking at this. The
problem was not having my variables in the correct order in the $updateSQL.
Once I corrected this, the posting now works fine.
-Original Message-
From: NIPP, SCOTT V (SBCSI)
[mailto:[EMAIL PROTECTED]]
Sent:
Correct your example as follows:
$sql = UPDATE $table_name SET new_area=\$new_area\;
-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 26, 2002 10:49 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Update command syntax
Could anyone help me out with the
Check out for MySQL mailing lists
http://www.mysql.com/documentation/lists.html
-JAson Garber
At 03:42 PM 9/20/2001 -0500, Christopher Raymond wrote:
NOTES: I know this is a PHP list, but I also know that many of you are
experienced MySQL admins. In addition, I was unable to find a MySQL
on 8/30/01 4:06 PM, Malcolm White at [EMAIL PROTECTED] wrote:
$query = UPDATE Groups SET GName=$new_name WHERE GID=$gid;
If the Gname field is a string type, there should probably be quotes around
it.
$query = 'UPDATE Groups SET GName=' . $new_name . ' WHERE GID=' . $gid;
HTH.
12 matches
Mail list logo