I created this site on my local machine using PHP 5.0.4 and mysql 4.1 and it works perfectly fine.

I then ftp it to my webhost but the code to retrieve values give me this error.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/laterallinks/ApplicantInformation.php on line 25

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/www/laterallinks/ApplicantInformation.php on line 621

I let my webhost know they so they upgrade from php 4 to php 5.0.5 but still use mysql client version 3.x

Here is the portion of the code that uses the functions.

segment 1:

$sql = mysql_query($query);

while($row = mysql_fetch_array($sql)){
<div align="center">

<p align="right"><font face="Courier New"><font color="#0000FF"><b>Time of Application: </b></font> <? echo $row?></font></p>
<table border="1" width= "750" style="border-collapse: collapse" id="table1" bgcolor="#F2FDFF">

segment 2:

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM applicants ". $genQuery),0);

what could be possible wrong.

Edited by happygeek: fixed formatting

11 Years
Discussion Span
Last Post by visagar

It's probably not a php version problem

usually $sql and $query are the same thing and you use $result for the result set. That improves readability but doesn't fix anything

$result = mysql_query($query) or die(mysql_error() . '<br />'. $query);
while($row = mysql_fetch_array($result)){

this should show where the problem is.

If it's the query paste it into phpMyAdmin and see the errors there. It may be something simple like a missed quote mark or a column in the table.




Thank so very much. but how can i be having problems online when the code works perfectly on my test machine.


That points to a connection issue - but also to a potential difference in the structure of the tables. I was hoping the error message would give you one of those moments when you go "d'oh". It's frustrating but a solution is always a good thing.

We really need to know what mysql_error() returns.



thank u.. it worked. the its a case sensitive issue. i named the table Applicants and it refered to it as applicants;

thanks once more

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

code is here

$query  = "SELECT * FROM upload_question_1 ORDER BY Rand() WHERE

exprience='".$expr."' AND gread='".$catg."'  LIMIT 1";

$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
//echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]

echo $row [1];

Edited by happygeek: fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.