Hello
i am trying to run a piece of code that will display 2 pieces of information from my mysql table. i would like to display within my html code content from fields called date and headline also the unique news_id number associated with that row.
My problem is that the news_id that is coming through on both is the exact same when they are unique in the database.
I am using the following code:
<?
//set up the array to call later
$shead=Array();
//open the connection
$conn = mysql_connect("***", "", "***");
//pick the database to use
mysql_select_db("topsecs", $conn);
//create the sql statement
$sql = "SELECT
FROM news";
//execute the sql statement
$result = mysql_query($sql, $conn)or die(mysql_error());
// Set a variable to display results on screen later
while( $row = mysql_fetch_array( $result ) )
{
$headline = $row["headline"];
$date = $row["date"];
$news_id = $row["news_id"];
array_push( $shead, $headline, $date, $news_id);
}
while ($row = mysql_fetch_array($result)) {
$shead[$headline[headline]] = $date[date];
}
?>
<TR>
<TD>
<? print $shead[1];?><BR>
<? print "<a href=\"docs/news.php?news_id=$news_id\">$shead[0]</a>";?>...
</div></TD>
</TR>
<TR>
<TD>
<? print $shead[4];?><BR>
<? print "<a href=\"docs/news.php?news_id=$news_id\">$shead[3]</a>";