I have written a simple Employee Directory for my company's Intranet to display employee information and a picture. The information is stored in a MYSQL database running on a server running SuSe 8.2 Pro. I wrote a few simple scripts for the HR department here to maintain the employees on the database (add, update and delete). Up until now, it has been working fine. Today, the individual in the Human Resources department in charge of maintaining the database called me and said that she was unable to add an employee. I tried myself and was also unable to. I was able to use my "maintenence" page to update employees and delete employees with no problem. However, I cannot add any employees to the database. The id field is set to auto increment. Could this be the field causing the problems?
None of the code has been altered in a couple months, so I am absolutely lost as to what the hell happened in the last day or two to not allow the addition of records to the database. Here is a list of things I have tried:
manually setting the ID and then trying to submit-no go
stopping and restarting the database- no go
deleting a record and then try to add (i figured if it was an issue with the NUMBER of records, this would free up enough room to add one)- no go
None of the permissions on the database have changed.
Is there a set size of a database? If so, how do you change to allow more records?
Here is the page to enter the employee info:
<html>
<head>
<title>Add Employee to Database</title>
</head>
<FONT FACE="Verdana">
<FORM ACTION="dbwrite.php" METHOD=POST>
<TABLE BORDER=0 ALIGN=CENTER>
<TR BGCOLOR="#008B00">
<TH COLSPAN=2 ALIGN=CENTER><FONT COLOR="#FFFFFF">Add Employee</TH>
</TR>
<TR BGCOLOR="#00CC00">
<TD>Last Name</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[lname]" SIZE=25></TD>
<TR BGCOLOR="#00CC00">
<TD>First Name</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[fname]" SIZE=25></TD>
</TR>
<TR BGCOLOR="#00CC00">
<TD>Title</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[title]" Size=25></TD>
</TR>
<TR BGCOLOR="#00CC00">
<TD>Department</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[department]" SIZE=25></TD>
</TR>
<TR BGCOLOR="#00CC00">
<TD>Supervisor</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[supervisor]" SIZE=25></TD>
</TR>
<TR BGCOLOR="#00CC00">
<TD>Location</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[location]" SIZE=25></TD>
<TR BGCOLOR="#00CC00">
<TD>Phone</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[phone]" SIZE=25></TD>
</TR>
<TR BGCOLOR="#00CC00">
<TD>Email</TD><TD BGCOLOR="#FFFFFF"><INPUT
TYPE=TEXT NAME="Array[email]" SIZE=25></TD>
</TR>
<TR BGCOLOR="#00CC00">
<TD>URL to Photo</TD><TD BGCOLOR="#FFFFFF"><INPUT TYPE=TEXT
NAME="Array[photo]" SIZE=25</TD>
</TR>
<TR BGCOLOR="#00CC00">
<TD>Comments</TD><TD BGCOLOR="#FFFFFF"><TEXTAREA
NAME=Array[comments] ROWS=5 COLUMNS=25></TEXTAREA></TD>
</TR>
</TABLE>
<BR><BR>
<CENTER>
<INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Add Record to Directory">
</CENTER>
</FORM>
</BODY>
</HTML>
And here is the page to write the info to the database:
<html>
<head>
<title>Inserting Data into DataBase</title>
</head>
<BODY>
<?php
//Trim the incoming data
$Array["lname"]=trim
($Array["lname"]);
$Array["fname"]=trim
($Array["fname"]);
$Array["title"]=trim
($Array["title"]);
$Array["department"]=trim
($Array["department"]);
$Array["supervisor"]=trim
($Array["supervisor"]);
$Array["location"]=trim
($Array["location"]);
$Array["phone"]=trim
($Array["phone"]);
$Array["email"]=trim
($Array["email"]);
$Array["photo"]=trim
($Array["photo"]);
$Array["comments"]=trim
($Array["comments"]);
//Set the variables for database access
$Host="localhost";
$User="root";
$Password="";
$DBName="EmployeeDirectory";
$TableName="Master";
$Link=mysql_connect($Host, $User, $Password);
$Query="INSERT into $TableName VALUES ('$Array[id]',
'$Array[lname]','$Array[fname]','$Array[title]','$Array[department]','$Array[supervisor]','$Array[location]','$Array[phone]','$Array[email]','$Array[photo]','$Array[comments]')";
print ("The query is:<BR>$Query<P>\n");
if (mysql_db_query ($DBName, $Query, $Link)) {
print ("The query was successfully executed!<BR>\n");
} else {
print ("The query could not be executed!<BR>\n");
}
mysql_close ($Link);
?>
<BR><BR><BR>
<A HREF="Add_Main.html" style="text-decoration:none">Add another
employee</A><BR>
<A HREF="DBMaint.html" style="text-decoration:none" TARGET="_top">Return to Database Maintenence Main
Page</A>
</BODY>
</HTML>
Thanks in advance for any help,
Vincent Wolfenbarger