hey guys i have a database and am trying to fetch some result ..and i can succesfully fetch the result with php..What i need is to run the result after 3 seconds ..So i used 'setTimeout()` in js but it didnt worked out..My code
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
@$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT age FROM honey';
mysql_select_db('test');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo '<script>
var c = 3000;
setTimeout(function() { '<?php echo $row['age'];'}, c);
</script>';
}
mysql_close($conn);
?>
The error i get is Parse error: syntax error, unexpected '?' in C:\wamp\wwwefresh\index.php on line 24
..
how can i properl use js inside this php code..Thanx for the help