Hi this script is part of a sport section, a sports report gets submitted with some images, the report goes in 1 table and the images go in another along with the ID of the report so we can link them.
The problem im having is that it isnt incrementing through the images properly when it displays them, basically it displays the first added image over and over rather than any other images which were submitted alongside it.
<?php
function display_subject_content($subject)
{
db_connect();
$query = "select * from table where subject='$subject' order by cid desc limit 1";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
if (!$num_results)
{
echo ' Content to be added ';
nl2br(wordwrap($text1, 100, "\n", 1));
exit;
}
elseif ($num_results)
{
$row = mysql_fetch_Array($result);
$text = ucfirst(stripslashes($row['content']));
echo nl2br(wordwrap($text, 100, "\n", 1));
?>
</p>
<hr> <p class="SmallText"><font color="0A069E" size="4" face="Arial, Helvetica, sans-serif">Images</font></p></td>
<td width="5"> </td>
</tr>
<tr>
<td height="1">
<?php
$report=$row['cid'];
$query1 = "SELECT * FROM table WHERE cid=$report";
$result1 = mysql_query($query1);
$data = mysql_fetch_array($result1);
$num_results1 = mysql_num_rows($result1);
if($num_results1 < 1)
{
echo 'N/A';
exit;
}
for ($i=0; $i < $num_results1; $i++)
{
echo $data['url'];
?>
<img src='<?php echo $data['url']; ?>'></img>
<?php
}
}
}
If anyone can spot any reason why it doesnt increment through the i'd really appreciate it.
David