tibberous Posted February 27, 2009 Share Posted February 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/ Share on other sites More sharing options...
simon551 Posted February 27, 2009 Share Posted February 27, 2009 post the code. it's probably a problem with your mysql_query statement Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-772686 Share on other sites More sharing options...
tibberous Posted February 27, 2009 Author Share Posted February 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-772687 Share on other sites More sharing options...
simon551 Posted February 27, 2009 Share Posted February 27, 2009 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); Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-772749 Share on other sites More sharing options...
premiso Posted February 27, 2009 Share Posted February 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-772755 Share on other sites More sharing options...
PFMaBiSmAd Posted February 27, 2009 Share Posted February 27, 2009 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? Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-772757 Share on other sites More sharing options...
bashmunir Posted August 24, 2022 Share Posted August 24, 2022 (edited) 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 August 24, 2022 by bashmunir Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-1599730 Share on other sites More sharing options...
ginerjm Posted August 24, 2022 Share Posted August 24, 2022 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!!! Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-1599731 Share on other sites More sharing options...
Barand Posted August 24, 2022 Share Posted August 24, 2022 and RTFM... Link to comment https://forums.phpfreaks.com/topic/147192-undefined-function-mysql_num_rows/#findComment-1599735 Share on other sites More sharing options...
Recommended Posts