Reply
How do you display all entries from a whole table?
Old 07-03-2004, 01:16 PM How do you display all entries from a whole table?
johanesw's Avatar
Extreme Talker

Posts: 174
Location: If I told you that, I'm afraid I'd have to kill you!
Hi there...do you guys know how to echo all the entries in a whole table (MYSql). What function do you use? I mean the entire entries in a table not just one single row. Thanks guys.
johanesw is offline
Reply With Quote
View Public Profile Visit johanesw's homepage!
 
When You Register, These Ads Go Away!
Old 07-03-2004, 01:30 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
PHP and Unicode with UTF-8
Posts: 3,111
Location: Toronto, Ontario
PHP Code:
$result mysql_query("SELECT * FROM mytable");
while(
$row mysql_fetch_array($result))
{
    
// print them out

Just a query without any WHERE clause.
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 07-05-2004, 03:55 AM
johanesw's Avatar
Extreme Talker

Posts: 174
Location: If I told you that, I'm afraid I'd have to kill you!
Ok
johanesw is offline
Reply With Quote
View Public Profile Visit johanesw's homepage!
 
Old 07-05-2004, 06:24 AM
johanesw's Avatar
Extreme Talker

Posts: 174
Location: If I told you that, I'm afraid I'd have to kill you!
But then is there a way to refer each row separately after you get all the entries. Like if you want to diplay row 6 only you do something like $data[5]. Is there a way to do that?
johanesw is offline
Reply With Quote
View Public Profile Visit johanesw's homepage!
 
Old 07-05-2004, 06:38 AM
Christopher's Avatar
Iced Cap

Latest Blog Post:
PHP and Unicode with UTF-8
Posts: 3,111
Location: Toronto, Ontario
All you have to do is build your own array,

PHP Code:
$data = array(); // initialize is to keep me happy (as you know, in PHP it's not required)
$result mysql_query("SELECT * FROM mytable");
while(
$row mysql_fetch_array($result))
{
    
$data[] = $row;


echo 
$data[5]['Name']; // echo row 6's field 'Name' (if it were to exist) 
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 07-05-2004, 06:43 AM
johanesw's Avatar
Extreme Talker

Posts: 174
Location: If I told you that, I'm afraid I'd have to kill you!
Wow...Great..thanks a lot
johanesw is offline
Reply With Quote
View Public Profile Visit johanesw's homepage!
 
Reply     « Reply to How do you display all entries from a whole table?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12910 seconds with 12 queries