Jump to content

Count Rows in phpMyAdmin


matvespa

Recommended Posts

Hi. I having trouble with counting rows in phpmyadmin.

 

It works fine this way:

$result_rows = mysql_query("SELECT * FROM events");

 

But when i modify the code to this it doesnt work at all.

$result_rows = mysql_query("SELECT * FROM events WHERE category = 'adults' ORDER BY 'date'");

 

Any idea what is wrong?

Link to comment
Share on other sites

if you want to know the number of results you have to use "count" like this..

$result_rows = mysql_query("SELECT count(*) FROM events WHERE category = 'adults' ORDER BY 'date'");

 

If that is not what you are looking for then you will have to give me more info.  Your post is vague as you don't tell us if there are any error messages or exactly what the issue is.

Link to comment
Share on other sites

$result_rows = mysql_query("SELECT * FROM events WHERE category = 'adults' ORDER BY 'date'");

Remove single quotation mark

$result_rows = mysql_query("SELECT * FROM events WHERE category = adults ORDER BY date");

You can use  mysql_num_rows() to count number of rows.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.