|
Posted by Dean on 12/28/05 17:50
Amazing. Maybe more a PHP problem.
This little phscript works perfect with PHP 5.0 and Mysql 5.0 ...under
Windows with IE and Netscape 8.0. Exactly the
same script gives a syntax error on line: b=<?=$rec?> (little green arrow
pointing to <?) with PHP 5.0 and Mysql 5.0
and Netscape 7.2 under Linux (redhat 9.0).
The script code:
<html><body>
<?php
$link = mysql_connect("localhost", "root", "pw")
or die("Impossible de se connecter : " . mysql_error());
$dbsel = mysql_select_db('mydb', $link);
$sql = "SELECT logon, number FROM mytable";
$result = mysql_query($sql);
$rec=mysql_num_rows($result);
echo $rec; // = 12
?>
<script type="text/javascript">
b = <?=$rec?>; // error line
alert(b);
</script>
</body></html>
(Variable $rec = 12 )
I really don't know what's wrong with this code ...
Do you?
Thanks
Dean
Navigation:
[Reply to this message]
|