tecdesign Posted March 28, 2006 Share Posted March 28, 2006 here is the code<?php$dbh=mysql_connect ("localhost", "tecdnco_matt", "(password)") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("tecdnco_xtec"); $sql = "INSERT INTO `members` (`username`, `password`, `first_name`, `last_name`, `email_address`, `bizname`, `phone`, `fax`, `street_address`, `country`, `city`, `region`, `mobile`)VALUES ('". $_POST['username'] ."', '". $_POST['password'] ."', '". $_POST['first_name'] ."', '". $_POST['last_name'] ."', '". $_POST['email_address'] ."', '". $_POST['bizname'] ."', '". $_POST['phone'] ."', '". $_POST['fax'] ."', '". $_POST['street_address'] ."', '". $_POST['country'] ."', '". $_POST['city'] ."', '". $_POST['region'] ."', '". $_POST['mobile'] ."')"; $username = $_POST['username'];$password = $_POST['password'];$first_name = $_POST['first_name'];$last_name = $_POST['last_name'];$email_address = $_POST['email_address'];$bizname =$_POST['bizname'];$phone = $_POST['phone'];$mobile = $_POST['mobile'];$fax = $_POST['fax'];$street_address = $_POST['street_address'];$country = $_POST['country'];$region = $_POST['region'];$city = $_POST['city'];echo" $password $username $first_name $last_name"?>I have taken out the password ok so that is not the problem. What is happeing is that it will not add the data to the database but the $password $username $first_name and $last_name in the echo statement are showing up. I am completely lost and confused Quote Link to comment https://forums.phpfreaks.com/topic/5981-inserting-data-into-a-database/ Share on other sites More sharing options...
toplay Posted March 28, 2006 Share Posted March 28, 2006 You forgot to invoke the actual query. Example:$result = mysql_query($sql); Quote Link to comment https://forums.phpfreaks.com/topic/5981-inserting-data-into-a-database/#findComment-21442 Share on other sites More sharing options...
tecdesign Posted March 28, 2006 Author Share Posted March 28, 2006 Thanks toplay you're the man it work!So how do I get really good at PHP, I want to beomce a guru any advice? Quote Link to comment https://forums.phpfreaks.com/topic/5981-inserting-data-into-a-database/#findComment-21464 Share on other sites More sharing options...
toplay Posted March 28, 2006 Share Posted March 28, 2006 [!--quoteo(post=359160:date=Mar 27 2006, 09:20 PM:name=Tec_Matt)--][div class=\'quotetop\']QUOTE(Tec_Matt @ Mar 27 2006, 09:20 PM) [snapback]359160[/snapback][/div][div class=\'quotemain\'][!--quotec--]Thanks toplay you're the man it work!So how do I get really good at PHP, I want to beomce a guru any advice?[/quote]You're welcome.Read, learn, and do. Practice, practice and practice. It comes with time and experience. Be patient.Just keep coding.:) Quote Link to comment https://forums.phpfreaks.com/topic/5981-inserting-data-into-a-database/#findComment-21475 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.