maxudaskin Posted July 17, 2007 Share Posted July 17, 2007 I get this error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/vzoom/virtualzoom.net/include/functions.php on line 10 For this script: dbconnect.php <?php $hostname_LeadHost = "localhost"; $database_LeadHost = "dbname"; $username_LeadHost = "dbuser"; $password_LeadHost = "dbpass"; $con = mysql_pconnect($hostname_LeadHost, $username_LeadHost, $password_LeadHost) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db('dbname', $con); ?> functions.php 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); $query2 = mysql_query($con,$sql2); if (!$query || (mysql_numrows($result) < 1)){ return 1; } elseif(!$query2 || (mysql_numrows($result2) < 1)){ return 2; } else { return 0; } } Link to comment https://forums.phpfreaks.com/topic/60433-not-a-valid-mysql-resource-link/ Share on other sites More sharing options...
ballhogjoni Posted July 17, 2007 Share Posted July 17, 2007 is functions.php and dbconnect.php in the same folder? Link to comment https://forums.phpfreaks.com/topic/60433-not-a-valid-mysql-resource-link/#findComment-300613 Share on other sites More sharing options...
rlindauer Posted July 17, 2007 Share Posted July 17, 2007 Your mysql_query statement is incorrect. mysql_query($con,$sql); shouldn't that be? mysql_query($sql, $con); Where does $con come from? It is not in the functions scope Link to comment https://forums.phpfreaks.com/topic/60433-not-a-valid-mysql-resource-link/#findComment-300623 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.