Reply
displaying database info in a list. How?
Old 08-04-2005, 02:06 PM displaying database info in a list. How?
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
How can I display an unordered list(<ul></ul>) with 30 entries from a database? They enteries ned to be the most recent with the 1st one being the newest I kmnow I need to use loops but am getting very confused
Cheers

PS: I have a table called gallery with the following fields id(primary), imgTitle, fileName, author,authorAddress, createDate(date)
__________________
Yes, indeed...
WebDevWorld.net | StrangeDarkness.com | MyNEWBlog
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
When You Register, These Ads Go Away!
Old 08-04-2005, 03:24 PM
KML9870's Avatar
One Bad Mamma :-)

Posts: 4,431
Name: Kandi
Location: Western NY
This should work:
Code:
	$query = "select * from gallery Order by '$creatDate"; 
 
$result = mysql_query($query);
$size_results = mysql_num_rows($result);
 
echo "<tr><font size='1'>\n";
while ($row = mysql_fetch_array($result,MYSQL_ASSOC) )
 
{
 
echo "<TABLE 'BORDER-COLLAPSE: collapse' cellSpacing=0 cellPadding=2 width='100%' border=0 align='center'>\n";
 
 
	echo "<td>	{$row['id']},<value=$id></td>\n";
 
	echo "<td>	{$row['imgTitle']},<value=$imgTitle></td>\n";
 
	echo "<td>	{$row['fileName']},<value=$fileName></td>\n";
 
	echo "<td>	{$row['author']},<value=$author></td>\n";
 
	echo "<td>	{$row['authorAddress']},<value=$authorAdress></td>\n";
 
	echo "<td>	{$row['createDate']},<value=$createDate></td>\n";
 
 
}
 
echo "</table>\n";
__________________
~~Kandi~~
Commit random acts of kindness frequently!

Last edited by KML9870 : 08-04-2005 at 03:27 PM.
KML9870 is offline
Reply With Quote
View Public Profile
 
Old 08-05-2005, 12:27 AM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Thank you KML.
I tried it and this is what I got back:
Quote:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\My_Web_Projects\Stra ngeDarkness-V2\poetry.php on line 63
__________________
Yes, indeed...
WebDevWorld.net | StrangeDarkness.com | MyNEWBlog
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 08-05-2005, 05:13 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Code:
"select * from gallery Order by '$creatDate";
add an extra ' to the end of that:

Code:
"select * from gallery Order by '$creatDate'";
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Scribble Pad MOD for phpBB (aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 08-05-2005, 05:40 AM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
ah yes of course! Give me a few weeks and I might understand what im doing heh heh
__________________
Yes, indeed...
WebDevWorld.net | StrangeDarkness.com | MyNEWBlog
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 08-05-2005, 07:15 AM
KML9870's Avatar
One Bad Mamma :-)

Posts: 4,431
Name: Kandi
Location: Western NY
And if I completly understood what I was doing I wouldn't have forgotten the other single quote . It's taken me a few months (and help from a bunch of people here) to be able to get far enough to offer help occassionally!

I'm glad it worked for you after a minor edit!
__________________
~~Kandi~~
Commit random acts of kindness frequently!
KML9870 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to displaying database info in a list. How?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15139 seconds with 12 queries