Hi,
I am working on a script that populates a table with a user's news entries. First I get the username from the URL, then go to the database and get the user_id. From the user_id, I query the news table for the user's news entries.
$idgrabber = "select id from $db_table where urlname = '".$_GET['username']."';";
$result = mysql_query($idgrabber) or die(mysql_error());
if ($result) {
echo "got a result";
$newsresults = "select * from $newstable where user_id = '$result'";
$result2 = $mysqli->query($newsresults) or die(mysqli_error($mysqli));
echo "<form method='post' action='delete.php'>";
echo "<table cellspacing='0' cellpadding='15'>
<th width='15%'>NEWS</th>
<th width='55%'>SOMETHING ELSE</th>
<th width='15%'>SOMETHING ELSE</th>
<th width='15%'>SOMETHING ELSE</th>
";
while ($row = $result2->fetch_object()) {
}
Echo "got a result" works but then I don't get any news articles in the table unless I insert an actual user_id value in the line "$newsresults = ...".
I think this might be down to a basic misunderstanding of objects and variables. Can anyone put me straight please?