...

View Full Version : how to perform this query ??



PHPycho
03-30-2007, 08:30 AM
Hello forums!!
Suppose i had the following table (with fields and values)
table1

-------------------------
|id | name | description |
-------------------------
| 1 | 12 name1 bla1 | desc1 |
| 2 | 13 name2 bla2 | desc2 |
|...so on
--------------------------

My question is: How to perform the query if i would like to fetch the row which matches the no (which is in conjuction with the name followed by space) with the passed no ie

$query = "SELECT * FROM `table1` WHERE [no part of the name ie 12] = [passed no ie 12]";
Any suggestions , tips are warmly welcome
Thanks in advance to all of you !!

Daemonspyre
03-30-2007, 03:18 PM
Try:



$query = "SELECT * FROM `table1` WHERE InStr(Name,'" + $var + "');"


$var = "12"

That will pull all records with "12" in the name

HTH!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum