Hi.
I am having a problem which didnt occur on my local machine but which has appeared when testing remotely on my server..
The database is definately called 'focust' and all other details are correct.. however, the error message being returned is " Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in g:\websites\luminate\htdocs\custwin\test.php on line 23 Error: No Database Selected" I have stared at this for a while trying to figure out how the database hasnt been selected, is there anything stupidly obvious i have missed?
$emailaddress=$_POST['emailaddress'];
$competitor1=$_POST['competitor1'];
$competitor2=$_POST['competitor2'];
$competitor3=$_POST['competitor3'];
$db = mysql_connect("localhost","","");
//problem area:
mysql_select_db("focust",$db);
$sql = "SELECT * FROM focust WHERE EmailAddress='$emailaddress'";
$result = mysql_query($sql)or die('Error: '.mysql_error());
$rows = mysql_num_rows($result);
//end problem
if($rows > 0)
{
echo"sorry, that email address already exists in our database. You may either try a <a href=\"test.htm\">different address</a> or <a href=\"modify.htm\">modify your details</a>";
exit;
}
else
{
//etc etc
thx in advance for any help
bob