Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
need help with this simple registration script please
Old 10-12-2009, 10:07 AM need help with this simple registration script please
Webmaster Talker

Posts: 611
Trades: 0
hi, i need some advice on this simple table updating registration script, it wont update the table with the new data. any help GREATLY appreciated. i tried to make it as simple as i could and i still cant find the error. thanks. derek

here is the code.

Code:
<?php
include("connections.php");

 
$full_name = $_POST['full_name'];
$username = $_POST['username'];
$password = $_POST['password'];
$maiden    = $_POST['maiden'];
$color = $_POST['color'];
 

 

     if($full_name && $username && $password && $maiden && $color){

         mysql_query("INSERT INTO registration_table (full_name,username,password,maiden,color)VALUES('$full_name','$username','$password','$maiden','$color')");

      } 

 
/// query db and loop through rows example
//selects everything from table and assigns to the variable $query

$query     = mysql_query("SELECT * FROM registration_table");

    $table = "<table width=\"40%\" border=\"1\">
                  <tr>
                        <td>Here is your new registration information</td>
                         
                  </tr>";

while($row = mysql_fetch_array($query)){ ////row now stands for the array fetched.

    $table .= "    <tr>
                    <td>".$row['full_name']."</td>
                    <td>".$row['username']."</td>
                    <td>".$row['password']."</td>
                    <td>".$row['maiden']."</td>
                    <td>".$row['color']."</td>
                    
                </tr>";

}

$table .= "</table>";





?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
Please register to our forum below
<form id="form1" name="form1" method="post" action="registration.php">

  <table width="31%" border="0">
    
    <tr>
      <td>Full Name:</td>
      <td><input name="full_name" type="text" id="full_name" /></td>
    </tr>
    <tr>
      <td>User Name:</td>
      <td><input name="username" type="text" id="username" /></td>
    </tr>
    <tr>
      <td>Password:</td>
      <td><input name="password" type="text" id="password" /></td>
    </tr>
    <tr>
      <td>Mother's maiden name</td>
      <td><input name="maiden" type="text" id="maiden" /></td>
    </tr>
    <tr>
      <td>Your favorite color</td>
      <td><input name="color" type="text" id="color" /></td>
    </tr>
    
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="Submit" /></td>
    </tr>
  </table>
</form>
</body>
</html>

Last edited by silverglade; 10-12-2009 at 10:26 AM..
silverglade is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-12-2009, 10:27 AM Re: need help with this simple registration script please
Webmaster Talker

Posts: 611
Trades: 0
actually i edited the code so it updates the table, i also forgot to echo my table. now it echos it but it displays everyone's registration information the way its set up now. LOL. oh well. thank you. derek

Last edited by silverglade; 10-12-2009 at 10:33 AM..
silverglade is offline
Reply With Quote
View Public Profile
 
Old 10-12-2009, 03:25 PM Re: need help with this simple registration script please
Novice Talker

Posts: 8
Name: Tom yates
Trades: 0
The best thing to do in this situation would be to put an echo mysql_error(); after your query and it will return a more friendly MYSQL error. Hope this helps
__________________
High Quality
Please login or register to view this content. Registration is FREE
for every model available
webdevuk is offline
Reply With Quote
View Public Profile
 
Old 10-13-2009, 09:02 AM Re: need help with this simple registration script please
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,615
Location: UK
Trades: 1
Also,
I find ( if you run linux ) if you tail the httpd error log this helps a lot


tail -f /var/log/httpd/error


This will output any errors in your script.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 10-13-2009, 02:00 PM Re: need help with this simple registration script please
Webmaster Talker

Posts: 611
Trades: 0
great thanks very much
silverglade is offline
Reply With Quote
View Public Profile
 
Old 10-13-2009, 02:58 PM Re: need help with this simple registration script please
infotech rules's Avatar
Super Talker

Posts: 129
Name: Sidney shieldon
Trades: 0
puting an echo mysql_error(); after the query will come up with more friendly MYSQL error.............
infotech rules is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to need help with this simple registration script please
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28432 seconds with 12 queries