hello i am having some trouble trying to pass a variable via a url string query from one function and taking that variable to another function. here is the first function it serves to show previous news posts:
//======================================================\\
// PREVIOUS POST COLUMN
// THIS COLUMN SHOWS PREVIOUS NEWS ENTRIES AND WILL ALLOW
// THE USER CLICK ON THE LINK TO EDIT THAT NEWS ITEM OR
// ALLOW THE USER TO DELETE THE ENTRY FROM THE DATABASE
//======================================================\\
function previousNewsItems() {
global $newsTable;
echo "<div class=\"adminMenu3\">";
$sql = "SELECT * FROM $newsTable";
$linkID = db_connect('guernica');
$result = mysql_query($sql, $linkID) OR ("CAN'T COMPLETE QUERY BECAUSE".mysql_error());
echo "<div class=\"td2\">PREVIOUS NEWS ITEMS</div><br />";
while($rows = mysql_fetch_array($result)) {
$newsID = $rows['id'];
echo "<div class=\"tr1\">• $newsID <a href=\"$_SEVER[PHP_SELF]?cmd=viewOldNews&newsID=$newsID\">$rows[newsTitle]</a></div>";
}
echo "</div>";
}
the main code to look at in that function is this:
echo "<div class=\"tr1\">• $newsID <a href=\"$_SEVER[PHP_SELF]?cmd=viewOldNews&newsID=$newsID\">$rows[newsTitle]</a></div>";
i am trying to pass the $newsID variable into the next function below, but will not pass through the next function. i tried to echo the variable and there was not output.
here is the second function that requires the $newsID variable:
//======================================================\\
// THIS FUNCTION WILL VIEW THE OLD NEWS ITEM THAT WAS
// SELECTED FROM THE PREVIOUS NEWS ITEM COLUMN
// YOU CAN EITHER EDIT THE NEWS OR DELETE THE NEWS ITEM
//======================================================\\
function viewOldNews($newsID) {
global $newsTable, $newsID;
$sql = "SELECT * FROM $newsTable";
$linkID = db_connect('guernica');
$result = mysql_query($sql, $linkID) OR ("CANT COMPLETE QUERY BECAUSE".mysql_error());
echo "<div class=\"adminMenu2\">";
echo "test";
echo "$newsID";
echo "$_SERVER[newsID]";
while($rows = mysql_fetch_array($result)) {
echo "<div>$rows[newsTitle]</div>";
}
echo "</div>";
}
thank you for your help!