PDA

View Full Version : MYSqL Problems


E3ven
12-18-2003, 03:47 PM
Warning: mysql_connect(): Unknown MySQL Server Host 'e3ven_e3ven' (1) in /home/e3ven/public_html/connect.php on line 6
1

wat's this?????
how to solve it????

E3ven
12-18-2003, 04:54 PM
The prob above i have solved it.

__

another error

__

Parse error: parse error in /home/e3ven/public_html/connect.php on line 2

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/e3ven/public_html/shout.php on line 17

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/e3ven/public_html/shout.php on line 30

raf
12-18-2003, 05:33 PM
mysql_num_rows() must have a resultidicator. Like

$sql="SELECT var from table");
$result=mysql_query($sql, $link) or die (Queryproplem);
echo mysql_num_rows($result);


The thing you have between the mysql_num_rows-brackets will probably not be the result-id of an executed and existing recordset.

DrWeb
12-18-2003, 07:13 PM
what I would do in such case, I would disable default errors and see if there is a problem with any previous statements:

<?php
$host = 'localhost';
$user = 'my_user_name';
$pass = 'my_password';
$database = 'my_data';


$connect = @mysql_connect ($host,$user,$pass) or die ("Could not connect " . mysql_error());

$my_database = @mysql_select_db ($database,$connect) or die ("Could not select database");

$sql = "SELECT * FROM `table` LIMIT 100";
$result = @mysql_query($sql) or die ("Error in query");
echo mysql_num_rows($result);
?>


note the '@' sign which overrides default error messages with your own. This way you would be able to pin-point your error.

raf
12-18-2003, 07:40 PM
Ahh. I didn't see the first errormessage.
Look inside connect.php at line 2 or 1. Probably missed a ; or a bracket or so.

The following errors are probably caused by a non-succesful connection.