My current project is building a real estate website - almost done. The CMS has form pages that ADD / EDIT / DELETE residential records. The ADD page creates a new residential record in the database; and the EDIT and DELETE pages manage each residential record.
Each residential record has four pictures associated with that record. Adding pictures is done in the EDIT page. Under my design, the admin must first create a record using the ADD page.
--------ISSUE---------
The ADD page inserts a record into the RESIDENTIAL TABLE; RES_ID is the primary key. I also need the ADD page to INSERT the newly created RES_ID into the IMAGES TABLE field IMAGE_RES_ID.
Code: Select all
<?php
if ($submit): // add new CONTENT from form below
$sqlinsert = "INSERT INTO residential SET
res_order='$resorder',
res_head='$reshead',
res_description='$resdescription',
res_price='$resprice'";
if (@mysql_query($sqlinsert)) {
echo("<p>New Residential property added!</p>");
} else {
echo("<p>Error adding new Residential property: " . mysql_error() . "</p>");
}
?>Code: Select all
$imginsert = "INSERT INTO image SET res_order= mysql_insert_id";Any one see where I went off the road? Thanks in advance.
Greg
.