PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
runrunforest
Forum Newbie
Posts: 6 Joined: Thu Sep 18, 2008 10:33 pm
Post
by runrunforest » Mon Sep 22, 2008 12:54 am
This is the error message:
Parse error: syntax error, unexpected '`' in C:\wamp\www\register\Untitled-7.php on line 13
What can i do to make this work?
This is my code:
Code: Select all
<?php
$congig['adress']='localhost';
$congig['username']='craig';
$config['password']='porschegt3';
$config['databsename']='regtut';
mysql_connect($config['address'],$config['username'],$congifg['password']);
mysql_select_db($config['databsename']);
if ($_POST['submit']) {
$_POST['username'] = trim($_POST['username']);
if($_POST['username'] && strlen($_POST['username']) >= 3){
$query = mysql_query(”SELECT `id` FROM `users` WHERE `username`=”.$_POST['username'].”‘ LIMIT 1?);
if(mysql_num_rows($query)){
$error['userexists'] = ‘Username exists’;
}
} else {
$error['usernameinput'] = ‘Please enter a username of 3+ characters’;
}
}
?>
<form name=”reg” method=”post” enctype=”application/x-www-form-urlencoded”>
username: <input type=”text” name=”username” /><br />
email: <input type=”text” name=”email” /><br />
password1: <input type=”password” name=”password1? /><br/>
password2: <input type=”password” name=”password2? /><br/>
<input type=”submit” name=”submit” value=”register” />
</form>
wolfwood16
Forum Commoner
Posts: 43 Joined: Wed Aug 27, 2008 8:52 am
Contact:
Post
by wolfwood16 » Mon Sep 22, 2008 1:00 am
Code: Select all
$query = mysql_query(”SELECT `id` FROM `users` WHERE `username`=”.$_POST['username'].”‘ LIMIT 1?);
change it with this one.
Code: Select all
$query = mysql_query("SELECT id FROM users WHERE username = ".$_POST['username']." LIMIT 1");
runrunforest
Forum Newbie
Posts: 6 Joined: Thu Sep 18, 2008 10:33 pm
Post
by runrunforest » Mon Sep 22, 2008 1:24 am
followed that then this appears
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\register\Untitled-7.php on line 15
wolfwood16
Forum Commoner
Posts: 43 Joined: Wed Aug 27, 2008 8:52 am
Contact:
Post
by wolfwood16 » Mon Sep 22, 2008 1:39 am
use only single qoute ' or double qoute " using echo.
change it to...
Code: Select all
if(mysql_num_rows($query)){
$error['userexists'] = "Username exists";
}
the same it other statements..
runrunforest
Forum Newbie
Posts: 6 Joined: Thu Sep 18, 2008 10:33 pm
Post
by runrunforest » Mon Sep 22, 2008 2:51 am
then this error
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\register\Untitled-7.php on line 18
wolfwood16
Forum Commoner
Posts: 43 Joined: Wed Aug 27, 2008 8:52 am
Contact:
Post
by wolfwood16 » Mon Sep 22, 2008 2:56 am
runrunforest wrote: then this error
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\register\Untitled-7.php on line 18
read my previous reply