can anybody help me to solve this problem??? i want list the image using php.. what wrong's for this coding????????
<?php
@ $db = mysql_pconnect('localhost','root');
if (!$db)
{
echo 'Error: no record to database. Please try again later.';
exit;
}
mysql_select_db('mobile');
$query = "SELECT * FROM `images`";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
if(!$num_results)
{
echo 'No user can be found...Please search again!';
exit();
}
printf("<TABLE BORDER WIDTH=\"100%%\">\n");
printf("<TR>
<TD><B>id</B></TD>
<TD><B>sixfourdata</B></TD>
</TR>\n");
while (($row = mysql_fetch_object($result))){
printf("<TR>
<TD>%s</TD>
<TD>%s</TD>
</TR>\n",
$row->imgid, base64_decode($row->sixfourdata));}
printf("</TABLE>\n");
mysql_free_result($result);
?>
what wrong's with this coding?????????
Moderator: General Moderators
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Step one - post with php tags so someone will read your script:
Step two: Are you getting an error? If so, What? If not then whats not working about it?
Code: Select all
<?php
@ $db = mysql_pconnect('localhost','root');
if (!$db)
{
echo 'Error: no record to database. Please try again later.';
exit;
}
mysql_select_db('mobile');
$query = "SELECT * FROM `images`";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
if(!$num_results)
{
echo 'No user can be found...Please search again!';
exit();
}
printf("<TABLE BORDER WIDTH="100%%">\n");
printf("<TR>
<TD><B>id</B></TD>
<TD><B>sixfourdata</B></TD>
</TR>\n");
while (($row = mysql_fetch_object($result))){
printf("<TR>
<TD>%s</TD>
<TD>%s</TD>
</TR>\n",
$row->imgid, base64_decode($row->sixfourdata));}
printf("</TABLE>\n");
mysql_free_result($result);
?>- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact: