Jump to content

Archived

This topic is now archived and is closed to further replies.

aaronlzw_21

qns abt mysql functions

Recommended Posts

i have a qns.. is there a mysql function that takes out the whole table and store it in a variable. and from there we access it? like in asp.net there is.

and another qns is that lets say a for loop that loop 3 times. how do i halt it till a user clicks on something update the database then loop the second time and same thing happen, halt, click then loop again. is there a fuction?

thanks ya..

Share this post


Link to post
Share on other sites
You can fetch all of a tables data and loop through it with something like: [code]<?php
$result = mysql_query("SELECT * FROM `table`");
while($row = mysql_fetch_assoc($result)) {
    //Echo your columns here with $row['name'] to print the column 'name'
}
?>[/code]

You won't be able to do your second question as easily with PHP - Everything is processed on the server before it is passed to the users browser. You'll have to pass a count to and from your page to keep track of cycles and clicks.

Share this post


Link to post
Share on other sites
[!--quoteo(post=374223:date=May 16 2006, 04:41 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 16 2006, 04:41 PM) [snapback]374223[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You can fetch all of a tables data and loop through it with something like: [code]<?php
$result = mysql_query("SELECT * FROM `table`");
while($row = mysql_fetch_assoc($result)) {
    //Echo your columns here with $row['name'] to print the column 'name'
}
?>[/code]

You won't be able to do your second question as easily with PHP - Everything is processed on the server before it is passed to the users browser. You'll have to pass a count to and from your page to keep track of cycles and clicks.
[/quote]


okok thanks.. what's the differences between mysql_fetch_assoc(), mysql_fetch_row() and mysql_fetch_array()? they all seem to work the same way..

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.