Hi,
Just came across a problem for a site i made for a friend, seems everytime i add a record it seems to add 'Array' into the database for one of the fields and i cant figure out why since it was working a few days ago~
In addition was wondering how i would go about an edit function, since my mate has to update one of the fields depending on his progress along with an echo that it has been edited on the page so any decent guides/help would be appreciated.
On a personal note would appreciate any comments on how to tidy my code up / better methods of doing what i done, since im still learning.
Kind regards
IS7doji
Just came across a problem for a site i made for a friend, seems everytime i add a record it seems to add 'Array' into the database for one of the fields and i cant figure out why since it was working a few days ago~
In addition was wondering how i would go about an edit function, since my mate has to update one of the fields depending on his progress along with an echo that it has been edited on the page so any decent guides/help would be appreciated.
On a personal note would appreciate any comments on how to tidy my code up / better methods of doing what i done, since im still learning.
Kind regards
IS7doji

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Manage Commission Status</title>
<link rel="stylesheet" type="text/css" href="css/core-style.css" />
</head>
<body>
<div id = "Container">
<div id = "Title"></div>
<div id = "Banner"></div>
<div id = "Menu">
<ul>
<li><a title="Home" href="update.php">Updates</a></li>
<li><a title="Home" href="manage_commission_status.php">Manage Commission Status</a></li>
<li><a title="Home" href="manage_concept_art.php">Manage Concept Art</a></li>
<li><a title="Home" href="upload_concept_art.php">Upload Concept Art</a></li>
</ul>
</div>
<div id = "Content">
<h1>Manage Commission Status</h1>
<?php
if($_GET['ac'])
{
$link = mysql_connect('127.0.0.1', 'USERNAME', 'PASSWORD')
or die('Connection Failed');
mysql_select_db('USERNAME_DB') or die('Could not select database');
$query = 'DELETE FROM DB_commission_status WHERE ticket_number="' . $_GET['ticket_number'] . '"';
$result = mysql_query($query) or die('Query Failed');
mysql_close($link);
}
else if($_POST['submit'])
{
$link = mysql_connect('127.0.0.1', 'USERNAME', 'PASSWORD') or die('Connection Failed');
mysql_select_db('USERNAME_DB') or die('Could not select database');
$sql="INSERT INTO DB_commission_status (ticket_number, name, suit, status, waiting_list) VALUES ('$_POST[ticket_number]','$_POST[name]','$_POST[suit]','$_POST[status]', '$_POST [waiting_list]')";
if (!mysql_query($sql,$link))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($link);
}
$text = "<hr>Delete a record from the status<br /><br/><table>";
$link = mysql_connect('127.0.0.1', 'USERNAME', 'PASSWORD') or die('Connection Failed');
mysql_select_db('USERNAME_DB') or die('Could not select database');
$query = 'SELECT * FROM DB_commission_status ORDER BY ticket_number';
$result = mysql_query($query) or die('Query Failed');
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$text = $text . "
<tr class =$status><td>{$row['ticket_number']}</td>" .
"<td>{$row['name']}</td>" .
"<td>{$row['suit']}</td>" .
"<td>{$row['status']}</td>" .
"<td>{$row['waiting_list']}</td>" .
"<td><a href='manage_commission_status.php?ac=del&ticket_number={$row['ticket_number']}'>Delete</a></td></tr>";
}
$text = $text . "</table>
<form method='post' action='manage_commission_status.php'>
<br />
<hr>
Add status
<table>
<tr>
<td>ticket number:</td>
<td><input type='text' name='ticket_number'></td>
</tr>
<tr>
<td>name:</td>
<td><input type='text' name='name'></td>
</tr>
<tr>
<td>suit:</td>
<td><input type='text' name='suit'></td>
</tr>
<tr>
<td>status:</td>
<td><input type='text' name='status'></td>
</tr>
<tr>
<td>waiting list:</td>
<td><input type='text' name='waiting_list'></td>
</tr>
<tr>
<td><input type='submit' name='submit' value='submit'></td>
</tr>
</table>
</form>
<br/><br/>
";
echo $text;
?>
</div>
<div id = "Footer"> </div>
</div>
</body>
</html>