Here is the code………
<?php
include('../inc/php/inc/dbc.php');
$query = "SELECT * FROM available_fsv WHERE a_status = '1'";
$result_query = mysql_query($query);
while($row = mysql_fetch_assoc($result_query)){
$billingid = $row['billingid'];
$query = "UPDATE available_fsv SET b_status = '1' WHERE billingid = '$billingid'";
$result_query = mysql_query($query);
echo $result_query;
}
?>
The error i am getting………..
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\php\fsv_shutdown_cron.php on line 6
Database structure is like–
____________________________________________________
| id | a_status | b_status | billingid |
|--------|------------|-------------|--------------|
| 1 | 1 | 0 | 1 |
|--------|------------|-------------|--------------|
| 2 | 0 | 0 | 12 |
|--------|------------|-------------|--------------|
| 3 | 0 | 0 | 9 |
|--------|------------|-------------|--------------|
| 4 | 1 | 0 | 3 |
|________|____________|_____________|______________|
What i wanna do is if a_status is 1 then update b_status to 1.
I am learning php and I know this is a stupid question but please help me. Thanks in advance.. 🙂
This call
mysql_query($query)returned FALSE, instead of result set, which means that your query had errors in it. Use the following code to see the error:Looks like I was wrong. You really overwrite original value of
$result_querywhen you execute your update query.