Jump to content

[SOLVED] Why this query doesn't work ?


sniperscope

Recommended Posts

Hi guys could some tell me what is wrong with this code ? echo $query returns exactly what i want but when i check db, it update only one column which is flag column of last row of query.

 

Here is the Query;

 

mysql_select_db($database_deli24, $deli24);
mysql_query($query) or die ("Error in query: $query");

$size = count($_POST['nick_name']); // find out how many records there are to update

$i = 0;

while ($i < $size) { //make a loop for number of records
$name = $_POST['name'][$i];
$is_working = $_POST['is_working'][$i];
$start_hour = $_POST['start_hour'][$i];
$start_min = $_POST['start_min'][$i];
$finish_hour = $_POST['finish_hour'][$i];
$finish_min = $_POST['finish_min'][$i];
$flag = $_POST['asktoadmin'][$i];

$query = "UPDATE shukkin SET is_working='$is_working', name='$name', start_hour='$start_hour', start_min='$start_min', finish_hour='$finish_hour', finish_min='$finish_min', flag='$flag' WHERE name='$name' LIMIT 1";

echo "$i QUERY WAS = = =$query<br><br>";
++$i;
} 

mysql_close();

 

End this is result of echo $query

 

UPDATE shukkin SET is_working='1', name='mike', start_hour='18', start_min='40', finish_hour='22', finish_min='40', flag='1' WHERE name='mike' LIMIT 1

 

if i run this query directly from phpmyadmin sql_also doesn't update without any error.

Link to comment
https://forums.phpfreaks.com/topic/138282-solved-why-this-query-doesnt-work/
Share on other sites

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.