I'm trying to insert values into several tables. Here's the code and then I'll explain the problem
$intoReport = $db->Execute("INSERT INTO report (project_id, report_title, date_submitted, report_url, abstract_info, userlevel)VALUES ('$project','$report','$date','$url','$abstract','$view')");
$getReportID = $db->Execute("SELECT report_id FROM report WHERE report_title ='$report'");
//echo $getReportID;
$intoAuthor = "INSERT INTO rep_aut (report_id, author_id) VALUES ('$getReportID', '$author')";
//echo $intoAuthor;
$rs = $db->Execute($intoAuthor);
OK the the first variable $intoReport is fine it takes values from variables that are set to $_POST values and puts them into a row in the report table.
The second variable $getReportID then queries the and pulls an autonumber primary key for the row just inserted by $intoReport
The third variable is supposed to insert the number retrieved from the report and the option from select list and insert them into the rep_aut table.
The problem I'm having is that $getReportID is putting both the column name and value into the variable instead of just the variable and then since the rep_auth table is just integers it won't accept the input.
I need to know how to either strip the column name from the value or not get it into the variable to begin with (preferably the latter)
I am using ADOdb since the backend database is an Access database. Don't try to convince me to change I have no choice in the matter.
$intoReport = $db->Execute("INSERT INTO report (project_id, report_title, date_submitted, report_url, abstract_info, userlevel)VALUES ('$project','$report','$date','$url','$abstract','$view')");
$getReportID = $db->Execute("SELECT report_id FROM report WHERE report_title ='$report'");
//echo $getReportID;
$intoAuthor = "INSERT INTO rep_aut (report_id, author_id) VALUES ('$getReportID', '$author')";
//echo $intoAuthor;
$rs = $db->Execute($intoAuthor);
OK the the first variable $intoReport is fine it takes values from variables that are set to $_POST values and puts them into a row in the report table.
The second variable $getReportID then queries the and pulls an autonumber primary key for the row just inserted by $intoReport
The third variable is supposed to insert the number retrieved from the report and the option from select list and insert them into the rep_aut table.
The problem I'm having is that $getReportID is putting both the column name and value into the variable instead of just the variable and then since the rep_auth table is just integers it won't accept the input.
I need to know how to either strip the column name from the value or not get it into the variable to begin with (preferably the latter)
I am using ADOdb since the backend database is an Access database. Don't try to convince me to change I have no choice in the matter.