-
I have put
PHP Code:
$result = mysql_query($query)
or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
There is no error shown. so, this works Problem is:
1.it gives me just first row
2.only first column has correct link like:
http://mywebsite/article.php?id=1
It should have all columns above link
I have put echo count($rec)."<br>"; and number is 14
-
In this case, I would ask you to give the URI to the page in question.
-
Dear Twey,
I have now tested and tested. I have code and it shows me all rows and columns.
First column (ID for article) shows correct link like: http://www.mywebsite/article.php?ID=1 (for first row) and ID=2 for second row)
Do you have any suggestions how to do that also other columns will have this link?:)
Code is the following for while:
PHP Code:
while (list($key, $value) = each($row))
{
$i++;
if(!($i%2))
echo "<td><b><a href='?order=$key'>$key</a></td>";
}
echo "</tr>";
$result=mysql_query($sqlQuery);
// Make rows for records
while($rec=mysql_fetch_array($result))
{
echo "<tr>";
for($i=0;$i<count($rec);$i++)
{
if($rec[$i])/*continue;*/
$query = "SELECT ID FROM news where ID = '$rec[$i]' ";
$s = mysql_query($query);
//echo(mysql_error($s));
$result2 = mysql_fetch_assoc($s);
$ID=$result2['ID'];
echo '<td><a href="article.php?id='.$ID.'"><B>'.$rec[$i].'</B></A></td>';
}
echo "</tr>";
}
echo "</table>";
}