Hi,
I'm throwing together a quick message board and have come across a problem. When a message gets displayed, MySQL gets called upon to grab the message from the database called 'forum'. This happens without toruble, but when I connect to mysql again using a different database to get member infomation, MySQL always gives me an error if I try to work with the data. I don't know if I should be using a single SQL statement to use the two databases or not. The code in question:
<snip>Code:// MySQL Login $u = username; $p = password; $d = forum; $db = mysql_connect("localhost", "$u", "$p") or DIE("Unable to connect to database. Please contact system admin."); mysql_select_db("$d",$db) or DIE("Unable to select database. Please contact system admin."); // 2nd MySQL Login $u2 = username; $p2 = password; $d2 = other_database; $db2 = mysql_connect("localhost", "$u2", "$p2") or DIE("Unable to connect to database. Please contact system admin."); mysql_select_db("$d2",$db2) or DIE("Unable to select database. Please contact system admin.");
The script then displays the messages in the thread, and then the member infomation is grabbed:
But MySQL doesn't like this and says this:Code:$members = mysql_query("SELECT * FROM members WHERE username='$author'",$db2); $email = mysql_result($members,0,"email");
If someone could help me out with working with more than one database, or can see an error in the code, please let me knowWarning: Supplied argument is not a valid MySQL result resource in /web/.../www/forum/showmsg.php on line 68![]()





Bookmarks