Bu bildiride, ben tam olarak aynı başlık, fiyat, şehir, eyalet, detay vardır veritabanında son gönderme olup olmadığını görmek için çalışıyorum. Varsa, o zaman kesin sonrası zaten yapılmış kullanıcıya söyleyebilirim; sonra DBC içine ilanı eklemek değilse. (:) Kullanıcıların yanlışlıkla Bu iyi kontrol olmayabilir. Kez açamazsınız böylece bu çek bir türüdür, ancak bu açıklama hata beni rahatsız olduğunu, bu yüzden çalışmak istiyorum)
Neden bu sql çalışmaz? Ben title=$title izin vermiyor ve $title değerini elde değil düşünüyorum ...
> ERROR: mysqli_num_rows() expects
> parameter 1 to be mysqli_result,
> boolean given in postad.php on line
> 365
//there is a form that users fill out that has title, price, city, etc
<form>
blah blah
</form>
//if users click submit, then does all the checks and if all okay, insert to dbc
if (isset($_POST['submit']))
{
// Grab the pposting data from the POST and gets rid of any funny stuff
$title = mysqli_real_escape_string($dbc, trim($_POST['title']));
$price = mysqli_real_escape_string($dbc, trim($_POST['price']));
$city = mysqli_real_escape_string($dbc, trim($_POST['city']));
$state = mysqli_real_escape_string($dbc, trim($_POST['state']));
$detail = mysqli_real_escape_string($dbc, trim($_POST['detail']));
if (!is_numeric($price) && !empty($price))
{
echo "<p class='error'>The price can only be numbers.
No special characters, etc</p>";
}
//Error problem...won't let me set title=$title, detail=$detail, etc.
//this statement after all the checks so that none of the variables are empty
$query="Select * FROM posting
WHERE user_id={$_SESSION['user_id']}
AND title=$title
AND price=$price
AND city=$city
AND state=$state
AND detail=$detail";
$data = mysqli_query($dbc, $query);
if(mysqli_num_rows($data)==1)
{
echo "You already posted this ad. Most likely caused by refreshing too many times.";
}
}