I have an ajax call in the middle of a webform to populate a select box based on a previous select box. About 1 out of 5 times I run this, I get a “not a valid mysql result resource” error. However the rest of the time it runs perfectly. It’s random, so I’m baffled on why it’s happening, but I’m hosting a fairly slow server, so I’m wondering if it could trying to return the results slower then it’s trying to display them.
Regardless, I recently switched to MySQL from SQL and there are some slight syntex issues that have hung me up in the past, so I thought I might post my code here and see if anyone spots an error.
[CODE]$num = $_GET[‘num’];
echo “<select name=subcat>”;
echo “<option>”;
$recordset = mysql_query (“SELECT * FROM `subcat` where `category` = ‘$num'”, $handle);
while($arr = mysql_fetch_row($recordset))
{
$style = trim($arr[2]);
echo “<option>$style”;
}
echo “</select>”;