nothing being echoed

see code below, nothing is being echoed. as soon as i change username = “$username” to username = “p0stpwned” something is being returned.

how can i fix this?

[php]<?php
$username = $_POST[‘user’];
mysql_connect(‘localhost’, ‘root’, ‘’);
mysql_select_db(‘msgs’);
$sql = mysql_query(‘SELECT * from users WHERE username = “$username”’);
while($row = mysql_fetch_assoc($sql)){
$data=$row[‘followers’];
$splittedstring=explode(",",$data);
foreach ($splittedstring as $key => $value) {
$msgs = mysql_query(‘SELECT * from msgs WHERE username = “$value”’);
while($msg = mysql_fetch_assoc($msgs)){
echo $msg[‘message’] . "
by " . $msg[‘username’];
}
}
}
?>
[/php]

cheers :slight_smile:

Hi there,

Has the form that’s being posted definitely got an element with a name of ‘user’ (is $username definitely set). Also try changing it to:

WHERE username = \''.$username.'\'');
Sponsor our Newsletter | Privacy Policy | Terms of Service