I've been using this without issue for ages..... and now it isnt outputing the info... I get a blank table like it's trying to work but not displaying it...

<?php
include('dataentry/update-connect2.php');

$sql="SELECT * FROM photos Order by stageno asc";
$result=mysql_query($sql);
?> <table width="670" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <div id="table-wrapper"> <div id="table-scroll"> <table width="670" border="1" cellspacing="0" cellpadding="3"> <thead> <tr> <th align="center"><font color="#D98A3A">Thumbnail</font></th> <th align="center"><font color="#D98A3A">Characters In Image</font></th> <th align="center"><font color="#D98A3A">Image Artist</font></th> </tr> </thead> <tbody> <?php
while($rows=mysql_fetch_array($result)){
?> <tr> <tr><td width="14%" align="center"> <a href="http://url.net/popups/photos/photoshow.php?picture=<? echo $rows['idnumber']; ?>" rel="facebox" style="text-decoration: none"> <img border="0" src="http://url.net/gallery/pictures/<? echo $rows['image']; ?>_th.png"></a></td> <td><? echo $rows['character']; ?> </td> <td><? echo $rows['artist']; ?> </td> </tr> <?php
}
?> </tbody> </table> </div></div> </td> </tr> </table> <?php
mysql_close();
?>

i am presuming this is due to mysqli being better but I have tried to convert it to mysqli and am failing... can anyone please help me re-write this....

Recommended Answers

All 5 Replies

put 2 lines in your code after inculde statement, run the page and it will show you error /notice/warning

   include('dataentry/update-connect2.php');

   error_reporting(E_ALL); 
   ini_set("display_errors", 1);

   $sql="SELECT * FROM photos Order by stageno asc";

Click Here

I get no errors... it just looks like this....

Member Avatar for diafol

i am presuming this is due to mysqli being better but I have tried to convert it to mysqli and am failing...

Don't understand. There is no evidence of mysqli anywhere in your code. Run the query in phpMyAdmin and see if you get a result. Also make sure your connection is valid. Where's you're error reporting? Use or die() to help - see the manual.

diafol
The code is in mysql... i know mysqli is better but I do not know how to convert this code to mysqli, I tried and failed...

The connection works I checked that already
This is my attempt to convert it to mysqli. I have no errors that post... but again it just shows a blank table and a broken image for each echo line

<?php
include('dataentry/connect-mysql-p.php');
error_reporting(E_ALL); 
ini_set("display_errors", 1);
$sql="SELECT * FROM pictures Order by stageno asc";
$result=mysqli_query($dbcon,$sql);
?>
<table width="670" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<div id="table-wrapper">
  <div id="table-scroll">
  <table width="670" border="1" cellspacing="0" cellpadding="3">
<thead>
<tr>
<th align="center"><font color="#D98A3A">Thumbnail</font></th>
<th align="center"><font color="#D98A3A">Characters In Image</font></th>
<th align="center"><font color="#D98A3A">Image Artist</font></th>
</tr>
</thead>
<tbody>
<?php
while($rows=mysqli_fetch_array($result)){
?>

<tr>
<tr><td width="14%" align="center">
<a href="http://url.net/popups/photos/photoshow.php?picture=<? echo $rows['idnumber']; ?>" rel="facebox" style="text-decoration: none">
<img border="0" src="http://url.net/gallery/pictures/<? echo $rows['image']; ?>_th.png"></a></td>

<td><? echo $rows['character']; ?>&nbsp;</td>
<td><? echo $rows['artist']; ?>&nbsp;</td>
</tr>

<?php
}
?>
</tbody>
</table>
</div></div>
</td>
</tr>
</table>

<?php
mysqli_close($dbcon);
?>
Member Avatar for diafol

You're still not checking the query for errors.
BTW - stop using <font> if using HTML5. It was deprecated in HTML 4.01, so dog knows which flavour of HTML you're using!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.