English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

This script selects all the rows that i need but now how do i echo the fileds from each row that its found?



$connection = mysql_connect($host,$user,$password)
or die ("coudlnt connectto server.");
$db = mysql_select_db($database, $connection)
or die ("coulnt find database.");
$query = "SELECT * FROM CUSTO where PENDINGD=""";
$result = mysql_query($query)
or die ("yellow");
$num = mysql_num_rows($result);
$row = mysql_fetch_array($result);
extract($row);

2007-11-22 03:54:31 · 2 answers · asked by peter s 1 in Computers & Internet Programming & Design

2 answers

believes the mysql_fetch_array function will do it might have to do something like

while ($row = mysql_fetch_array($result)){
echo $row['field_name'] . "
";
}

* interesting line breaks wonders about links

2007-11-22 04:01:18 · answer #1 · answered by grey_worms 7 · 1 0

You need to assign each row of data to a display string, this can be the whole string as a table :
$display_string ="


//add a heading row to the table
";
while($show_record = mysql_fetch_array($result)){
$display_string .="


//other fields
";
}
echo $display_string;
$diplay_string .="
$show_record[field1] $show_record[field2]
";
The . before the = concatenates the current string to the original.

2007-11-22 04:26:38 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers