frijole Posted February 2, 2008 Share Posted February 2, 2008 I am trying to get the number of emails in the DB and echo it to the screen. I get this error: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, resource given in /home/thinksna/public_html/email.php on line 36 <?php /*Program: email.php *Desc: PHP program that sends an email address to the DB for a mailing list. */ if(ini_get("magic_quotes_gpc") == "1") { $_POST['email'] = stripslashes($_POST['email']); } $host="localhost"; $user="removed"; $password="removed"; if(strlen($_POST['email'])) { $con = mysql_connect($host,$user,$password); $sel = mysql_select_db('thinksna_email'); if(!con) { echo "<h4>Error</h4>"; } else { $email = mysql_real_escape_string($_POST['email']); mysql_query("INSERT INTO email (email, email_id, dateTime) VALUES ('$email', '' , NOW())") or die(mysql_error()); echo "$email was added to the list"; $result = mysql_query("SELECT * FROM email"); $emailCount = mysqli_num_rows($result); echo $emailCount; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/89014-solved-promblem-with-mysql_num_rows/ Share on other sites More sharing options...
Stooney Posted February 2, 2008 Share Posted February 2, 2008 change $emailCount = mysqli_num_rows($result); to $emailCount = mysql_num_rows($result); Quote Link to comment https://forums.phpfreaks.com/topic/89014-solved-promblem-with-mysql_num_rows/#findComment-455844 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.