Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-11-2005, 08:42 PM MySQL
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
Ok, I have this code:
PHP Code:
      $q "SELECT * FROM shoutbox";
      
$result mysql_query($q);
      
$r mysql_fetch_array($result);
      
$nam $r["name"];
      
$msg $r["comm"];
      echo 
"Name: "$nam ."<br>";
      echo 
"Message:";
      echo 
"<br>" $msg
and I want it to show more than one... right now I have 2 rows in MySQL account and it only shows one... the rows do have id's that are auto-incrementing, but I can't figure out how to show more than one
__________________

Please login or register to view this content. Registration is FREE
The future is now with 4D Realms
log2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-11-2005, 08:45 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
You have to loop over the array that mysql_fetch_array provides you to show all the results.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-11-2005, 08:47 PM
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
can you help me out please? nevermind I got it, I just had to think, while ($r = .... ) { thank cptnwinky
__________________

Please login or register to view this content. Registration is FREE
The future is now with 4D Realms

Last edited by log2; 03-11-2005 at 08:50 PM..
log2 is offline
Reply With Quote
View Public Profile
 
Old 03-11-2005, 08:50 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Try this...

PHP Code:
 $q "SELECT * FROM shoutbox";
      
$result mysql_query($q);
      while(
$r mysql_fetch_array($result)) {
            
$nam $r["name"];
            
$msg $r["comm"];
            echo 
"Name: "$nam ."<br>";
            echo 
"Message:";
            echo 
"<br>" $msg;
      } 
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 03-11-2005, 08:50 PM
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
i got it thnks... i edited my last post
__________________

Please login or register to view this content. Registration is FREE
The future is now with 4D Realms
log2 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to MySQL
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.79051 seconds with 12 queries