You are here: Mysql insert problems « PHP « IT news, forums, messages
Mysql insert problems

Posted by Frank Miller on 10/11/14 11:14

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация