PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 3rd, 2012, 06:52 AM
WESTSIDE200 WESTSIDE200 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 17 WESTSIDE200 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 35 m 29 sec
Reputation Power: 0
Ii have a problem with this registration script can some please help

session_start

`<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
if(isset($_POST["Email"]) && isset($_POST["Password"])){
$name=$_POST['First_name'];
try {$pdo_options[PDO::ATTR_ERRMODE]=PDO::ERRMODE_EXCEPTION ;
$Dbc= new PDO('mysql:host=localhost;dbname=abakwa','admin','anthony',$pdo_options);
//$register=$Dbc-> exec("INSERT INTO user(first_name,last_name,email,Date_of_birth ,password)VALUES(" .$_POST['First_name'],$_POS
//T['Last_name'],$_POST['Email'],$_POST['Date_of_birth'],$_POST['Password']);
$Register_user=$Dbc->prepare("INSERT INTO user(First_name,last_name,Email,Date_of_birth ,password)VALUES(:First_name,:last_name,:Email,ate_of_birh,assword)");
$Register_user->execute(array(
'First_name' => $name,
'Last_name'=>$_POST['Last_name'],
'Email'=> $_POST['Email'],
'Date_of_birth'=>$_POST['Date_of_birth'],
'password' => $_POST['Date_of_birth']) );
// echo "Your Detials have been added to the data base";
//get user_name which has that acc
}
catch(Exception $e)
{die ('ERROR: '.$e->getMessage());
}
}
?>
<form method="post" action="register.php ">
First Name:
<input type="text" name="First_name" /><br />

Last Name:
<input type="text" name="Last_name" />
<br />
Email:
<input type="text" name="Email" />
<br />
<input type="text" name="Date_of_birth" />

Password:
<input type="Password " name="Password" /><br />
<br />

<input type="submit" value="login" />
</form>
</body>
</html>


ERROR: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined

Reply With Quote
  #2  
Old December 3rd, 2012, 07:11 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,867 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 5 Days 9 h 6 m 6 sec
Reputation Power: 581
1) Please edit your post and enclose your code in [ PHP ] tags. See the sticky at the top of the forum and ManiacDan's New User Guide. Also use proper indentation on your code.
2) Your insert is messed up. The VALUES are all strings not enclosed in quotes.
Comments on this post
simplypixie agrees!
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old December 5th, 2012, 08:22 AM
WESTSIDE200 WESTSIDE200 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 17 WESTSIDE200 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 35 m 29 sec
Reputation Power: 0
plz could u be more explicit i do not understand

Reply With Quote
  #4  
Old December 5th, 2012, 08:33 AM
Jacques1's Avatar
Jacques1 Jacques1 is online now
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,834 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 2 h 10 m 17 sec
Reputation Power: 811
Hi,

the parameter names don't match: In the prepared statement, you use "last_name" with a lowercase "l", but in the parameters you use "Last_name" with an uppercase "L".

Which is why mixed case is a bad idea in the beginning -- even though people really seem to love it. Names are supposed to be unambiguous, not pretty.

Reply With Quote
  #5  
Old December 5th, 2012, 08:33 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,867 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 5 Days 9 h 6 m 6 sec
Reputation Power: 581
PHP Code:
 $Register_user=$Dbc->prepare("INSERT INTO user(First_name,last_name,Email,Date_of_birth ,password)VALUES('First_name','last_name','Email','Date_of_birth','Password')"); 
Comments on this post
Jacques1 disagrees: No, his syntax is correct. He's using prepared statements in PDO. He certainly doesn't want to
insert the literal strings 'First_name', 'last_name' etc.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Ii have a problem with this registration script can some please help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap