Page 1 of 1

Problem after moving code to new server

Posted: Wed Oct 06, 2004 3:56 pm
by loxer420
I have recently moved my web application to a shared hosting server running Apache and MySQL from my local Windows 2000 IIS/PHP/MySQL machine. After the move, most of my application works fine, but I am receiving the following message.

Code: Select all

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/website/public_html/webapp/reports_laborerweeklydetail.php on line 23
(line 23 is "while($row_hour...")


Below is my code:

-------> Included file for connection

Code: Select all

<?
session_start();
$db="database_name";
$link = mysql_connect("localhost", "webuser", password") or die ("Could not connect");

mysql_select_db("database_name",$link)
?>
-------> File where error occurs

Code: Select all

$GLOBALS[rowflag] = "ON";
   $sqlquery = "SELECT workdate,description,hours FROM HS00001 WHERE rowid=(".$GLOBALS[rowid].")";
   $result = mysql_query($sqlquery,$link);
   while($row_hour=mysql_fetch_array($result))
{ DO STUFF }

I just don't understand because the versions of PHP are very similar and the rest of the application runs perfectly. This code is included inside of another main reports.php file which runs a case statement to pull this report file.

Anyone have any ideas what environment variables I can look at?


feyd | added

Code: Select all

and

Code: Select all

tags[/color]

Posted: Wed Oct 06, 2004 3:59 pm
by Draco_03
first thing i saw is your missing a double quote in your mysql_conenct,
use

Code: Select all

tags to make php code apears with colors.
easier to read, more ppl will help..

Posted: Wed Oct 06, 2004 4:04 pm
by feyd
Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/size]

you have an error in your query.. I'd bet you need quotes around your $GLOBALS call.. and quote string literals darnit.

Code: Select all

$result = mysql_query($sqlquery, $link) or die(mysql_error());
will tell you more information.

Posted: Thu Oct 07, 2004 2:52 am
by twigletmac
Up your error reporting to E_ALL, read the second link in my sig.

Mac

echo

Posted: Thu Oct 07, 2004 3:46 am
by phpScott
echo your query out, that error message usually means that you are not getting a result back so there is nothing to fetch.

after you get your query run it directly agianst the db to see what the result might be.