Jump to content

qns abt mysql functions


aaronlzw_21

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..
Link to comment
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.
Link to comment
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..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.