PDA

View Full Version : Help with reading mysql


avelonx
11-02-2002, 01:14 AM
I need a script that will read from every row from every column in a loop.

Table: accounts
Columns: username,email,type,gender,alevel,uid

so for each row i want it to:

print("<td>(row#'s username)</td><td>(row#'s email)</td><td>(row#'s type)</td><td>(row#'s gender)</td><td>(row#'s alevel)</td><td>(row#'s uid)</td>");

until the loop hits the bottom.

Im not too good with mySQL , so I'm trying to explain this as best as possible.

Any help would be greatly appreciated.

Galdo
11-02-2002, 02:00 PM
This isn't really a mysql question, its more of a PHP one. I presume you know how to get the data from the database using:

mysql_fetch_array();

Try this:



$SQL=mysql_query("Select * from accounts");

While($row=mysql_fetch_array($SQL)){

print("<td>($row[username])</td><td>($row[email])</td><td>($row[type])</td><td>($row[gender])</td><td>($row[alevel])</td><td>($row[uid])</td>");

}


Hope this helps.