PDA

View Full Version : Trying to draw a value from SQL (error)



computergeeza
06-19-2005, 11:18 PM
I am trying to draw a field value from a field named RefNo in the database using modified code from the create_yahoo_school_link.

Basically i am trying to take the value of RefNo from the listing and put it in a hidden field on the listing_view page which i have integrated a form (reservtion request)

But i keep getting this error :confused:
"Notice: Undefined variable: RefNo_field in /home/southern/public_html/sd/include/listing.inc.php on line 782"

function create_inquiry_link()
{
global $conn, $config,$lang;
require_once($config['basepath'].'/include/misc.inc.php');
$misc = new misc();
$display = '';
$refnum= '';
$sql_listingID = $misc->make_db_safe($_GET['listingID']);
$sql_RefNo_field = $misc->make_db_safe($RefNo_field);
$sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = $sql_listingID) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = $sql_RefNo))";
$recordSet = $conn->Execute($sql);
if ($recordSet === false)
{
$misc->log_error($sql);
}

while (!$recordSet->EOF)
{
$refnum = $misc->make_db_unsafe ($recordSet->fields['listingsdbelements_field_value']);
$recordSet->MoveNext();
} // end while
if ($refnum !='')
{
$display = '<input name="ListingID" type="hidden" id="ListingID" value='.$_GET['listingID'].'> <input name="RefNo" type="hidden" id="RefNo" value='.$refnum.'>';
}
return $display;
}


Any help is greatly appreciated!

computergeeza
06-22-2005, 09:18 AM
anyone? :confused:

greengiant
06-22-2005, 10:31 AM
$sql_RefNo_field = $misc->make_db_safe($RefNo_field);


Remove that line you dont have a variable $RefNo_field declared so it is is diong nothing and causing the error you are seeing.