ACwarrior Posted October 30, 2008 Share Posted October 30, 2008 This is a registration page. When i register and submit my detail in this progamme, i got this error msg... 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 ' ' at line 8 My PHP programme: $SUSPENDED = 8; $sql = "INSERT INTO PHPAUCTION_users (id, nick, password, name, country, nletter,email, reg_date, rate_sum, rate_num, birthdate,suspended) VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \"" . md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \"" . Addslashes ($TPL_name_hidden) . "\", \"" . AddSlashes ($TPL_country) . "\", \"" . AddSlashes ($TPL_nletter) . "\", \"" . AddSlashes ($TPL_email_hidden) . "\", ANY ADVISE??????????? Quote Link to comment https://forums.phpfreaks.com/topic/130774-need-help-pls/ Share on other sites More sharing options...
revraz Posted October 30, 2008 Share Posted October 30, 2008 Where is the rest of it, where you enter $SUSPENDED? You have 12 fields but only 6 values. This is a registration page. When i register and submit my detail in this progamme, i got this error msg... 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 ' ' at line 8 My PHP programme: $SUSPENDED = 8; $sql = "INSERT INTO PHPAUCTION_users (id, nick, password, name, country, nletter,email, reg_date, rate_sum, rate_num, birthdate,suspended) VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \"" . md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \"" . Addslashes ($TPL_name_hidden) . "\", \"" . AddSlashes ($TPL_country) . "\", \"" . AddSlashes ($TPL_nletter) . "\", \"" . AddSlashes ($TPL_email_hidden) . "\", ANY ADVISE??????????? Quote Link to comment https://forums.phpfreaks.com/topic/130774-need-help-pls/#findComment-678722 Share on other sites More sharing options...
ACwarrior Posted October 30, 2008 Author Share Posted October 30, 2008 I have deleted a few fields In the registration page, there are these fields to be entered 1.Your name 2.Username 3.Password 4.Please, repeat your password 5.Your e-mail address 6.Country: 7.Would you like to receive our Newsletter: Yes or No Quote Link to comment https://forums.phpfreaks.com/topic/130774-need-help-pls/#findComment-678732 Share on other sites More sharing options...
fenway Posted October 30, 2008 Share Posted October 30, 2008 Please echo $sql. Quote Link to comment https://forums.phpfreaks.com/topic/130774-need-help-pls/#findComment-678765 Share on other sites More sharing options...
revraz Posted October 31, 2008 Share Posted October 31, 2008 Well your error is on "8", so where is this 8 coming from? Also, there needs to be more to your query, it can't just end like that. Quote Link to comment https://forums.phpfreaks.com/topic/130774-need-help-pls/#findComment-678985 Share on other sites More sharing options...
ACwarrior Posted November 2, 2008 Author Share Posted November 2, 2008 As below..the whole of my program.. thanks */ include "./includes/config.inc.php"; include "./includes/countries.inc.php"; include "./includes/checkage.inc.php"; $TIME = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y")); $NOW = date("YmdHis",$TIME); $NOWB = date("Ymd",$TIME); // -- if (!isset($_POST['auction_id']) && !isset($_GET['auction_id'])) { $auction_id = $_SESSION["CURRENT_ITEM"]; } else { $_SESSION["CURRENT_ITEM"]=$auction_id; } if (empty($_POST['action'])) { $action = "first"; } if ($_POST['action'] == "first") { if (empty($TPL_name)) { $TPL_err = 1; $TPL_errmsg = $ERR_5029; } elseif (empty($TPL_nick)) { $TPL_err = 1; $TPL_errmsg = $ERR_5030; } elseif (empty($TPL_password)) { $TPL_err = 1; $TPL_errmsg = $ERR_5031; } elseif (empty($TPL_repeat_password)) { $TPL_err = 1; $TPL_errmsg = $ERR_5032; } elseif (empty($TPL_email)) { $TPL_err = 1; $TPL_errmsg = $ERR_5033; } elseif (empty($TPL_country)) { $TPL_err = 1; $TPL_errmsg = $ERR_5037; if (strlen($TPL_nick) < 6) { $TPL_err = 1; $TPL_errmsg = $ERR_107; } else if (strlen ($TPL_password) < 6) { $TPL_err = 1; $TPL_errmsg = $ERR_108; } else if ($TPL_password != $TPL_repeat_password) { $TPL_err = 1; $TPL_errmsg = $ERR_109; } else if (strlen($TPL_email) < 5) { // Primitive mail check $TPL_err = 1; $TPL_errmsg = $ERR_110; } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$", $TPL_email)) { $TPL_err = 1; $TPL_errmsg = $ERR_008; } else { $sql = "SELECT nick FROM PHPAUCTION_users WHERE nick=\"" . AddSlashes ($TPL_nick) . "\""; $res = mysql_query ($sql); if (mysql_num_rows($res) == 0) { $id = md5(uniqid(rand())); $id = eregi_replace("[a-f]", "", $id); $TPL_id_hidden = $id; $TPL_nick_hidden = $TPL_nick; $TPL_password_hidden = $TPL_password; $TPL_name_hidden = $TPL_name; $TPL_email_hidden = $TPL_email; } else { $TPL_err = 1; $TPL_errmsg = $ERR_111; // Selected user already exists } $sql = "SELECT email FROM PHPAUCTION_users WHERE email=\"" . AddSlashes ($TPL_email) . "\""; $res = mysql_query ($sql); if (mysql_num_rows($res) == 0) { $id = md5(uniqid(rand())); // $id = eregi_replace("[a-f]","",$id); $TPL_id_hidden = $id; $TPL_nick_hidden = $TPL_nick; $TPL_password_hidden = $TPL_password; $TPL_name_hidden = $TPL_name; $TPL_email_hidden = $TPL_email; } else { $TPL_err = 1; $TPL_errmsg = $ERR_115; // E-mail already used } if ($TPL_err == 0) { $TODAY = $NOWB; # // ################################################################# # // Users suspended field # // VALUES: # // 8 - no fee due, waiting for user's confirmation # // [b]$SUSPENDED = 8;[/b] $sql = "INSERT INTO PHPAUCTION_users (id, nick, password, name, country, nletter,email, reg_date, rate_sum, rate_num,suspended) VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \"" . md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \"" . Addslashes ($TPL_name_hidden) . "\", \"" . AddSlashes ($TPL_country) . "\", \"" . AddSlashes ($TPL_nletter) . "\", \"" . AddSlashes ($TPL_email_hidden) . "\", '$TODAY', 0, 0, '$DATE', '$SUSPENDED')"; $res = mysql_query ($sql); if ($res == 0) { $TPL_err = 1; $TPL_errmsg = mysql_error (); //"Error updating users data"; } else { $TPL_id_hidden=mysql_insert_id(); # // =========================================================== # // Added by Gian for IP banning # // Store user IP address in the database # // =========================================================== $query = "INSERT INTO PHPAUCTION_usersips VALUES( NULL, '$TPL_id_hidden', '$REMOTE_ADDR', 'first','accept')"; $res___ = @mysql_query($query); if (!$res___) { MySQLError($query); exit; } # // =========================================================== /** * Update column users in table PHPAUCTION_counters */ $query = "UPDATE PHPAUCTION_counters SET inactiveusers=inactiveusers+1"; $counteruser = mysql_query($query); if (!$counteruser) { MySQLError($query); exit; } # // Send confirmation e-mail message depending on # // the signup confirmation settings include "includes/user_confirmation.inc.php"; } } // if($TPL_err == 0) } } } include "header.php"; if (($action == "first" && count($_POST) == 0) || ($_POST['action'] == "first" && $TPL_err)) { $country = ""; foreach ($countries as $key=>$name) { $country .= "<option value=\"$name\""; if ($name == $TPL_country) { $country .= " selected"; } elseif ($SETTINGS['defaultcountry'] == $name && !isset($TPL_err)) { $country .= " selected"; } $country .= ">$name</option>\n"; } include "templates/template_register_php.html"; } if ($_POST['action'] == "first" && !$TPL_err) { # // include "templates/template_registered_php.html"; } include "footer.php"; $TPL_err = 0; $TPL_errmsg = ""; ?> Quote Link to comment https://forums.phpfreaks.com/topic/130774-need-help-pls/#findComment-680700 Share on other sites More sharing options...
fenway Posted November 3, 2008 Share Posted November 3, 2008 Not helpful whatsoever... and use code tags next time... except don't post the whole code anyway. Quote Link to comment https://forums.phpfreaks.com/topic/130774-need-help-pls/#findComment-681457 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.