Jump to content

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/5981-inserting-data-into-a-database/
Share on other sites

[!--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.

:)
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.