Jump to content

random selection


miltonbanks

Recommended Posts

thanks again for your help, but i cant seem to get it to work, i have managed to print the rows into a table, but cant seem to assign the values to variables

 

$query  = "SELECT * FROM table ORDER BY Rand() LIMIT 5";

  $result = mysql_query($query);

 

 

  echo "<table>";

  while ($row = mysql_fetch_array($result, MYSQL_NUM)) {

      echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td></tr>";

 

////what i want is $value1=$row[0]  , or something like that

 

  }

  echo "</table>";

} else {

    echo "database down

}

 

?>

 

again, thanks for your time!!!!

Link to comment
Share on other sites

$row[2]

 

$row --- array

[2] ---index of array that is supposedly from your db so

 

syntax should be

 

$row[field of table you query];

 

it should go something like

cho "<tr><td>$row[name]</td><td>$row[add]</td><td>$row[etc]</td></tr>";

 

the example in that site is very clear try to read that again that will help you  ;D ;D

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.