Please look below for edit
Hi, everyone. My error is on my while loop. I've had to add a @ to it to make it stop giving me the warning. It works just fine. Everything updates perfectly. But, rather than kludge it, I'd really like to not to have to hide my errors.
I just have no idea what is wrong with it. Like I said, my while loop (line 113) is giving me this:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xx/xxxxxxx/xxx/admin/price_chng.php on line 113
Here's the code.
if($manu < 15){
$row_count = 0;
$query = "SELECT * FROM `phone_models` WHERE `manufacture_id`=" . $manu . ";";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
if($row_count < 5){
echo ("<form action='price_chng.php' method='post' name='newprice' id=" . $row['id'] . ">");
echo "<td>" . $row['label'] . "<br>";
echo("<input name='newprice' type='text' id=" . $row['id'] . " size='10' value=" . $row['buyback_price'] . "><br>");
echo("<input type='hidden' name='ud_id' value='$row[id]'>");
echo("<input name='doSave' type='submit' id='doSave' value='Save'></form></td>");
$row_count++;
}else{
$row_count = 0;
echo("</tr><tr>");
}
}
}else{
echo("</tr></td>");
}
Any help is appreciated! Thanks, guys!
EDIT: Updated the code. I took out the or die from my statement because I wanted the warning to stop. I forgot to put it back in. WHen I put it back in, I have this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
And, my code is:
if($manu < 15){
$row_count = 0;
$query = "SELECT * FROM `phone_models` WHERE `manufacture_id`=" . $manu . ";";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
if($row_count < 5){
echo ("<form action='price_chng.php' method='post' name='newprice' id=" . $row['id'] . ">");
echo "<td>" . $row['label'] . "<br>";
echo("<input name='newprice' type='text' id=" . $row['id'] . " size='10' value=" . $row['buyback_price'] . "><br>");
echo("<input type='hidden' name='ud_id' value='$row[id]'>");
echo("<input name='doSave' type='submit' id='doSave' value='Save'></form></td>");
$row_count++;
}else{
$row_count = 0;
echo("</tr><tr>");
}
}
}
else{
echo("</tr></td>");
}