Jump to content

Search the Community

Showing results for tags 'multiple tables'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi. I'm trying to add a Customer registration page, where the customers name and address are stored in separate tables, and I'm having issues. This is the insert_ac.php page, where all the error messages direct me to line 21 and 23 (Undefined index: HouseNumberName and Undefined index: CityTown respectively) Just in case it's not too obvious, PHP isn't my strong suit. <?php $host=''; // Host name $username=''; // Mysql username $password=''; // Mysql password $db_name='comp 5130'; // Database name $tbl_client='client'; // 1st Table name $tbl_location= 'location'; //2nd table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Get values from form $cid=['ID']; $lid=['ID']; $firstname=$_POST['FirstName']; $lastname=$_POST['LastName']; $email=$_POST['EmailAddress']; $cnumber=$_POST['ContactNumber']; $house=$_POST['HouseNumberName']; $street=$_POST['StreetName']; $city=$_POST['CityTown']; $postcode=$_POST['PostCode']; // Insert data into client $sql ="INSERT INTO $tbl_client(ID, FirstName, LastName, EmailAddress, ContactNumber) VALUES('', '{$firstname}', '{$lastname}', '{$email}', '{$cnumber}')"; echo $sql; $result = mysql_query($sql); if (!$result) { die('Invalid query: ' . mysql_error());} // Insert Data Into location $sql2 ="Insert Into $tbl_location(ID, HouseNumberName, StreetName, CityTown, PostCode) Values ('', '$house', '$street', '$city', '$postcode')"; echo $sql2; $result2 = mysql_query($sql2); if (!$result2) { die('Invalid query: ' . mysql_error());} // if successfully insert data into client, displays message if($result) { echo "sucessful customer add"; echo "<BR>"; echo "<a href= 'insert.php'>Back To Main Page</a>"; } else { echo "That can't be good, Customer Error..."; } // if successfully insert data into location, displays message if($result2) { echo "sucessful address"; echo "<BR>"; echo "<a href= 'insert.php'>Back To Main Page</a>"; } else { echo "That can't be good, Address Fail..."; } ?> <?php // close connection mysql_close(); ?>
×
×
  • 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.