WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-04-2006, 03:25 AM
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 263
ackerley1 RepRank 0
Default MySQL Trouble pulling images from a DB

I am using the below code:

function get_rand_img()
{
// Make the Query
$query = "SELECT 'image_url' FROM 'images' WHERE 'active' = 'Y' ORDER BY RAND() 'limit' =1";
// Run the query
$result = @mysql_query ($query);
// If it ran okay, display records
// if ($num > 0)
// {
echo '<table width="100%" border="1" cellspacing="5" cellpadding="5">
<tr>
<td>';
while ($img = mysql_fetch_array($result))
{
echo '[img]gall/images/'.$img.'[/img]';
}
echo '</td>
</tr>
</table>';

// }
}



To try and randomly display images from a DB in an area of the page. But it only gives me errors. I have this function in a funct.inc.php file in the inc folder... does this effect anything?

You can view the active site at

Thanks for the help!

Robwww.dilzoncharters.com
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: , , ,



Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0