logo
Published on Code2Design (http://code2design.com)

Multiple Rows of Information Being Added into Database

By Navigator
Created Mar 4 2008 - 12:02am

<?php
$uname 
$_POST['username'];
$pword $_POST['password'];
$cpass $_POST['confirmpass'];
$email $_POST['email'];
$probs $_POST['prob'];

if(
$probs != "10")
{
<
table width="100%" border="0" cellspacing="0" cellpadding="0">
      <
tr>
        <
td height="82" class="textseg"><div style='font-weight:bold; font-size:18px;'>Registration Error</div>
         <
br />
            <
br />
           
The answer to the problem was incorrectplease go back and try again!<br />
            <
br />
            <
div align="right"><<a href="javascript: history.back()" title="Go back!">BACK</a>>
        </
div></td>
      </
tr>
</
table>
}
elseif(
$probs == "10")
{
if(
$uname != "" && $pword != "" && $cpass != "" && $email != "")
{
    if(
$pword == $cpass)
    {
       
$register mysql_query("SELECT * FROM `users`");
        while(
$reg mysql_fetch_array($register ))
          {
              if(
"{$reg['username']}" == $uname)
              {
<
table width="100%" border="0" cellspacing="0" cellpadding="0">
      <
tr>
        <
td height="82" class="textseg"><div style='font-weight:bold; font-size:18px;'>Registration Error</div>
         <
br />
            <
br />
           
The username you have entered was already takenplease go back and try again!<br />
            <
br />
            <
div align="right"><<a href="javascript: history.back()" title="Go back!">BACK</a>>
        </
div></td>
      </
tr>
</
table>
              }
              else
              {
                  if(
"{$reg['password']}" == $pword)
                  {
<
table width="100%" border="0" cellspacing="0" cellpadding="0">
      <
tr>
        <
td height="82" class="textseg"><div style='font-weight:bold; font-size:18px;'>Registration Error</div>
         <
br />
            <
br />
           
The passwords you have entered are already takenplease go back and try again!<br />
            <
br />
            <
div align="right"><<a href="javascript: history.back()" title="Go back!">BACK</a>>
        </
div></td>
      </
tr>
</
table>
                  }
                  else
                  {
                      if(
"{$reg['eamil']}" == $email)
                      {
<
table width="100%" border="0" cellspacing="0" cellpadding="0">
      <
tr>
        <
td height="82" class="textseg"><div style='font-weight:bold; font-size:18px;'>Registration Error</div>
         <
br />
            <
br />
           
The email you have entered is already takenplease go back and try again!<br />
            <
br />
            <
div align="right"><<a href="javascript: history.back()" title="Go back!">BACK</a>>
        </
div></td>
      </
tr>
</
table>             
                      }
                      elseif(
"{$reg['username']}" != $uname && "{$reg['password']}" != $pword && "{$reg['email']}" != $email)
                      {
                     
$date date('Y-m-d H:i:s');
mysql_query("INSERT INTO `users` ( `username` , `password` , `email` , `group` , `logo` , `warnings` , `reg_date` )

VALUES ('$_POST[username]', '$_POST[password]', '$_POST[email]', 'Member', 'sources/style_images/green/logo.jpg', '0', '$date' )"
);

echo 
"<script>
window.location = '?page=login&CODE=001';
</script>"
;
                      }
                  }
              }
          }
    }
    elseif(
$pword != $cpass)
    {
        <
table width="100%" border="0" cellspacing="0" cellpadding="0">
      <
tr>
        <
td height="82" class="textseg"><div style='font-weight:bold; font-size:18px;'>Registration Error</div>
         <
br />
            <
br />
           
The passwords you entered didn't match, please go back and try again!<br />
            <br />
            <div align="right"><<a href="javascript: history.back()" title="Go back!">BACK</a>>
        </div></td>
      </tr>
</table>
    }
}
else
{
<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="82" class="textseg"><div style='
font-weight:boldfont-size:18px;'>Registration Error</div>
         <br />
            <br />
            The form was not accepted, please go back and try again!<br />
            <br />
            <div align="right"><<a href="javascript: history.back()" title="Go back!">BACK</a>>
        </div></td>
      </tr>
</table>
}
}
?>

(FYI: Where you see PLAIN HTML I had ending PHP tags, but I had to remove them to post.

I'm trying to make a site that it going perfectly accept for the registration part. It's adding more than one row on one registration, and the number that is added is only doubled hear's a more graphic explanation.

2 accounts already registered

On the next registration 2 more account are added with all of the same detailed information.

‹ PHP Mail Function [0] PHP + XML Socket Server › [0]

Source URL:
http://code2design.com/forums/multiple_rows_of_information_being_added_into_database