PDA

View Full Version : about print



rotan
August 10th, 2002, 23:39
please help me that how i can print the select result on my server.
my os is linux and database is mysql.:confused:

Christopher
August 11th, 2002, 01:30
PHP?

Depends, if it is one result, you can go


$query = mysql_query("SELECT * FROM table WHERE sum='1'");
$result = mysql_fetch_array($query);
print "Sum: ".$result[sum]."<br>";

But if it's more then one result, like search results, then something like this:


$query = mysql_query("SELECT * FROM table WHERE category='ya'");

while($result = mysql_fetch_array($query)) {
print "Title: ".$result[title]."<br>";
print "Description: ".$result[description]."<br>";
}

Assuming the propper table structure. :)