问题描述:

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'] ?!

相关阅读:
Top