For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > June 2007 > newbie









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author newbie
Reggie

2007-06-29, 7:59 am

Parse error: syntax error, unexpected '=' in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/create_entry.php on line 8


Hi i seem to be getting this error message please help.

This is the code am useing:

<?php

mysql_connect("localhost", "root") or
die ("Could not connect to database");
mysql_select_db("user") or
dir ("Could not select database");

if ($submit = = "Register")
{
$query = "insert into user
(username, password) values ('$username', '$password')";
mysql_query($query) or
die (mysql_error());
?>
<h3>You are now registered</h3>
<a href="index.html">Go back to main page</a>
<?php
}
else
{
include("not.html");
}
?>

none

2007-06-29, 7:59 am

Reggie wrote:
> Parse error: syntax error, unexpected '=' in /home/fhlinux169/c/
> clashoff.co.uk/user/htdocs/create_entry.php on line 8
>
>
> Hi i seem to be getting this error message please help.
>
> This is the code am useing:
>
> <?php
> if ($submit = = "Register")


try ==
and don use globals (google)
Reggie

2007-06-29, 7:00 pm

On 29 Jun, 12:54, none <""arjen\"@(none)"> wrote:
> Reggie wrote:
>
>
>
>
> try ==
> and don use globals (google)


hi do you mean i should switch off my global?

none

2007-06-29, 7:00 pm

Reggie wrote:
> On 29 Jun, 12:54, none <""arjen\"@(none)"> wrote:
>
> hi do you mean i should switch off my global?
>

Yup, there are some diavantages. Fiorst of all it's a huge secuirity
risk (yourpage.com/index.php?user=admin). Second it will not work on all
servers so you have to rewrite your code if you move. Third it's harder
to read for example $_POST['id'] will tell me more then $id

Arjen
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com