0

Here is the query:

mysql_query("UPDATE il_pageparameters SET totalvisitor_to_refer=$totalvisitor_to_refer, referer_page_url='$referer_page_url', message='$message', rewardmessage='$rewardmessage', background_image='$bg', poweredby='$rg', istoshowrm=$istoshowrm, msg1='$msg1' WHERE id=$configid;");

I have tried echo'ing the output:

echo "UPDATE il_pageparameters SET totalvisitor_to_refer=$totalvisitor_to_refer, referer_page_url='$referer_page_url', message='$message', rewardmessage='$rewardmessage', background_image='$bg', poweredby='$rg', istoshowrm=$istoshowrm, msg1='$msg1' WHERE id=$configid;";

Run the echo'd output manually in phpmyadmin and it works fine.

If i paste the echo'd output into the mysql_query() statement it works fine.

But if i build the query like that it updates multiple rows instead of just the row i have chosen with the WHERE clause.

Anyone have any ideas?

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by phplover
0

Hi try this.

You don't need the semicolon after $configid only after the bracelet. I also added LIMIT 1 so it only updates one row. I also added a die(mysql_error()); to end of query so if it fails it will give you an error. Also added to each column name those little ticks ` Can't think the proper name for them sorry. But i find it strange why it updates more than one row but that maybe due to the query you had, try the new one below. If it still fails then i can only think that you have duplicate $configid's in database. Is $configid an auto increment in database so it keeps each row unique? . Each row should have a unique id column to avoid duplicate id's.

mysql_query("UPDATE `il_pageparameters` SET `totalvisitor_to_refer` = '$totalvisitor_to_refer', `referer_page_url` = '$referer_page_url', `message` = '$message', `rewardmessage` = '$rewardmessage', `background_image` = '$bg', `poweredby` = '$rg', `istoshowrm` = '$istoshowrm', `msg1` = '$msg1' WHERE `id` = '$configid' LIMIT 1") or die(mysql_error());

Hope this helps you.
PHPLOVER

Edited by phplover: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.