supplied argument is not a valid MySQL result
Posted: Tue Sep 27, 2005 10:10 am
Im getting errors on a submit form that renders results, and enters results in the db. Here is the error I get on the page. Any help I get is greatly appreciated.
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home3/cnl83/actionfx-www/classes/access_user/ext_user_profile.php on line 91
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home3/cnl83/actionfx-www/classes/access_user/ext_user_profile.php on line 101
Here is the code for ext_user_profile.php
lines 82-116
and this is particularly line 91
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home3/cnl83/actionfx-www/classes/access_user/ext_user_profile.php on line 91
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home3/cnl83/actionfx-www/classes/access_user/ext_user_profile.php on line 101
Here is the code for ext_user_profile.php
lines 82-116
Code: Select all
// install the "countries_table.sql" first
function create_country_menu($label) {
$sql_countries = sprintf("SELECT iso, name FROM %s ORDER BY id", COUNTRY_TABLE);
$res_countries = mysql_query($sql_countries);
$menu = "<label for=\"country\">".$label."</label>\n";
$menu .= "<select name=\"country\">\n";
$menu .= " <option value=\"\"";
$menu .= (!isset($_REQUEST['country'])) ? " selected" : "";
$menu .= ">...\n";
while ($obj = mysql_fetch_object($res_countries)) {
$menu .= " <option value=\"".$obj->iso."\"";
if (isset($this->country) && !isset($_REQUEST['country'])) {
$menu .= ($obj->iso == $this->country) ? " selected" : "";
} else {
$menu .= (isset($_REQUEST['country']) && $obj->iso == $_REQUEST['country']) ? " selected" : "";
}
$menu .= ">".$obj->name."\n";
}
$menu .= "</select><br>\n";
mysql_free_result($res_countries);
return $menu;
}
function create_form_field($formelement, $label, $length = 25, $required = false) {
$form_field = "<label for=\"".$formelement."\">".$label."</label>\n";
$form_field .= " <input name=\"".$formelement."\" type=\"text\" size=\"".$length."\" value=\"";
if (isset($_REQUEST[$formelement])) {
$form_field .= $_REQUEST[$formelement];
} elseif (isset($this->$formelement) && !isset($_REQUEST[$formelement])) {
$form_field .= $this->$formelement;
} else {
$form_field .= "";
}
$form_field .= ($required) ? "\">*<br>\n" : "\"><br>\n";
return $form_field;
}Code: Select all
while ($obj = mysql_fetch_object($res_countries)) {