I am creating a dynamic list on the server using php file,when I run the PHP script in all 4 browsers (IE 6, Firefox 2, opera and safari 3) every think go Ok and the list is created. but when I call the php script from the browser using Ajax, the list is created fine in IE and Opera but on Firefox and safari I got the following error:
"Warning: mysql_fetch_row (): supplied argument is not a valid MySQL result resource in /home/content/r/a/k/raknin/html/login/create_generic_ listbox.php on line 72"
The php script as standalone is working smooth. I suspect that it is something to do with the ajax call but I don't know what. I struggle with this issue almost a day.
Here is my client ajax call:
And on the server side I have the following code:
please advise.
"Warning: mysql_fetch_row (): supplied argument is not a valid MySQL result resource in /home/content/r/a/k/raknin/html/login/create_generic_ listbox.php on line 72"
The php script as standalone is working smooth. I suspect that it is something to do with the ajax call but I don't know what. I struggle with this issue almost a day.
Here is my client ajax call:
Code:
function GetXmlHttpObject(divID,url) { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); alert("Firefox, Opera 8.0+, Safari"); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } if (xmlHttp==null) { alert("Your browser does not support AJAX!"); return FALSE; } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.status==200) { // alert(xmlHttp.responseText); document.getElementById(divID).innerHTML=xmlHttp.responseText ; } }; xmlHttp.open("GET", url); xmlHttp.send(null); }
Code:
mysql_pconnect($HOSTNAME,$DBUSER,$DBPASSWORD) or die("Can not connect to the DB"); mysql_select_db($DATABASE) or die("can not select DB"); $result=mysql_query($query); $selectList=""; $selectList=$select_params; $selectList=$selectList. '<option value="none">none</option>'; while(list($name) = mysql_fetch_row($result)) { $selectList=$selectList.'<option value="' . $name . '">' . $name . '</option>'; } // End of while $selectList=$selectList.'</select>'; print $selectList; } else { Echo "Problem occur while building the list" ; }
Comment