Hey guys I am hoping for some assistance here. I am creating a 'wraptool' of sorts and am trying to do this: The previous page contains a form whose action is this page. The only problem is that when you click submit you get the infamous Resource ID#4 error. I've googled and searched forums here, but the applications of this have been slightly different and the answers haven't worked. At least I haven't gotten them to work.
<?php
$var1_getType = "0";
if (isset($_POST['escalation'])) {
$var1_getType = $_POST['escalation'];
}
$var3_getType = "0";
if (isset($_POST['coaching'])) {
$var3_getType = $_POST['coaching'];
}
$var4_getType = "0";
if (isset($_POST['commendation'])) {
$var4_getType = $_POST['commendation'];
}
$var5_getType = "1";
if (isset($_POST['source'])) {
$var5_getType = $_POST['source'];
}
$var2_getType = "0";
if (isset($_POST['consultation'])) {
$var2_getType = $_POST['consultation'];
}
$getType = mysql_query("SELECT type_id
FROM call_type
WHERE source_id = '" . $var5_getType . "'
AND escalation = '" . $var1_getType . "'
AND consultation = '" . $var2_getType . "'
AND coaching = '" . $var3_getType . "'
AND commendation = '" . $var4_getType . "'");
if (!$getType)
{
die('Invalid type: ' . mysql_error());
}
$result = mysql_query("Insert into calls (
agent_id,
repair_order,
issue_id,
type_id,
assignedto,
description,
resolution)
values (
'" . $_POST['agent_id'] . "',
'" . $_POST['ro'] . "',
'" . $_POST['issue'] . "',
'" . $getType . "',
'" . $_SESSION['MM_Username'] . "',
'" . $_POST['description'] . "',
'" . $_POST['resolution'] . "')");
if (!$result)
{
die('Invalid formation of insert query: ' . mysql_error());
}
mysql_close();
header('Location: newcall.php');
?>
Updated: removed mysql_error() from query, you guys were right that was odd. I think I was rushing it.