ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
[PHP-DB] Where am I doing wrong - DB
by Chris Carter other posts by this author
Nov 27 2006 10:44PM messages near this date
RE: [PHP-DB] multiple database join with pdo | RE: [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.

<?php
   
   // 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.ht
ml#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
Thread:
Chris Carter
Ankur Dave
Dwight Altman

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved