[PHP-DB] Debugging/monitoring traffic to MySQL

2002-07-18 Thread Clive Bruton

Is there a way to see the traffic between PHP and MySQL, ie see the 
statements/raw data that is sent between the two processes.

I've tried running the MYSQL client, but there doesn't seem to be any 
obvious command to do this. Some other terminal process?

I'm running MacOS X.

TIA.


-- Clive

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Select a subset?

2002-07-16 Thread Clive Bruton

[EMAIL PROTECTED] wrote at 16/07/02 09:44

  $result = mysql_query(SELECT COUNT(*) as numrows FROM
table,$db);
  $row = mysql_fetch_array($result);
  $num_rows = $row['num_rows'];

Joakim, thanks, that sorted it. Just one note, numrows in the sql query 
should be num_rows? That's how I got it to work anyway.


-- Clive

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Select a subset?

2002-07-15 Thread Clive Bruton

Adam Alkins wrote at 15/07/02 04:06

mysql_num_rows just counts the amount of rows in a query, so if you only
selected 10 rows, it will return 10.

If you want to count all the rows in the table, its best to use the COUNT()
function

 SELECT COUNT(*) FROM table

In my example, I've selected all rows, ie no search criteria. But let's 
assume that I have in fact searched for something that returns half the 
records in the table (5,000 rows).

How do I get both the number of rows found (5,000) and get a subset of 
the records (ie 0-9, 10-19, 20-29...) so that a user can browse through 
the records rather than getting 5,000 at a time (but still know that a 
total of 5,000 were found).

I hope this makes sense.


-- Clive

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php