Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Posts: 750
Location: Lancashire, UK
Trades: 0
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...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
 
Register now for full access!
Old 08-04-2005, 04:24 PM
KML9870's Avatar
One Bad Mamma :-)

Posts: 5,489
Name: Kandi
Location: Western NY
Trades: 0
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~~

Please login or register to view this content. Registration is FREE



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

Posts: 750
Location: Lancashire, UK
Trades: 0
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...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 08-05-2005, 06:13 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
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';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 08-05-2005, 06:40 AM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
ah yes of course! Give me a few weeks and I might understand what im doing heh heh
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 08-05-2005, 08:15 AM
KML9870's Avatar
One Bad Mamma :-)

Posts: 5,489
Name: Kandi
Location: Western NY
Trades: 0
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~~

Please login or register to view this content. Registration is FREE


KML9870 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to displaying database info in a list. How?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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 1.53823 seconds with 12 queries