Page 2 of 2

Posted: Fri Aug 06, 2004 10:16 pm
by Joe
try:

Code: Select all

mysql_fetch_assoc($resultd);

Posted: Fri Aug 06, 2004 10:18 pm
by System_Failure
Joe wrote:try:

Code: Select all

mysql_fetch_assoc($resultd);
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /path/functions.php on line 184

Posted: Sat Aug 07, 2004 12:04 am
by markl999
$resultd = mysql_query($queryd) or die(mysql_error());
If you use that in both instances (your 2 queries) it should tell you why it's failing.

Posted: Sat Aug 07, 2004 12:17 am
by System_Failure
Surprisingly, its saying "No Database Selected" as the error message! But I did select the database in the header

Posted: Sat Aug 07, 2004 12:20 am
by markl999
Also add ... or die(mysql_error()); to your mysql_connect() and mysql_select_db() calls just to be sure they are working ok.
What's weird is that previously you were getting the results from the query ok but now you're not .. something must have changed during that time :o

Posted: Sat Aug 07, 2004 12:23 am
by System_Failure
well, the rest of the page can connect to the database and retrive data, but just that function seems to be unable to detect the database :(

Posted: Sat Aug 07, 2004 12:30 am
by System_Failure
Solved.....I had to connect again in the function, and then close the connection af the end of the function :(

I can not thank you all enough for helping...your help was really really appreciated :). I've spent two days on this, and finally I can move on and complete the project :p

Edit: One problem though, main connection set in the header is in the variable $link, and the quick one on functions.php for the function is called $link2. Now, I close the $link2 connection at the end of functions.php, and I close my main one in the footer.php file. Now I am getting this error :

Code: Select all

Warning: mysql_close(): 6 is not a valid MySQL-Link resource in /path/footer.php on line 14
Line 14 is mysql_close($link);

Posted: Sat Aug 07, 2004 1:12 am
by System_Failure
kinda did a temporary fix to that by disconnecting $link just before echoing the function, and reconnecting $link again just after echoing the function.