1

Hi all -

This is kicking my butt. I have searched everywhere I can think of and have tried the various solutions to no avail.

First I am connecting to two databases on the same instance of mySQL using :

$conn2 = mysql_connect ( "XXX.XX.XX.13", "User1", "PWord1",true) or die("Could not connect to the database." . mysql_error());
$conn1 = mysql_connect ( "XXX.XX.XX.13", "User2", "PWord2",true) or die("Could not connect to the database." . mysql_error());

mysql_select_db("database1", $conn2) or die("There has been a database error."); 
mysql_select_db("database2", $conn1) or die("There has been a database error.");

Second I run this query and return the results:

$result = mysql_query("SELECT FileLocation, RecID, WidgetKey, 
    Options, More FROM tbl_user_widgets uw JOIN tbl_widgets w
    ON uw.widget=w.recid WHERE pos3=1 AND EmpID='$empID' 
    AND ColumnID=2;", $conn1);

while ($rowArray = mysql_fetch_array($result)) {
    $key=$rowArray['WidgetKey'];
    $WidgetID=$rowArray['RecID'];
    $options=$rowArray['Options'];
    $more=$rowArray['More'];
    include($rowArray['FileLocation']);
}

After the FIRST record is returned I get the following:
Warning: mysql_fetch_array(): 38 is not a valid MySQL result resource in...

I always get one record, but only one and mysql_error() is empty.

I am befuddled and ready to take a hammer to the harddrive.

Votes + Comments
Code tags and written in English on your first post :)
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Randomnoize
0

Well all, I sure feel STUPID. After reading my post I finally saw my mistake. $result is ALSO called in my include file, thus when control returns to the calling PHP file $result is something else and EOF.

I guess I just needed one more thing to prick my memory. It is not like I haven't had this problem before... ugh.

Sorry everyone for the waste of space, but in some sort of round about way, thank you for helping me fix my problem. :)

Peace

This question has already been answered. 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.