Dan
I found "$this->db" on some website in relation to the wrapper function.
Anway, I've followed your suggestion and amended as follows. Still not working. Sorry to be a pain.
Sean
PHP Code:
<HTML>
<HEAD>
<TITLE>Data entry</TITLE>
</HEAD>
<BODY>
<P><?php $con = mysql_connect('localhost', 'username', 'password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('newpolitics_com_pol', $con);
$sql="INSERT INTO tblPerson (MemberofID, RelationshipID, FirstName, RestofName, PartyID, ElectorateID, StateID, Portfolio)
VALUES (" . (int)($_POST['MemberofID']) . ", ". (int)($_POST['RelationshipID']) . ", '" . mysql_real_escape_string($_POST['FirstName']) . "','" . mysql_real_escape_string($_POST['RestofName']) . "','" . mysql_real_escape_string($_POST['PartyID']) . "','" . mysql_real_escape_string($_POST['ElectorateID']) . "', '" . mysql_real_escape_string($_POST['StateID']) . "','" . mysql_real_escape_string($_POST['Portfolio']) . "')";
//Execute the INSERT query
$result = mysql_query($sql, $con);
if (!$result) die('Error: ' . mysql_error());
//Store the ID of the row that was just inserted
$inserted_id = mysql_insert_id();
$sql="INSERT INTO tblFinancialInterest (FinancialInterestTypeID, Location, Purposeowned)
VALUES (" . (int)($_POST['FinancialInterestTypeID']).",'". mysql_real_escape_string($_POST['Location']) . "','" . mysql_real_escape_string($_POST['Purposeowned']."')";
//Execute the second INSERT query
$result = mysql_query($sql, $con);
if (!$result) die('Error: ' . mysql_error());
$sql="INSERT INTO tblPersonFinancialInterest (BeneficialInterest, FinancialInterestID, PersonID)
VALUES
('" . mysql_real_escape_string($_POST['BeneficialInterest'])."',LAST_INSERT_ID(),$inserted_id)";
//Execute the 3rd INSERT query
$result = mysql_query($sql, $con);
if (!$result) die('Error: ' . mysql_error());
if (!mysql_query($sql,$con))
echo "Data added";
mysql_close($con);
?></P>
</BODY>
</HTML>
Bookmarks