maxudaskin Posted July 18, 2007 Share Posted July 18, 2007 What would Cause this error? Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/someurl/someurl.net/include/functions.php on line 10 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/someurl/someurl.net/include/functions.php on line 11 Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 18, 2007 Share Posted July 18, 2007 a failed query. Why it failed is ... who knows. Plan A: add error trapping $query = " whatever it is"; $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted July 18, 2007 Author Share Posted July 18, 2007 The error is: Error: with query Quote Link to comment Share on other sites More sharing options...
ryeman98 Posted July 18, 2007 Share Posted July 18, 2007 The error is: Error: with query Do you have to be a n00b? Post lines 8 - 15 from include/functions.php Then maybe we can see what could be causing the error? Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted July 18, 2007 Author Share Posted July 18, 2007 The error is: Error: with query Do you have to be a n00b? Post lines 8 - 15 from include/functions.php Then maybe we can see what could be causing the error? Well, I think that is too much to ask require ("dbconnect.php"); function login($username,$password){ $md5pass = md5($password); $sql = "SELECT * FROM users WHERE pid = '{$username}'"; $sql2 = "SELECT * FROM users WHERE pass = '{$md5pass}'"; $query = mysql_query($con,$sql) or die("Error: ". mysql_error(). " with query ". $query); $query2 = mysql_query($con,$sql2) or die("Error: ". mysql_error(). " with query ". $query2); if (!$query || (mysql_numrows($result) < 1)){ return 1; } elseif(!$query2 || (mysql_numrows($result2) < 1)){ return 2; } else { return 0; } } dbconnect.php <?php $hostname_LeadHost = "[removed]"; $database_LeadHost = "[removed]"; $username_LeadHost = "[removed]"; $password_LeadHost = "[removed]"; $con = mysql_pconnect($hostname_LeadHost, $username_LeadHost, $password_LeadHost) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db('[removed]', $con); ?> Quote Link to comment Share on other sites More sharing options...
JayBachatero Posted July 18, 2007 Share Posted July 18, 2007 mysql_query ( string $query [, resource $link_identifier] ) Query first then connection. Quote Link to comment Share on other sites More sharing options...
rlindauer Posted July 18, 2007 Share Posted July 18, 2007 Didn't you already start a thread about this very same problem? edit: Yep -> http://www.phpfreaks.com/forums/index.php/topic,150151.msg647122.html Your login function doesn't know what $con is, and your mysql_query() is not correct. You have to pass the sql query first, then the connection link. edit2: ^^^ Like JayBachatero posted. Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted July 18, 2007 Author Share Posted July 18, 2007 Yep... I couldnt find it... even with the search... I thought it was deleted. Quote Link to comment Share on other sites More sharing options...
rlindauer Posted July 18, 2007 Share Posted July 18, 2007 There is a link at the top of the forums that will show you new replies to your posts. Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted July 18, 2007 Author Share Posted July 18, 2007 NO MATTER WHAT I DO OR WHAT I TRY, IT KEEPS TELLING ME THIS: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/vzoom/virtualzoom.net/include/functions.php on line 13 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/vzoom/virtualzoom.net/include/functions.php on line 14 AND I AM ABOUT TO PULL MY DARK BROWN [PUT SWEARWORD HERE GREYING FROM STRESS HAIR BECAUSE I AM SO -- PISSED OFF WITH THIS SCRIPT.!!! Edit ---------- Is there anything wrong with this? $con = mysql_connect("mysql.blahblahblah.net", "admin","admin"); mysql_select_db("db", $con); function login($username,$password){ if(!get_magic_quotes_gpc()) { $username = addslashes($username); } $q = "select pid from users where pid = '$username'"; $q2 = "select pass from users where pid = '$username'"; $query = mysql_query($q,$con); $query2 = mysql_query ($q2,$con); if (!$query || (mysql_numrows($query) < 1)){ return 1; } elseif(!$query2 || (mysql_numrows($query2) < 1)){ return 2; } else { return 0; } } Quote Link to comment Share on other sites More sharing options...
rlindauer Posted July 18, 2007 Share Posted July 18, 2007 Man, read my replies. $con is not within the scope of your function. Login has no idea what $con is, therefor, mysql_query doesn't know what $con is. All you need to do is pass $con to the function... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.