| | |
Warning: mysql_fetch_array() & Warning: mysql_free_result() errors
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 6
Reputation:
Solved Threads: 0
hi i keep getting this error on my php page
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/internal/public_html/includes/xpage_admin.php on line 871
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/internal/public_html/includes/xpage_admin.php on line 877
the code below works perfectly on my test server and error checking is on.
this is the code below
$result = $this->db->ExecuteSql ("Select w.*, c.primary_name, a.keyname From {$this->object} w LEFT JOIN `smp_customers` c ON w.client_name=c.customer_id LEFT JOIN `smp_accesspoint` a ON w.accesspoint_type=a.keyid Order By {$this->orderBy} {$this->orderDir}" , true);
while ($row = $this->db->FetchInArray ($result)) line 871
{
$client_name = $row['client_name'];
$id = $row['wireless_id'];
$ssid_1 = $row['ssid_1'];
$ssid_2 = $row['ssid_2'];
$ssid_3 = $row['ssid_3'];
$ssid_4 = $row['ssid_4'];
$ssid_password_1 = $row['ssid_password_1'];
$ssid_password_2 = $row['ssid_password_2'];
$ssid_password_3 = $row['ssid_password_3'];
$ssid_password_4 = $row['ssid_password_4'];
$accesspoint_type = $row['accesspoint_type'];
$edit_link = "<a href='{$this->pageUrl}?ocd=edit&id=$id'><img src='./images/edit.gif' alt='Edit' /></a>";
$del_link = "<a href='{$this->pageUrl}?ocd=del&id=$id' onClick=\"return confirm ('Do you really want to delete this Wireless SSID?');\"><img src='./images/trash.gif' alt='Delete' /></a>";
$bgcolor = ($bgcolor == "#EEEEEE") ? "#FFFFFF" : "#EEEEEE";
$this->data ['TABLE_ROW'][] = array (
"ROW_CLIENT" => ($client_name == 0) ? " " : "<a href=clients.php?ocd=search&search_field=customer_id&search_info=".$row['client_name'].">".$row['primary_name']."</a>",
"ROW_SSID1" => ($ssid_1 == "") ? " " : $ssid_1,
"ROW_SSID2" => ($ssid_2 == "") ? " " : $ssid_2,
"ROW_SSID3" => ($ssid_3 == "") ? " " : $ssid_3,
"ROW_SSID4" => ($ssid_4 == "") ? " " : $ssid_4,
"ROW_SSID_PASSWD1" => ($ssid_password_1 == "") ? " " : $ssid_password_1,
"ROW_SSID_PASSWD2" => ($ssid_password_2 == "") ? " " : $ssid_password_2,
"ROW_SSID_PASSWD3" => ($ssid_password_3 == "") ? " " : $ssid_password_3,
"ROW_SSID_PASSWD4" => ($ssid_password_4 == "") ? " " : $ssid_password_4,
"ROW_ACCESSPOINT_TYPE" => ($accesspoint_type == "") ? " " : "<a href=accesspoint.php?ocd=search&search_field=keyid&search_info=".$row['accesspoint_type'].">".$row['keyname']."</a>",
"ROW_EDITLINK" => $edit_link,
"ROW_DELLINK" => $del_link,
"ROW_BGCOLOR" => $bgcolor
);
}
$this->db->FreeSqlResult ($result); //877
these are the functions in line 871 and 877
function FetchInArray ($result)
{
return mysql_fetch_array ($result);
}
//--------------------------------------------------------------------------
function FreeSqlResult ($result)
{
mysql_free_result ($result);
}
Any help is appreciated
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/internal/public_html/includes/xpage_admin.php on line 871
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/internal/public_html/includes/xpage_admin.php on line 877
the code below works perfectly on my test server and error checking is on.
this is the code below
$result = $this->db->ExecuteSql ("Select w.*, c.primary_name, a.keyname From {$this->object} w LEFT JOIN `smp_customers` c ON w.client_name=c.customer_id LEFT JOIN `smp_accesspoint` a ON w.accesspoint_type=a.keyid Order By {$this->orderBy} {$this->orderDir}" , true);
while ($row = $this->db->FetchInArray ($result)) line 871
{
$client_name = $row['client_name'];
$id = $row['wireless_id'];
$ssid_1 = $row['ssid_1'];
$ssid_2 = $row['ssid_2'];
$ssid_3 = $row['ssid_3'];
$ssid_4 = $row['ssid_4'];
$ssid_password_1 = $row['ssid_password_1'];
$ssid_password_2 = $row['ssid_password_2'];
$ssid_password_3 = $row['ssid_password_3'];
$ssid_password_4 = $row['ssid_password_4'];
$accesspoint_type = $row['accesspoint_type'];
$edit_link = "<a href='{$this->pageUrl}?ocd=edit&id=$id'><img src='./images/edit.gif' alt='Edit' /></a>";
$del_link = "<a href='{$this->pageUrl}?ocd=del&id=$id' onClick=\"return confirm ('Do you really want to delete this Wireless SSID?');\"><img src='./images/trash.gif' alt='Delete' /></a>";
$bgcolor = ($bgcolor == "#EEEEEE") ? "#FFFFFF" : "#EEEEEE";
$this->data ['TABLE_ROW'][] = array (
"ROW_CLIENT" => ($client_name == 0) ? " " : "<a href=clients.php?ocd=search&search_field=customer_id&search_info=".$row['client_name'].">".$row['primary_name']."</a>",
"ROW_SSID1" => ($ssid_1 == "") ? " " : $ssid_1,
"ROW_SSID2" => ($ssid_2 == "") ? " " : $ssid_2,
"ROW_SSID3" => ($ssid_3 == "") ? " " : $ssid_3,
"ROW_SSID4" => ($ssid_4 == "") ? " " : $ssid_4,
"ROW_SSID_PASSWD1" => ($ssid_password_1 == "") ? " " : $ssid_password_1,
"ROW_SSID_PASSWD2" => ($ssid_password_2 == "") ? " " : $ssid_password_2,
"ROW_SSID_PASSWD3" => ($ssid_password_3 == "") ? " " : $ssid_password_3,
"ROW_SSID_PASSWD4" => ($ssid_password_4 == "") ? " " : $ssid_password_4,
"ROW_ACCESSPOINT_TYPE" => ($accesspoint_type == "") ? " " : "<a href=accesspoint.php?ocd=search&search_field=keyid&search_info=".$row['accesspoint_type'].">".$row['keyname']."</a>",
"ROW_EDITLINK" => $edit_link,
"ROW_DELLINK" => $del_link,
"ROW_BGCOLOR" => $bgcolor
);
}
$this->db->FreeSqlResult ($result); //877
these are the functions in line 871 and 877
function FetchInArray ($result)
{
return mysql_fetch_array ($result);
}
//--------------------------------------------------------------------------
function FreeSqlResult ($result)
{
mysql_free_result ($result);
}
Any help is appreciated
•
•
Join Date: Oct 2009
Posts: 35
Reputation:
Solved Threads: 5
0
#5 Oct 30th, 2009
•
•
•
•
I have tested the query in phpmyadmin and it pulls back the expected results. so it not working in the code is beyond me
u said its workin on the test server, so can u recheck the database in ur server and confirm if the tables and column names are exactly the same as ur db in the test server. remember, mysql is case sensitive.
Last edited by kekkaishi; Oct 30th, 2009 at 7:53 am.
•
•
Join Date: Oct 2009
Posts: 6
Reputation:
Solved Threads: 0
0
#9 Oct 30th, 2009
Fixed it, using the die(mysql_error()); found their was an issue with Order By {$this->orderBy} {$this->orderDir} that it was pulling in the wrong field name. i explicit ordered it by the right field and it fixed it
![]() |
Other Threads in the PHP Forum
- Previous Thread: how do i delete a directory with php?
- Next Thread: Delete Function Problem...
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube





