当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Retrieve image from database using CodeIgniter

问题描述:

this code work only in admin page but can't work in view page how to retrieve image from view page in codelgniter

code:

<?php

include('config.php');

$result = mysql_query("SELECT * FROM photos");

while($row = mysql_fetch_array($result))

{

echo '<div id="imagelist">';

echo '<p><img src="'.$row['location'].'"></p>';

echo '<p id="caption">'.$row['caption'].' </p>';

echo '</div>';

}

?>

网友答案:

Why you use mysql extension in codeigniter ?!

Even though the meaning of that code work in admin is you store your image inside admin folder

So for best practice

Please use codeIgniter as a FrameWork not a place to paste your procedural PHP code !
Also show us what is in $row['location'] ?!

分享给朋友:
您可能感兴趣的文章:
随机阅读: