:: print all rows based on a selected field?
Posted: Fri Aug 24, 2007 10:11 pm
feyd | Please use
However, my printed results are weird. There are 2 mySQL entries for Juan...the query prints the following:
desired printed result:
Please advise,
thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
I would like to print all entries in rows based on a certain field.
I have successfully integrated the following code (from php manual):Code: Select all
<?php
$query = "SELECT * FROM table_name WHERE member = 'Juan'";
$result = mysql_query($query) or die(mysql_error());
echo '<pre>';
while($row = mysql_fetch_array($result)) {
print_r($row);
}
echo '</pre>';
?>How can I clean this up?Array
(
[0] => Juan
[member] => Juan
[1] => 04/20/80
[date] => 04/20/80
[2] => Title1
[title] => Title1
[3] => This is my report description.
[description] => This is my report description.
[4] => 2007-08-24 23:09:52
[timestamp] => 2007-08-24 23:09:52
)
Array
(
[0] => Juan
[member] => Juan
[1] => 04/21/80
[date] => 04/21/80
[2] => Title2
[title] => Title2
[3] => This is my report description.
[description] => This is my report description.
[4] => 2007-08-24 23:09:36
[timestamp] => 2007-08-24 23:09:36
)
desired printed result:
Juan
04/20/80
Title1
This is my report description.
Juan
04/21/80
Title2
This is my report description.
Please advise,
thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]