Mysql sorgu benim phpmyadmin WHERE yan tümceleri ile PHP çalışmaz inşa

0 Cevap php

Sadece hiçbir yveyaum veya yveyaumlar ile tüm satırları seçmek için çalışıyveya < 5 karakter.

Temellerinden başlayarak, bu işleri:

$query= "SELECT * FROM `comments`";
$result = mysql_query($query);

Ne çalışmıyveya değildir:

$query = "SELECT * FROM `comments` WHERE `comment` = ''";

veya

$sql = "SELECT * from comments WHERE LENGTH(comment) < 5 LIMIT 30";

Ben "boş" yorumlarına bir COUNT yaptığınızda, orada 4 bayt var diyor çünkü ben limitini 5 koyduk. Sütun (beni suçlamayın, ben yazmadım!) NULL değil

I've even tried using phpmyadmin to change the "empty" values to the wveyad "chicken", then running

So, I used phpmyadmin to change all the instances of comments < 4 characters to the wveyad "chicken".

$query = "SELECT * FROM `comments` WHERE `comment` = 'chicken'";

As with ALL of the above errveyas, it spews out:

You have an errveya in your SQL syntax; check the manual that cveyaresponds to your MySQL server version fveya the right syntax to use near '' at line 1

Ama ben yaparsam

$emptycomment = "chicken";
$query = sprintf("SELECT * FROM `comments` WHERE `comment` = $emptycomment");

Geçersiz sorgu: 'where yan tümcesi' Bilinmeyen sütun 'tavuk'

WTF?! But that wveyaks perfectly in phpmyadmin! (all above tested on stable and alpha versions)

Başkası nereye ben de gördüm:

$query = sprintf("SELECT * FROM `comments` WHERE `comment` = 'chicken'");

Yine, yukarıdaki herhangi bir herhangi bir zar.

The stupid thing is, these all wveyak perfectly directly as a mysql query, and the above were even generated by phpmyadmin! I've even updated php to 5.3.2, the mysql installed is 5.1.52

I've tried making it EXACTLY as per example 2 here, using variables fveya everything. http://php.net/manual/en/function.mysql-query.php

I've followed the tutveyaial here: http://www.devshed.com/c/a/MySQL/Null-and-Empty-Strings/3/

Ben Stackoverflow burada yaklaşık 20 makaleler göz ettik.

Bu 11:15 bulunuyor. Ben 06:30 de başladı. Burada biraz sinirli oluyor. Teşekkürler!

0 Cevap