Skip to main content
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer bregent

Query was empty


OK, please post the entire page code. You're probably just missing curly braces or a line terminator.

11 replies

Inspiring
April 6, 2012

sorry posted by mistake..

ok i added two if statements to check if a password is correct

if($POST['password'] == $_POST['password2'])

          if($_POST['email'] == $_POST['email2'])

and when i add the above it return a query is empty.

the full code is below

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form4"))

{

          if($POST['password'] == $_POST['password2'])

          if($_POST['email'] == $_POST['email2'])

 

  $insertSQL = sprintf("INSERT INTO think_signup (FirstName, Surname, password, email, ContactMethod, TeleNumber, SalaryReq, PositionReq, skills_offered, cv, location) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

                       GetSQLValueString($_POST['FirstName'], "text"),

                       GetSQLValueString($_POST['Surname'], "text"),

                       GetSQLValueString($_POST['password'], "text"),

                       GetSQLValueString($_POST['email'], "text"),

                       GetSQLValueString($_POST['ContactMethod'], "text"),

                       GetSQLValueString($_POST['TeleNumber'], "text"),

                       GetSQLValueString($_POST['SalaryReq'], "text"),

                       GetSQLValueString($_POST['PositionReq'], "text"),

                       GetSQLValueString($_POST['skills_offered'], "text"),

                       GetSQLValueString($_POST['cv'], "text"),

                       GetSQLValueString($_POST['location'], "text"));

and the inputs are here

              <td nowrap="nowrap" align="right">Password:</td>

              <td><input type="text" name="password" value="" size="30" /></td>

            </tr>

            <tr valign="baseline">

              <td nowrap="nowrap" align="right">Confirm Password</td>

              <td><input type="text" name="password2" value="" size="30" /></td>

            </tr>

            <tr valign="baseline">

              <td nowrap="nowrap" align="right">Email:</td>

              <td><input type="text" name="email" value="" size="30" /></td>

            </tr>

            <tr valign="baseline">

              <td nowrap="nowrap" align="right">Confirm Email</td>

              <td><input type="text" name="email2" value="" size="30" /></td>

Participating Frequently
April 6, 2012

Typo in your POST variable.

Inspiring
April 6, 2012

tried this


if($POST['password'] == $_POST['password2'] && $POST['email'] == $_POST['email2'])

but returned the same query is empty