Hi:
This is the code I'm using
<?php require_once ("config.php");
function error($msg) {
global $message;
$message = $msg;
include "postad.php";
die();
}
function error2($msg) {
error("<font color=\"red\"><b><i>$msg</i></b></font>");
}
function esc($data) {
return mysql_real_escape_string($data);
}
function getesc($varname) {
global $$varname;
$$varname = isset($_POST[$varname]) ? esc($_POST[$varname]) : "";
return $$varname;
}
//Get data in local variable
getesc('adype');
getesc('cat');
getesc('title');
getesc('desc');
getesc('price');
getesc('country');
getesc('region');
getesc('city');
getesc('area');
getesc('address');
// check for null values
if ($adype=="Free") {
if ($cat=="") error2("Please select a Category");
if ($title=="") error2("Please enter a Title");
if ($desc=="") error2("Please enter a Description");
$price = 0;
}
else {
if ($cat=="") error2("Please enter a Category");
if ($title=="") error2("Please enter a Title");
if ($desc=="") error2("Please enter a Description");
$price = $price;
}
// insert local variables into database
$query = "INSERT INTO normalposts (adype, cat, title, desc, price, country, region, city, area, address) VALUES
('$adype','$cat','$title','$desc','$price','$country','$region','$city','$area','$address')";
if (mysql_query($query)===FALSE) error2("Error inserting into the database.");
else {
// nothing to do, service seeker has no extra fields
}
include "header.php";
?>
<font color=blue>
<center>
<b><i>Your ad has been successfully posted and will appear online after it has passed moderation.</i></b>
<br /><br />
We wish you success.
</center>
<br />
</font>
<?php
include "footer.php";
?>
This is the error I get
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in D:\Hosting\xxx\htmlaaa\postingsuccess.php on line 12
Please help .
Thanks