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