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.

Will Gresham commented: Code tags and written in English on your first post :) +2

Recommended Answers

All 3 Replies

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

That's what we are here for :P :D

Don't forget to mark as solved.

thanks Will, I missed the solved part.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.