Jump to content

[SOLVED] Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource


Vivid Lust

Recommended Posts

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.

$$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.