Thread: Error in Mysql
View Single Post
Old 09-28-2008, 08:40 AM   #2 (permalink)
martins256
The Wanderer
Good Samaritan 
 
martins256's Avatar
 
Join Date: Mar 2008
Posts: 18
Thanks: 0
martins256 is on a distinguished road
Default

What do you get when you echo $usrAdd; ?
I think that you haven't added ' ' in the SQL.

try this:

PHP Code:
$md5pass quote_smart(md5($_POST['password']));
$_POST['username'] = quote_smart($_POST['username']);
$_POST['email'] = quote_smart($_POST['email']);
$_POST['fullName'] = quote_smart($_POST['fullName']);


$usrAdd "INSERT INTO users(username, password, email, fullName)
            VALUES("
.$_POST['username'].", ".$md5pass.", ".$_POST['email'].", ".$_POST['fullName'].")"

function 
quote_smart($value)
{
    if( 
is_array($value) ) {
        return 
array_map("quote_smart"$value);
    } else {
        if( 
get_magic_quotes_gpc() ) {
            
$value stripslashes($value);
        }
        if( 
$value == '' ) {
            
$value 'NULL';
        } if( !
is_numeric($value) || $value[0] == '0' ) {
            
$value "'".mysql_real_escape_string($value)."'";
        }
        return 
$value;
    }




check out these:
to avoid sql injections

to avoid XSS
martins256 is offline  
Reply With Quote
The Following User Says Thank You to martins256 For This Useful Post:
zxt3st (09-28-2008)