0

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....

3
Contributors
5
Replies
34
Views
1 Year
Discussion Span
Last Post by diafol
0

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";

Edited by urtrivedi

0

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.

0

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);
?>
0

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!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.