0

I have this sql command that gives me result from search

$query = mysql_query("SELECT * FROM persons WHERE FirstName LIKE '%" . $searchText . "%' ORDER by RAND() LIMIT $offset,$per_page");

can anyone teach me if i can get the number of result so that i can replace the value of pagination this is the value of pagination so it only counts the whole table and numbers of rows.

$count_query = mysql_query("SELECT COUNT(personid) AS numrows FROM persons");

I know it will only count all of the rows so it gives me all the result in numbers. I want to the query so that it will only count the result when I press enter from my search it is in jquery . can i assign a query that will count the $query variable rows result?

1
  • Can you frame your question properly ... not able to understand what you are trying to ask. Commented Jul 27, 2013 at 2:42

1 Answer 1

3

What I am getting from your question is that you are trying to count the number of rows returned by first query in $query variable.

$num_rows = mysql_num_rows($query);

This should help you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.