[PHP] pulling records from mysql

2002-07-25 Thread Tyler Durdin

I have a column in my table named firstname with twenty records in it. How 
can i use php to pull out individual records (say for ex. record 16)? Also, 
how could i pull out all records upto number 15? Thanks in advance.



_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




RE: [PHP] pulling records from mysql

2002-07-25 Thread David Buerer

Create a column like.person_id with the auto_incr flag set.  Every
record will be given a unique id starting at 1 and incrementing by 1 each
time.  Then you can query based on person_id field to get an individual
record

-Original Message-
From: Tyler Durdin [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 25, 2002 8:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] pulling records from mysql


I have a column in my table named firstname with twenty records in it. How 
can i use php to pull out individual records (say for ex. record 16)? Also, 
how could i pull out all records upto number 15? Thanks in advance.



_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: [PHP] pulling records from mysql

2002-07-25 Thread Martin Clifford

You would need to use SQL to identify which columns and rows you need to retrieve, 
then use various MySQL PHP functions to gather the information.

For your two queries, they would appear thus, respectively:

SELECT firstname FROM tablename WHERE id=16

and

SELECT firstname FROM tablename ORDER BY id ASC LIMIT 15

The functions you'll want to look into are mysql_connect(), mysql_select_db(), 
mysql_query() and mysql_fetch_array().  They can be found at http://www.php.net, do a 
search for any one of the functions ;o)

HTH

Martin

 Tyler Durdin [EMAIL PROTECTED] 07/25/02 11:18AM 
I have a column in my table named firstname with twenty records in it. How 
can i use php to pull out individual records (say for ex. record 16)? Also, 
how could i pull out all records upto number 15? Thanks in advance.



_
Send and receive Hotmail on your mobile device: http://mobile.msn.com 


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



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




Re: [PHP] pulling records from mysql

2002-07-25 Thread Tech Support

This query will return only the 16th row

SELECT firstname FROM table_name LIMIT 16, 1

This query will give you all rows up to 15

SELECT firstname FROM table_name LIMIT 1, 15


Jim Grill
Support
Web-1 Hosting
http://www.web-1hosting.net
- Original Message -
From: Tyler Durdin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 10:18 AM
Subject: [PHP] pulling records from mysql


 I have a column in my table named firstname with twenty records in it. How
 can i use php to pull out individual records (say for ex. record 16)?
Also,
 how could i pull out all records upto number 15? Thanks in advance.



 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com


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






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




Re: [PHP] pulling records from mysql

2002-07-25 Thread Martin Clifford

Yes, that will indeed return the rows specified, but the result is very unstable.  By 
it's nature, MySQL does not have to conform to any sorting method unless you specify 
it.  So it's very good practice when retrieving multiple rows to ALWAYS order them.  
Just my thoughts :o)

Martin

 Tech Support [EMAIL PROTECTED] 07/25/02 12:09PM 
This query will return only the 16th row

SELECT firstname FROM table_name LIMIT 16, 1

This query will give you all rows up to 15

SELECT firstname FROM table_name LIMIT 1, 15


Jim Grill
Support
Web-1 Hosting
http://www.web-1hosting.net 
- Original Message -
From: Tyler Durdin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 10:18 AM
Subject: [PHP] pulling records from mysql


 I have a column in my table named firstname with twenty records in it. How
 can i use php to pull out individual records (say for ex. record 16)?
Also,
 how could i pull out all records upto number 15? Thanks in advance.



 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com 


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






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



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