show images from database ..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
N ! L E
Forum Newbie
Posts: 1
Joined: Mon Apr 21, 2008 11:16 am

show images from database ..

Post by N ! L E »

hello every one ,

i'm editing this module and i know a little pet about php and phpmyadmin ..

this module for importing top 10 news (articles ) from the news section and sort them by most reading ..

so .. this is the code before my editing ..

Code: Select all

<?php
/***************************************************************************
               ÈÑãÌÉ ÚÈÞÑí ÇáÚÑÈ || ãæÞÚ ÎÏãÇÊí.ßæã
            http://www.khadmaty.com (webmaster@khadmaty.com)
***************************************************************************/
// ßæÏ ÇÏÑÇÌ ÇáÈáæß Ýí ÇáÈæÇÈÉ ÇáÚÑÈíÉ
// <!--INC dir="block" file="most_seen_news.php" -->
 
if (TURN_BLOCK_ON !== true){
    die ("<center><h3>ÍÕá ÎØÃ ÚäÏ ãÍÇæáÉ ÇÓÊÏÚÇÁ ÇáÇÎÈÇÑ ÇßËÑ ãÔÇåÏÉ Ýí ÇáÈæÇÈÉ ÇáÚÑÈíÉ</h3></center>");
}
 
$index_middle .= "<div align=\"center\">
<center><table border='0' width='100%' align='center' cellpadding='".$linkColcount."'><tr>";
$result = mysql_query("SELECT id,title,reader FROM rafia_news where allow='yes' ORDER BY reader DESC limit 10");
while($row = mysql_fetch_array($result)){
extract($row);
$index_middle .= "<div><a title='read $reader' times before href=news.php?action=view&id=$id><b>$title</b></a></div></a>";
}
 
$index_middle .= "</tr></table></div>";
echo  $index_middle;
?>
so .. all what i need to know is how to add the show or display the article image from the database

i did this

Code: Select all

<?php
// <!--INC dir="block" file="most_seen_news.php" -->
 
if (TURN_BLOCK_ON !== true){
    die ("<center><h3>ÍÕá ÎØÃ ÚäÏ ãÍÇæáÉ ÇÓÊÏÚÇÁ ÇáÇÎÈÇÑ ÇßËÑ ãÔÇåÏÉ Ýí ÇáÈæÇÈÉ ÇáÚÑÈíÉ</h3></center>");
}
 
$index_middle .= "<div align=\"center\">
<center><table border='0' width='100%' align='center' cellpadding='".$linkColcount."'><tr>";
$result = mysql_query("SELECT id,title,reader,catmig FROM rafia_news where allow='yes' ORDER BY reader DESC limit 10");
while($row = mysql_fetch_array($result)){
extract($row);
$index_middle .= "<div><a title='ÚÏÏ ãÑÇÊ ÇáÞÑÇÁå $reader' href=news.php?action=view&id=$id><b>$title</b></a></div><div>$catmig</div></a>";
}
 
$index_middle .= "</tr></table></div>";
echo  $index_middle;
?>
but it's display a number like ( 0 ) or (1 ) in the html file..

what can i do ?
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: show images from database ..

Post by aceconcepts »

Try using

Code: Select all

mysql_fetch_assoc()
in place of

Code: Select all

 
mysql_fetch_array()
 
Post Reply