FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Error i can't figure out, php





Central
I can't seem to figure this sintax error out. Could someone help?
Code:


<?php
// Connects to your Database
mysql_connect("localhost", "xxxxxx", "xxxx") or die(mysql_error());
mysql_select_db("xxxxxxx") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
die('You did not complete all of the required fields');
}

// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}

// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match. ');
}

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

// now we insert it into the database $insert = "INSERT INTO users (username, password)
[color=yellow]VALUES ('".$_POST['username']."', '".$_POST['pass']."')";[/color]
$add_member = mysql_query($insert);
?>


it says its on the line in yellow, if anyone has some advise.
Central
sorry the color didn't come out right its the line,
Code:
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
hexkid
Central wrote:
Code:
// now we insert it into the database $insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";


Code:
// now we insert it into the database

$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
Mosquito.Tyler
hexkid wrote:
Central wrote:
Code:
// now we insert it into the database $insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";


Code:
// now we insert it into the database

$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";


Yeah, you need to add the line break, your $insert variable assignment is commented out. Just in case you had as much trouble as me comparing hexkid's quotes Razz

I'm retarded....
mathiaus
-close-
Related topics
Parse Error in PHP I can't figure out.
Error with PHP-Nuke 7.8
Error on php-nuke install, need assistance.
MySQL/PHP Error..
error in PHP.ini
Getting Fatal Error in php mysqli
Who is PHP and MySQL local server program best
mysql_connect give error ?? why ??
Php Warning: fopen
PHP, lo más básico
help me resolve this weird error in php
I cant install php chat tables nor set up diffrent subdomain
insert data to mySQL database problem
Tables created in the database but problem in access
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.