<?php
include_once("ayarlar.php");
$moid= $_POST["moid"];
print_r($_POST);
if($moid!=""){
$sor = mysql_query("SELECT * FROM siparisler Where moid LIKE '$moid %' ORDER BY id asc");
if(mysql_num_rows($sor)>0){
while($yaz=mysql_fetch_array($sor)){
$moid = $yaz["$moid"];
$tarih = $yaz["$tarih"];
echo"$moid";
echo"$tarih";
}
}else{
echo"Yok";
}
}
?>formdan moid değerini gönderiyorum ama sonuç ekranında boş çıkıyor print_r ile yazdırdığımda gönderilen değeri ekrana yazıdırıyor acaba
php ile arama yapmak
3
●178
- 28-10-2023, 02:27:20Merhaba php ile veri tabanında arama yapmak istiyorum ama bir türlü yapamadım rica etsem bilen arkadaşlar yardımcı olabilirmi Mysqli
- 28-10-2023, 03:11:31
<?php include_once("ayarlar.php"); $moid = $_POST["moid"]; print_r($_POST); if ($moid != "") { $sor = mysqli_query($baglanti, "SELECT * FROM siparisler WHERE moid LIKE '$moid %' ORDER BY id ASC"); if (mysqli_num_rows($sor) > 0) { while ($yaz = mysqli_fetch_array($sor)) { $moid = $yaz["moid"]; $tarih = $yaz["tarih"]; echo "$moid"; echo "$tarih"; } } else { echo "Yok"; } } ?>bunu dener misin - 28-10-2023, 03:43:29
$sor = mysql_query("SELECT * FROM siparisler Where moid LIKE ".'%'.$moid.'%'." ORDER BY id asc");sor kısmı böyle olmalı, orda bir yazım hatası var gibi geldi bana. - 30-10-2023, 00:58:31
<?php include_once("ayarlar.php"); $moid = $_POST["moid"]; if ($moid != "") { $baglanti = new mysqli($host, $kullanici, $sifre, $veritabani); if ($baglanti->connect_error) { die("Bağlantı hatası: " . $baglanti->connect_error); } $moid = $baglanti->real_escape_string($moid); $sorgu = "SELECT * FROM siparisler WHERE moid LIKE '$moid%' ORDER BY id ASC"; $sonuc = $baglanti->query($sorgu); if ($sonuc->num_rows > 0) { while ($row = $sonuc->fetch_assoc()) { $moid = $row["moid"]; $tarih = $row["tarih"]; echo "moid: $moid<br>"; echo "tarih: $tarih<br>"; } } else { echo "Sonuç yok."; } $baglanti->close(); } else { echo "Mod gir."; } ?>