Hi
I am trying to query the username of a particular user who has posted at a particular time.
for ($i = 1; $i <= 10; $i++) {
$result = mysql_query("SELECT poster_id FROM posts WHERE post_time = 10:45-example");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$poster_id = mysql_fetch_row($result);
[B]$user_id = "$poster_id[0]";[/B]
$result = mysql_query("SELECT username FROM users WHERE id = $user_id");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$user = mysql_fetch_row($result);//username
echo "<tr><td>$user[0]</td></tr>";
}
The line which seems to be wrong is:
$user_id = "$poster_id[0]";
As I expect it "$user_id" should be an integer to use to compare this:
$result = mysql_query("SELECT username FROM users WHERE id [B]= $user_id[/B]");
I would be grateful if somebody would give me advice about that, since this code does not work.
viti