Forum Moderators: coopster

Message Too Old, No Replies

PHP Parse error: parse error, unexpected T_VARIABLE

please help me find the stupid error

         

mcvoid

5:07 am on Feb 16, 2006 (gmt 0)

10+ Year Member



Hello all,
I'm writing a fairly simple php script and I keep getting the message "PHP Parse error: parse error, unexpected T_VARIABLE".
I know that means I made a simple mistake somewhere, but syntax highlighting and checking have revealed nothing and I certainly not catch it with my own eye. I reformatted the whitespace to spaces and newlines only, so it has to be something that shows up on the screen.
here's the PHP portion in its entirety:

<%php
$socket = @mysql_connect("mysql","database","****");
if (mysql_select_db ("comments")) {
$sql = "SELECT * FROM register";
$query = mysql_query($sql, $socket);
while($data = mysql_fetch_object($query)) {
echo "<TR><TD> $data->name \n $data->email \n $data->aim \n $data->known</TD></TR>";
}
}
%>

There is no other scripting on the page. The error is on the line with "$socket = @mysql_connect...". Could I have the ASP-style tags wrong?
Anyway, any help I can get would be appreciated.

DrDoc

5:47 am on Feb 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

Could I have the ASP-style tags wrong?

You are absolutely right. Either change it to:

<?php
...
?>

or just:

<%
...
%>

;)

mcvoid

11:48 am on Feb 16, 2006 (gmt 0)

10+ Year Member



It works! thank you very much.

now my site can really shine. ;)

[edited by: jatar_k at 3:12 pm (utc) on Feb. 16, 2006]
[edit reason] no urls thanks [/edit]