MySQL Forums
Forum List  »  PHP

Script is not writing to Table
Posted by: April Mcferran
Date: March 22, 2011 07:40PM

hello,
Here is my code for gathering data from a form and inserting that data into a table.

<?php
$first_name = $_POST['firstname'];

$last_name = $_POST['lastname'];

$when_it_happened = $_POST['whenithappened'];

$how_long = $_POST['howlong'];

$how_many= $_POST['howmany'];

$alien_description = $_POST['aliendescrption'];

$what_they_did = $_POST['whattheydid'];

$fang_spotted = $_POST['fangspotted'];

$email = $_POST['email'];

$other = $_POST['other']

$dbc = mysqli_connect('localhost,' fang', 'aprildawn',)

or die('error connecting to MYSQL server.');

$query = " INSERT into aliens_abduction (first_name, last_name, when_it_happened, how_long, " .

"how_many, alien_description, what_they_did, fang_spotted, other, email) ".

"VAlUES ('$first_name', '$last_name', '$when_it_happened','$how_long', '$how_many'," .

"'$alien_description', '$what_they_did', '$fang_spotted', '$other', '$email')";

$result = mysqli_query($dbc, $query)

or die('error querying database.');
Simply put when I look for the data in the table there is nuth'in.

It's as if I might not be connecting at all to the database;yet I've yet to receive a error in connecting message, or an error in querying the database. So my question is this: Is it my code? Also, anybody have a method for checking on the MYSQL server what user has accessed the database. If I could do that, I could see if my script has been accessing the database, if not writing to the table.

Thanks for your attention,
cheers,
April

Options: ReplyQuote


Subject
Written By
Posted
Script is not writing to Table
March 22, 2011 07:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.