TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 09-28-2008, 08:18 AM   #1 (permalink)
The Addict
 
zxt3st's Avatar
 
Join Date: Apr 2008
Posts: 200
Thanks: 18
zxt3st is on a distinguished road
Default Error in Mysql

Here is the error

Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@yahoo.com, )' at line 2
Here is my code.

PHP Code:
<?php

include('includes/dbsettings.php');

$duplicates "SELECT username FROM users WHERE username='".trim($_POST['username'])."'";
$result mysql_query($duplicates$link)or die("Could not execute query");
if (
mysql_num_rows($result)>0)
{
    print (
"<script>\n alert('Username already exists!')\n history.back(); </script>");
    exit();
}
if ((
$_POST['username'] == "")||($_POST['password'] == "" && $_POST['password2'] == "")||($_POST['email'] == "")||($_POST['name'] == ""))
{
    print (
"<script>\n alert('All fields are required!')\n history.back(); </script>");
    exit();
}
if (
$_POST['password'] != $_POST['password2'])
{
    print (
"<script>\n alert('Password does not match!!')\n history.back(); </script>");
    exit();
}
if(!
eregi("^[a-zA-Z0-9]+[a-zA-Z0-9_.-]*@[a-zA-Z0-9]+[a-zA-Z0-9_.-])*\.[a-z]{2,4}$"$_POST['email']))
{
    print (
"<script>\n alert('Email is invalid!!!')\n history.back(); </script>");
    exit();
}
$md5pass md5($_POST['password']);
$usrAdd "INSERT INTO users(username, password, email, fullName)
            VALUES("
.$_POST['username'].", ".$md5pass.", ".$_POST['email'].", ".$_POST['fullName'].")";
if(
mysql_query($usrAdd$link))
{
    echo 
"User SUccessfully Added!";
}else{
    echo 
mysql_error();
}

?>
above is my code, its still plain and not the purpose is to just solely register an account.

I already do some research in google but i stil can't find my answers. THanks.
zxt3st is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:01 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design