473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

my data is not inserting in my phpmyadmin database table

cognition
my data is not inserting in my phpmyadmin database table, please kindly help,
this is my code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $first_name = $_POST['firstname'];
  4. $last_name = $_POST['lastname'];
  5. $email = $_POST['email'];
  6. $when_it_happened = $_POST['whenithappened'];
  7. $how_long = $_POST['howlong'];
  8. $how_many = $_POST['howmany'];
  9. $alien_description = $_POST['aliendescription'];
  10. $what_they_did = $_POST['whattheydid'];
  11. $fang_spotted = $_POST['fangspotted'];
  12.  
  13. $dbc = mysqli_connect('localhost', 'user', 'passw', 'databasename') or die('Error Connection to MySQL Server.');
  14.  
  15. $query = "INSERT INTO database_table(first_name, last_name, email, when_it_happened, how_long, how_many, alien_description, what_they_did, 'fang_spotted)" . "VALUES('$first_name', '$last_name', '$email', '$when_it_happened', '$how_long', '$how_many', '$alien_description', '$what_they_did', '$fang_spotted')";
  16.  
  17. $result = mysqli_query($dbc, $query) or die('Error Querying Database.');
  18.     mysqli_close($dbc);
  19.  
  20. $msg = "First Name: $first_name\n" . "Last Name: $last_name\n" . "Your email address is: $email\n" . "You were abducted: $when_it_happened\n"  .  "and were gone for: $how_long\n" . "How Many are they: $how_many\n" . "Describe them: $alien_description\n" . "What did they do to you: $what_they_did\n" . "Was Fang there? $fang_spotted";
  21. mail($to, $subject, $msg);
  22.  
  23. echo 'Thank for submitting the form. <br />';
  24. echo 'First Name:', $first_name.'<br />';
  25. echo 'Last Name:', $last_name.'<br />';
  26. echo 'Your email address is:', $email.'<br />';
  27. echo 'You were abducted:', $when_it_happened.'<br />';
  28. echo 'and were gone for:', $how_long.'<br />';
  29. echo 'How Many are they:', $how_many.'<br />';
  30. echo 'Describe them:', $alien_description.'<br />';
  31. echo 'What did they do to you:', $what_they_did.'<br />';
  32. echo 'Was Fang there?', $fang_spotted.'<br />';
  33.  
  34. ?>
this is the feedback i get in my browser: Error Connection to MySQL Server.
Jun 10 '13 #1
0 1024

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Ester | last post by:
I would like to read data from a database table row by row and execute some codes based on the data retrieved from each row. For example, there are 4 fields on a table called Image_Tbl. Those...
4
by: Amar | last post by:
Hi All, I need to select data from a database table containing huge amount of data. Now I am storing data using one primary key and I am just using simple select statement, and this process...
5
by: ozzii | last post by:
Hi I am using the following code to copy data from one database table into another database table: SELECT * INTO Products From exportdb.mdb.exporttable However the query simply deletes...
3
by: prashanth023 | last post by:
Hi, Can any body tell that suppose i have member table in database1 I want to insert data in to this table, getting data from another database table suppose database2 table And is it...
0
by: hunkgym | last post by:
Good day! Currently I am using MS SQL Server 2000. I wish to delete all data in the database table except data in login table and security table. Furthermore, TRUNCATE is done on stand-alone...
1
by: iniyan | last post by:
hi guys need help again!!!! i want to retrieve data from the database table and put inside my drop down box.For example i want to view all my products example F216,F217,F218 in my dropdown box.how...
4
by: KMEscherich | last post by:
Version of Access = 2003 Hi there, is there a way to capture data using TERADATA SQL Assistant and import a portion of this database table into a Microsoft Access database table??? I currently...
1
by: ayyanki | last post by:
Hello all, I'm still learning about c# and I have a major function that I need to write (in a forms application), and I have no idea how to go about it. Here's the scenario: I have a text file...
1
by: chinni1 | last post by:
Hi , I want to retrive the xml data into my database table. The xml file is from outside of application.so i want to retrive that xml data into database with in some temporary table ...
8
by: chandhseke | last post by:
I have a form with various fields, one of which I need to check against data in a database table. i.e if the value entered into the text input field exists in the database, the form should be...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.