--- Olunkwa Ikechukwu <[EMAIL PROTECTED]> wrote:

> Hello All,
> First thanks to you all that took time to help me
> out
> with the script earlier, i did some changes on the
> script , but the script doesnt put any data in the
> table.
>
> Any ideas,
> Here's the new script
> ================
>
> <?
>
> $username=$_POST ['username'];
> $email=$_POST ['email'];
> $password=$_POST ['password'];
> $first=$_POST ['first'];
> $family=$_POST ['family'];
> $gender=$_POST ['gender'];
> $birth=$_POST ['birth'];
> $address=$_POST ['address'];
> $city=$_POST ['city'];
> $state=$_POST ['state'];
> $country=$_POST ['country'];
> $phone=$_POST ['phone'];
>
> include ("db_connect.php");
>
>       //check if the username is taken
>             $check = "SELECT id from registration WHERE
> username
> = '".$POST ['username']."';";
>
>             $qry = mysql_query ($check) or die ("Could not
> match
> data because" .mysql_error() );
>
>             $num_rows = mysql_num_rows ($qry);
>
>             if ($num_rows !=0)
>       {
>             echo "Sorry, The Username $username is already
> taken.<br>";
>             echo "<a href="" Again</a>";
> exit;
>       }else{
>
>       //insert data
>
>             $query="INSERT INTO registration VALUES (',
> '$username','$email', '$password','$first',
> '$family','$gender', '$birth', '$address', '$city',
> '$state', '$country','$phone')";
>
>             mysql_query($query);
>             }
>             mysql_close();
>             echo "We will contact you with Your Registration
> Information and Login Page";
> ?>
>
>
>
>
>
>
>
>
>
>  I am a Sun, impatiently waiting for dawn.
>

In addition to James' suggestions, you should always
run your variables through the
mysql_real_escape_string() function to ensure that any
quotes and other undesirable characters are escaped
properly. If there is a quote in any one of your
fields, it will cause a DB error or insert the wrong
data into your DB.

-Nick


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list




SPONSORED LINKS
Php mysql Job postings


YAHOO! GROUPS LINKS




Reply via email to