Vivid Lust Posted December 23, 2007 Share Posted December 23, 2007 Im getting the error Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/votick/public_html/check_login.php on line 15 Could not select database from the following code ??? <?php $username = $_POST['username']; $password = $_POST['password']; $self = $_SERVER['PHP_SELF']; $referer = $_SERVER['HTTP_REFERER']; $tbl_name = "banner"; # if either form field is empty return to the log-in page if( ( !$username ) or ( !$password ) ) { header( "Location:$referer" ); exit(); } $$conn = mysql_connect( "==", "==", "==" ) or die( "Could not connect" ); #Select database $rs = mysql_select_db( "votick_banner", $conn ) or die( "Could not select database" ); #Create Query $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'"; #execute query $rs = mysql_query( $sql, $conn ) or die( "could not execute query" ); #get rows that match fields $num = mysql_numrows ( $rs ); #if there is a match login is autherised if( $num != 0 ){ session_register("username"); session_register("password"); session_register("logged_in"); header( "Location:/controls.php" ); exit(); } else { header( "Location:$referer" ); exit(); } ?> Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/82955-solved-warning-mysql_select_db-supplied-argument-is-not-a-valid-mysql-link-resource/ Share on other sites More sharing options...
corbin Posted December 23, 2007 Share Posted December 23, 2007 $$conn = mysql_connect( "==", "==", "==" ) ..... $$.... I think you mean $ ;p. $$ is used to reference the variable thats the value of the calling one.... Example: $a = '5'; $b = 'a'; echo $$b; //echos 5 Quote Link to comment https://forums.phpfreaks.com/topic/82955-solved-warning-mysql_select_db-supplied-argument-is-not-a-valid-mysql-link-resource/#findComment-421906 Share on other sites More sharing options...
Vivid Lust Posted December 23, 2007 Author Share Posted December 23, 2007 Thanks fo much im such a no0b thanks again Quote Link to comment https://forums.phpfreaks.com/topic/82955-solved-warning-mysql_select_db-supplied-argument-is-not-a-valid-mysql-link-resource/#findComment-421911 Share on other sites More sharing options...
corbin Posted December 23, 2007 Share Posted December 23, 2007 No problem.... Typos can be evil in PHP x.x. Quote Link to comment https://forums.phpfreaks.com/topic/82955-solved-warning-mysql_select_db-supplied-argument-is-not-a-valid-mysql-link-resource/#findComment-421933 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.