Mysql insert problems
| From: | Frank Miller | Date: | Fri, 15 Apr 2005 19:18:34 +0000 |
| Subject: | Mysql insert problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-213156@lists.php.net to get a copy of this message | ||
All,
I have a form which submits technical requests. It worked fine on an
old linux box using Mysql 3 series but recently we switched to windows
2003 server SP1 using Mysql 4.1.10. It was doing this before the
service pack. I get the form values and then insert them into a table.
Sometimes it works and sometimes it dies. I don't know where to look
to fix this. Here is my code:
<?php
$Email = $_POST['Email'];
$Phonenumber = $_POST['Phonenumber'];
$RoomNo = $_POST['RoomNo'];
$Situation = $_POST['Situation'];
$type = $_POST['type'];
if (!( (empty($Phonenumber)== TRUE) || (empty($Email)== TRUE) ||
(is_email($Email) == false) ) )
{
$ip = $_SERVER['REMOTE_ADDR'];
$DateRec = date("Y")
."-".date("m")."-".date("d");
$TimeRec =
date("H").":".date("i").":".date("s");
// initialize database connection
include ('../../db.inc');
$connection = mysql_connect($Host,$User,$Password) or
die("Invalid server or user");
// select database
mysql_select_db("techsupport", $connection);
//formulate and run query
$query = "insert into
techsupport(Completed,Phonenumber,RoomNo,Email,Situation,DateRec,TimeRec,ip)
values('N','$Phonenumber','$RoomNo','$Email','$Situation','$DateRec','$TimeRec','$ip')";
$result = mysql_query($query,$connection) or die("Couldn't
Insert into table techsupport");
$WONumber = mysql_insert_id();
etc...
Any help would be appreciated.
Thanks - Frank
--
Frank Miller
Webmaster and Computer Specialist
Texas A&M Uiversity-Texarkana
Phone/Voice Mail 9032233156
Fax 9032233139
Web Page www.tamut.edu