Jump to content

A problem INSERTing data


JPark

Recommended Posts

I am having a problem INSERTing data into a mysql table.

 

I am gathering this data from a form on an HTML page which, in turn submits it to a php page that INSERTs it. I can echo my $query but no data gets into the table.

 

Here is the output from my php page:

 

SWAT INSERT Test
INSERT INTO csvd (id,serverName,serverDescription,serverType,issueType,incidentDate,downtimeStart,
downtimeEnd,totalDowntime,incidentReport,ticketNumber,causeAnalysis) VALUES ('','steps22','MRTS, MWTS','dev','Scheduled Maintenance','08/22/2008','1630','1800',
'2 hours, 30 minutes','Incident Report','1234567890','Root Cause Analysis')Thank you for your contribution!

 

And here are snipets from the php code:

 

<?
...snip...

$serverName = $_POST['serverName'];

//start if loops to match up serverName with serverDescription and serverType

if ($serverName == 'steps20') {
    $serverType = 'software acceptance';
    $serverDescription = 'Engenera test';
    }
elseif ($serverName == 'steps21')  {

...snip...

else {
    }
$issueType=$_POST['issueType'];
$incidentDate=$_POST['incidentDate'];
$downtimeStart=$_POST['downtimeStart'];
$downtimeEnd=$_POST['downtimeEnd'];
$totalDowntime=$_POST['totalDowntime'];
$incidentReport=$_POST['incidentReport'];
$ticketNumber=$_POST['ticketNumber'];
$causeAnalysis=$_POST['causeAnalysis'];

mysql_connect(localhost,'<username>','<password>');
@mysql_select_db('esmpd_eapbcalendar') or die( "Unable to select database");

$query = "INSERT INTO csvd (id,serverName,serverDescription,serverType,issueType,incidentDate,downtimeStart,
downtimeEnd,totalDowntime,incidentReport,ticketNumber,causeAnalysis) VALUES ('','$serverName','$serverDescription','$serverType','$issueType','$incidentDate',
'$downtimeStart','$downtimeEnd','$totalDowntime','$incidentReport','$ticketNumber',
'$causeAnalysis')";
mysql_query($query);

mysql_close();

echo $query;
?>

 

Thoughts? Suggestions? Corrections?

 

Thanks!

 

Joe

Link to comment
Share on other sites

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.