Re: [PHP-DB] SELECT LIKE with % and without %

2010-02-24 Thread Ahmet Caner

Eleonora De Marinis eleonora.demari...@garr.it, haber iletisinde sunlari 
yazdi:49fe92d0.2060...@garr.it...
 $sql = SELECT * FROM table WHERE ID ='$_GET[id]' AND title LIKE
 '%$_GET[word]%';



  Original Message  
 Subject: [PHP-DB] SELECT LIKE with %' and without %'
 From: Emiliano Boragina emiliano.borag...@gmail.com
 To: php-db@lists.php.net
 Date: 05/03/2009 01:43 AM
 Hello.

 I am using this:
 $sql = SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE
 '%$_GET[word]%';

 But I want exactlu ID, not one part of many possibles Ids in the DB.
 How can I do that?

 Thanks

 + 
 _
// Emiliano Boragina _
// Diseño  Comunicación //
 + 
 _
// emiliano.borag...@gmail.com  /
// 15 40 58 60 02 ///
 + 
 _



 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SELECT LIKE with % and without %

2009-05-04 Thread Eleonora De Marinis

$sql = SELECT * FROM table WHERE ID ='$_GET[id]' AND title LIKE
'%$_GET[word]%';



 Original Message  
Subject: [PHP-DB] SELECT LIKE with %' and without %'
From: Emiliano Boragina emiliano.borag...@gmail.com
To: php-db@lists.php.net
Date: 05/03/2009 01:43 AM

Hello.

I am using this:
$sql = SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE
'%$_GET[word]%';

But I want exactlu ID, not one part of many possibles Ids in the DB.
How can I do that?

Thanks

+  _
   // Emiliano Boragina _
   // Diseño  Comunicación //
+  _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+  _
  





Re: [PHP-DB] SELECT LIKE with % and without %

2009-05-04 Thread Philip Thompson

On May 2, 2009, at 6:43 PM, Emiliano Boragina wrote:


Hello.

I am using this:
$sql = SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE
'%$_GET[word]%';

But I want exactlu ID, not one part of many possibles Ids in the DB.
How can I do that?


PLEASE tell me your cleaning that input...

http://php.net/mysql_real_escape_string

And to answer your question:

?php
$id = mysql_real_escape_string ($_GET['id']);
$word = mysql_real_escape_string ($_GET['word']);

$sql = SELECT * FROM `table` WHERE `ID` = '$id' AND `title` = '$word';
?

Read more on MySQL's LIKE functionality. Google can help you.

HTH,
~Philip

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] SELECT LIKE with % and without %

2009-05-02 Thread Emiliano Boragina
Hello.

I am using this:
$sql = SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE
'%$_GET[word]%';

But I want exactlu ID, not one part of many possibles Ids in the DB.
How can I do that?

Thanks

+      _
   // Emiliano Boragina _
   // Diseño  Comunicación //
+      _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+      _


Re: [PHP-DB] SELECT LIKE with % and without %

2009-05-02 Thread mrfroasty
Emiliano Boragina wrote:
 Hello.

 I am using this:
 $sql = SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE
 '%$_GET[word]%';
   
This doesnt work?

$sql = SELECT * FROM table WHERE ID='some_id' AND title='some_title';



-- 
Extra details:
OSS:Gentoo Linux
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://mambo-tech.net
url:http://blog.mambo-tech.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php