...

View Full Version : weird php/mysql



Birdie312
06-11-2006, 09:04 PM
<?
$mysqluser = "root";
$mysqlpass = "pass";
$mysqlhost = "localhost";
$mysqldb = "db";
$rootpath = "/somewhere/";



mysql_connect($mysqlhost,$mysqluser,$mysqlpass);
mysql_select_db($mysqlpass);

$ip = $_SERVER['REMOTE_ADDR'];
$sql = "SELECT * FROM portal_logintrys WHERE ip='$ip'";
$query = mysql_query($sql);
$numrows = mysql_num_rows($query);
echo $numrows;
?>



the error is..


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in

For some reason this wont work, neither would it work for mysql_fetch_array();

Any thoughts on why it doesnt work?

any ideas will be greatly appreciated. thanks :thumbsup:

Nicklas
06-11-2006, 10:05 PM
Take a close look in this line mysql_select_db($mysqlpass);
maybe youŽd want to connect to $mysqldb instead ;)

Birdie312
06-11-2006, 10:30 PM
:thumbsup: :thumbsup: :thumbsup: wow never noticed that!! thanks, i'll have to change it. ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum