TechSpott - Computer and technology forums

Go Back   TechSpott - Computer and technology forums > Webmasters > Database Management > MySQL
MySQL Forum dedicated to the world's most popular open source database engine.

Reply
 
Thread Tools Display Modes
Old April 26th, 2010, 02:12 PM   #1 (permalink)
Teddy
Guest
 
Posts: n/a
Default php mysql error (simple)?

I'm designing a web front-end for a mysql database using php. First, let me be clear that I do not write php . Right now, it is hosted on my localhost. I'm using wamp and apache and wampserver are both running/online.

I have my php code divided into two pages, which I have stored in the www folder of wampserver, as instructed.

Page 1: phptest.php contains just HTML code to allow the input of form data:

<html>
<form action="insert.php" method="post">
Last Name: <input type="text" name="last"><br>
First Name: <input type="text" name="first"><br>
Street Address: <input type="text" name="address"><br>
City: <input type="text" name="city"><br>
State: <input type="text" name="state"><br>
Zip Code: <input type="text" name="zip"><br>
Birth Date: <input type="text" name="birthdate"><br>
Phone: <input type="text" name="phone"><br>
Email: <input type="text" name="email"><br>
<input type="Submit">
</form>
</html>

Page 2: insert.php is SUPPOSED to insert the data into the mysql database hosted on my localhost, but does not. the html page submits, but the data doesn't go anywhere.

<?php
$username="root@localhost";
$database="mountainview3";

$last=$_POST['last'];

$first=$_POST['first'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$birthdate=$_POST['birthdate'];
$phone=$_POST['phone'];
$email=$_POST['email'];

mysql_connect(localhost,$username);
@mysql_select_db($database) or die("Unable to select database");

$query="INSERT INTO PERSON_T(LAST_NAME, FIRST_NAME, STREET_ADDRESS, CITY, STATE, ZIP, BIRTH_DATE, PHONE, EMAIL) VALUES ('$last', '$first', '$address', '$state','$zip', '$birthdate', '$phone', '$email')";
mysql_query($query);

mysql_close()

?>

honestly, I can't get the second file to do ANYTHING really. I commented out the majority of it to test and used echo $last; to see if I could get a response and got nothing.
  Reply With Quote Share with Facebook
Reply

Bookmarks

Tags
error, mysql, php, simple


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i make a website linked with a databse using php apache and mysql? Jonathan M PHP 0 April 22nd, 2010 10:03 PM
Oracle Announces MySQL Cluster 7.1 News Bot News 0 April 13th, 2010 09:47 PM
Update MySQL database through PHP form? selfrob MySQL 0 April 8th, 2010 01:07 PM
Multiple PHP Scripts in 1 MySQL Database? Robert M PHP 0 April 4th, 2010 02:56 AM
What is the easiest way to practise using PHP and mySQL? bob1704 MySQL 0 April 2nd, 2010 01:55 AM

 
Forum Stats
Members: 14,320
Threads: 20,327
Posts: 27,671
Total Online: 35

Newest Member: VanoNat

Latest Threads

Advertisements

Support our advertisers!

Amazon
Sears
Macys
1800flowers.com
Drugstore.com


Carbonite Online-Backups
Tiger Direct
Tech Depot
Buy.com
Office Depot
Fatcow
HostGator


TripsNow.us
Marriott
Expedia
CheapTickets.com
OneTravel
Hotwire

Are you a Fan?

Share this on Facebook

Tag Cloud

Partner Links


Contact Us - Home - Archive - Privacy Statement - Top - Copyright © 2009-2010, TechSpott - All times are GMT -4. Time is 05:22 AM

Powered by vBulletin® Copyright © Jelsoft Enterprises Ltd. :: SEO by vBSEO