2007. 02. 21, szerda keltezéssel 06.26-kor Chris Carter ezt írta: > I have a field in database called "logos" which has one value > "images/logos/some_logo.jpg" > > In my php I am trying to call it in my php file as image. With this code. > > $sno = $_REQUEST['sno']; > > $query="SELECT logos FROM table WHERE sno = '$sno'"; be aware of sql injection. check the data before putting it into a query. and also, I do not recommend using $_REQUEST, it is better to use $_POST/$_GET instead > > $result=mysql_query($query); > $num=mysql_numrows($result); this is mysql_num_rows($result); correctly > > mysql_close(); > $logos=mysql_result($result,$i,"logos"); I recommend mysql_fetch_row or mysql_fetch_assoc instead http://hu.php.net/manual/en/function.mysql-fetch-row.php http://hu.php.net/manual/en/function.mysql-fetch-assoc.php if you have several rows in the result then do something like while ($row = mysql_fetch_row($result)) { // here you have a filename in $row[0] // do whatever you want to do with it, for example: echo "<p><img src=\"" . $row[0] . "\"></p>"; } hope that helps Zoltán Németh > > echo " > <div> > <p> $logos </p> > </div>"; > > ?></div> > > But getting errors. What is the way to call image in php file from the > database. I know that this is a very basic question but first time for me. I > ignored this in the begining but now its right infront of me. > > Please advice. > > -- > View this message in context: http://www.nabble.com/How-to-call-image-from-mySql-to-php-file-tf3267012.html#a9081704 > Sent from the PHP - General mailing list archive at Nabble.com. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php