Jump to content

Recommended Posts

I'm getting an error that mysql_num_rows and mysql_result are undefined. Whats really weird is that mysql_connect and mysql_select_db are working.

 

Any idea what would cause it? I'm running it on windows, set my extension directory and uncommented out extension=php_mysql.dll in the php.ini.

 

Apache 2.0.63

PHP 5.2

if(mysql_num_rows(mysql_query("select `id` from `backupsystem` where `domain`='$site'")))

 

Don't think it is a code problem, here is the error:

 

Fatal error: Call to undefined function mysql_num_rows() in C:\BackupSystem\upda

teList.php on line 23

I don't know man. If you can connect then php is running. I usually write queries like this so it's easier to trouble shoot.

 

mysql_select_db($database, $connection);

$query = "SELECT x FROM y ";

$result = mysql_query($query, $connection) or die(mysql_error());

$num_row = mysql_num_rows($result);

 

You have to enable the mysql extension in the php.ini file.

 

Open that file and fine extensions then find the php_mysql (I think it is) and remove the ; from the beginning of that line, restart apache and it should work.

 

EDIT:

Noticed that he did uncomment, but did you restart apache :)

How do you know other mysql_ functions are working? You could for example have the mysql_connect and mysql_select_db in an include file that is not being included, so there is no fatal error associated with them. What's your complete code?

  • 13 years later...

 


Fatal error: Uncaught Error: Call to undefined function mysql_num_rows() in C:\xampp\htdocs\my_first_php\upload_profile_pic\signup.php:16 Stack trace: #0 {main} thrown in C:\xampp\htdocs\my_first_php\upload_profile_pic\signup.php on line 16

Plz, I'm also getting a similar error in my PHP code what's the solution dude?

 

 

Edited by bashmunir

1 - THIS IS A 12+ YEARS OLD POST.

2 - The MYSQL database interface was removed from PHP several years ago.  Try switching to MySQLI or go to PDO which is much easier to use IMO.

STOP POSTING TO THIS TOPIC!!!

  • Barand locked this topic
Guest
This topic is now 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.