Where am I doing wrong - DB
Where am I doing wrong - DB
am 28.11.2006 07:42:33 von Chris Carter
Just a small database code. Want to make entries in the mySQL table using
PHP. Not being able to. When I run this code it takes me to the next blank
brower window as if the entry has been made but after checking the database
I do not find anything. There is not even an error message, I have tried two
approaches this code is mixed. Please advice.
// database information
Here was the database information removed for security.
if($submit)
{
// connect and select the database
$conn = mysql_connect($host, $user, $password) or die(mysql_error());
$db = mysql_select_db($dbName, $conn) or die(mysql_error());
// insert new entry in the database if entry submitted
if($query_rows != 0)
{
$error = "THERE SOME ERROR TO BE SHOWN TO THE USER IF THE EMAIL ADDRESS
EXISTS IN THE DATABASE";
}
else{
/* $fName = $_POST['fName'];
$lName = $_POSR['lName'];
$email = $_POST['email'];
$confEmail = $_POST['confEmail'];
$password = $_POST['password'];
$confirmPassword = $_POST['confirmPassword'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$postCode = $_POST['postCode'];
$gender = $_POST['gender'];
$profession = $_POST['profession'];
$ageGroup = $_POST['ageGroup'];
$mallPref = $_POST['mallPref'];
$mallConsent = $_POST['mallConsent'];*/
// insert new entry into database
$sql = "insert data `userdata` (`fName`, `lName`, `email`, `confEmail`,
`password`, `confirmPassword`, `address`, `city`, `state`, `postCode`,
`gender`, `profession`, `ageGroup`, `mallPref`, `mailConsent`) VALUES
('$fName', '$lName', '$email', '$confEmail', '$password',
'$confirmPassword', '$address', '$city', '$state', '$postCode', '$gender',
'$profession', '$ageGroup', '$mallPref', '$mailConsent');";
$sucess_message = "SHOW HERE SOME MESSAGE TO THE USER IF THE ADDITION IS
SUCESS";
} // end if new entry posted
}
Show some confirm or thank you HTML stuff.
?>
Thank you in advance.
Chris
--
View this message in context: http://www.nabble.com/Where-am-I-doing-wrong---DB-tf2716628. html#a7574187
Sent from the Php - Database mailing list archive at Nabble.com.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Where am I doing wrong - DB
am 28.11.2006 08:00:38 von Ankur Dave
For getting error msg your php.ini should enable this line -
error_reporting =3D E_ALL & ~E_NOTICE
chk for this.=0D
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
@nkur d@ve || http://ullu.wordpress.com=0D
=0D
-----Original Message-----
From: Chris Carter [mailto:chandan9sharma@yahoo.com]=0D
Sent: Tuesday, November 28, 2006 12:13 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Where am I doing wrong - DB
Just a small database code. Want to make entries in the mySQL table
using
PHP. Not being able to. When I run this code it takes me to the next
blank
brower window as if the entry has been made but after checking the
database
I do not find anything. There is not even an error message, I have tried
two
approaches this code is mixed. Please advice.
=0D
// database information
Here was the database information removed for security.
if($submit)
{
// connect and select the database
$conn =3D mysql_connect($host, $user, $password) or
die(mysql_error());
$db =3D mysql_select_db($dbName, $conn) or die(mysql_error());
// insert new entry in the database if entry submitted
if($query_rows !=3D 0)
{
$error =3D "THERE SOME ERROR TO BE SHOWN TO THE USER IF
THE EMAIL ADDRESS
EXISTS IN THE DATABASE";
}
=0D
else{
/* $fName =3D $_POST['fName'];
$lName =3D $_POSR['lName'];
$email =3D $_POST['email'];
$confEmail =3D $_POST['confEmail'];
$password =3D $_POST['password'];
$confirmPassword =3D $_POST['confirmPassword'];
$address =3D $_POST['address'];
$city =3D $_POST['city'];
$state =3D $_POST['state'];
$postCode =3D $_POST['postCode'];
$gender =3D $_POST['gender'];
$profession =3D $_POST['profession'];
$ageGroup =3D $_POST['ageGroup'];
$mallPref =3D $_POST['mallPref'];
$mallConsent =3D $_POST['mallConsent'];*/
// insert new entry into database
$sql =3D "insert data `userdata` (`fName`, `lName`, `email`,
`confEmail`,
`password`, `confirmPassword`, `address`, `city`, `state`, `postCode`,
`gender`, `profession`, `ageGroup`, `mallPref`, `mailConsent`) VALUES
('$fName', '$lName', '$email', '$confEmail', '$password',
'$confirmPassword', '$address', '$city', '$state', '$postCode',
'$gender',
'$profession', '$ageGroup', '$mallPref', '$mailConsent');";
$sucess_message =3D "SHOW HERE SOME MESSAGE TO THE USER IF THE
ADDITION IS
SUCESS"; =0D
} // end if new entry posted
=0D
}
=0D
Show some confirm or thank you HTML stuff.
?>=0D
Thank you in advance.
Chris
--=0D
View this message in context:
http://www.nabble.com/Where-am-I-doing-wrong---DB-tf2716628. html#a757418
7
Sent from the Php - Database mailing list archive at Nabble.com.
--=0D
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
The information contained in, or attached to, this e-mail, contains=
confidential information and is intended solely for the use of the=
individual or entity to whom they are addressed and is subject to legal=
privilege. If you have received this e-mail in error you should notify the=
sender immediately by reply e-mail, delete the message from your system=
and notify your system manager. Please do not copy it for any purpose, or=
disclose its contents to any other person. The views or opinions presented=
in this e-mail are solely those of the author and do not necessarily=
represent those of the company. The recipient should check this e-mail and=
any attachments for the presence of viruses. The company accepts no=
liability for any damage caused, directly or indirectly, by any virus=
transmitted in this email.
www.aztecsoft.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Where am I doing wrong - DB
am 28.11.2006 16:10:14 von Dwight Altman
Assuming $submit even has a value (Are you sure you don't mean
$_POST['something'] here?) all your code does is test 2 variables, connect
to the server, change to a database and set some more few variables. When
do you plan to execute a query "mysql_query($sql)", or output a print or
echo of some text or HTML?
"or die" doesn't output anything because $submit is probably false.
Your page should be blank and nothing should go to the database with this
code.
Regards,
Dwight
x2407
> -----Original Message-----
> From: Ankur Dave [mailto:ankurd@aztecsoft.com]
> Sent: Tuesday, November 28, 2006 1:01 AM
> To: Chris Carter; php-db@lists.php.net
> Subject: RE: [PHP-DB] Where am I doing wrong - DB
>
>
> For getting error msg your php.ini should enable this line -
> error_reporting = E_ALL & ~E_NOTICE
> chk for this.
>
> -=-=-=-=-=-=-=-=-=-
> @nkur d@ve || http://ullu.wordpress.com
>
>
> -----Original Message-----
> From: Chris Carter [mailto:chandan9sharma@yahoo.com]
> Sent: Tuesday, November 28, 2006 12:13 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Where am I doing wrong - DB
>
>
> Just a small database code. Want to make entries in the mySQL table
> using
> PHP. Not being able to. When I run this code it takes me to the next
> blank
> brower window as if the entry has been made but after checking the
> database
> I do not find anything. There is not even an error message, I have tried
> two
> approaches this code is mixed. Please advice.
>
>
>
> // database information
> Here was the database information removed for security.
>
> if($submit)
> {
> // connect and select the database
> $conn = mysql_connect($host, $user, $password) or
> die(mysql_error());
> $db = mysql_select_db($dbName, $conn) or die(mysql_error());
>
> // insert new entry in the database if entry submitted
> if($query_rows != 0)
> {
> $error = "THERE SOME ERROR TO BE SHOWN TO THE USER IF
> THE EMAIL ADDRESS
> EXISTS IN THE DATABASE";
> }
>
> else{
> /* $fName = $_POST['fName'];
> $lName = $_POSR['lName'];
> $email = $_POST['email'];
> $confEmail = $_POST['confEmail'];
> $password = $_POST['password'];
> $confirmPassword = $_POST['confirmPassword'];
> $address = $_POST['address'];
> $city = $_POST['city'];
> $state = $_POST['state'];
> $postCode = $_POST['postCode'];
> $gender = $_POST['gender'];
> $profession = $_POST['profession'];
> $ageGroup = $_POST['ageGroup'];
> $mallPref = $_POST['mallPref'];
> $mallConsent = $_POST['mallConsent'];*/
> // insert new entry into database
>
> $sql = "insert data `userdata` (`fName`, `lName`, `email`,
> `confEmail`,
> `password`, `confirmPassword`, `address`, `city`, `state`, `postCode`,
> `gender`, `profession`, `ageGroup`, `mallPref`, `mailConsent`) VALUES
> ('$fName', '$lName', '$email', '$confEmail', '$password',
> '$confirmPassword', '$address', '$city', '$state', '$postCode',
> '$gender',
> '$profession', '$ageGroup', '$mallPref', '$mailConsent');";
>
> $sucess_message = "SHOW HERE SOME MESSAGE TO THE USER IF THE
> ADDITION IS
> SUCESS";
> } // end if new entry posted
>
> }
>
> Show some confirm or thank you HTML stuff.
>
> ?>
>
> Thank you in advance.
>
> Chris
> --
> View this message in context:
> http://www.nabble.com/Where-am-I-doing-wrong---DB-tf2716628. html#a757418
> 7
> Sent from the Php - Database mailing list archive at Nabble.com.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> The information contained in, or attached to, this e-mail, contains
> confidential information and is intended solely for the use of the
> individual or entity to whom they are addressed and is subject to legal
> privilege. If you have received this e-mail in error you should notify the
> sender immediately by reply e-mail, delete the message from your system
> and notify your system manager. Please do not copy it for any purpose, or
> disclose its contents to any other person. The views or opinions presented
> in this e-mail are solely those of the author and do not necessarily
> represent those of the company. The recipient should check this e-mail and
> any attachments for the presence of viruses. The company accepts no
> liability for any damage caused, directly or indirectly, by any virus
> transmitted in this email.
>
> www.aztecsoft.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php