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
https://forums.phpfreaks.com/topic/121234-a-problem-inserting-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.