Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 no query result in" LIKE %value%"

Author  Topic 

leracj
Starting Member

13 Posts

Posted - 2013-06-24 : 02:00:10
$s.=" um.meta_value LIKE '$stxt' AND";

-works if it is specific

$s.=" um.meta_value LIKE '$stxt' AND";

(stxt = %% it will display all)

but when

(stxt=%d%)

it won't display any query

please help

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-24 : 02:16:27
%d% will only return data with letter d in it. is it what you're after?

perhaps what you're looking at is numeric pattern in data in which case it should be
(stxt=%[0-9]%)



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-06-24 : 02:28:10
Duplicate thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=186355

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-24 : 02:29:54
quote:
Originally posted by bandi

Duplicate thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=186355

--
Chandu


Not exactly a duplicate as other thread was on parameter definition in php

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

leracj
Starting Member

13 Posts

Posted - 2013-06-24 : 02:35:10
quote:
Originally posted by visakh16

%d% will only return data with letter d in it. is it what you're after?

perhaps what you're looking at is numeric pattern in data in which case it should be
(stxt=%[0-9]%)



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs





im trying to load queries
%% result: http://screencast.com/t/toZTEBUE05
%t% relult: http://screencast.com/t/7u3wq0zDtH

please help
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-24 : 02:36:37
quote:
Originally posted by leracj

quote:
Originally posted by visakh16

%d% will only return data with letter d in it. is it what you're after?

perhaps what you're looking at is numeric pattern in data in which case it should be
(stxt=%[0-9]%)



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs





im trying to load queries
%% result: http://screencast.com/t/toZTEBUE05
%t% relult: http://screencast.com/t/7u3wq0zDtH

please help


sorry cant view those links here as they're blocked

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-24 : 02:38:07
Which field you want to serach it against?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-06-24 : 02:42:39
quote:
Originally posted by leracj

$s.=" um.meta_value LIKE '$stxt' AND";

-works if it is specific

$s.=" um.meta_value LIKE '$stxt' AND";

(stxt = %% it will display all)

but when

(stxt=%d%)
it won't display any query
please help


http://stackoverflow.com/questions/3603652/using-php-variable-in-mysql-like
ex: PHP code to use SELECT statement along with LIKE search
$query .= "select * from emp WHERE Name LIKE '%" . mysql_real_escape_string($SearchName) . "%'";
$result = mysql_query($query);

EDIT: http://stackoverflow.com/questions/4012987/how-write-dynamic-query-staring-using-php
--
Chandu
Go to Top of Page

leracj
Starting Member

13 Posts

Posted - 2013-06-24 : 03:07:02
quote:
Originally posted by leracj

$s.=" um.meta_value LIKE '$stxt' AND";

-works if it is specific

$s.=" um.meta_value LIKE '$stxt' AND";

(stxt = %% it will display all)

but when

(stxt=%d%)

it won't display any query

please help





i just answered my post again

(stxt=%%d%%) - works fine...

please help
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-24 : 03:51:05
quote:
Originally posted by leracj

quote:
Originally posted by leracj

$s.=" um.meta_value LIKE '$stxt' AND";

-works if it is specific

$s.=" um.meta_value LIKE '$stxt' AND";

(stxt = %% it will display all)

but when

(stxt=%d%)

it won't display any query

please help





i just answered my post again

(stxt=%%d%%) - works fine...

please help


Glad that you got it sorted
Thanks for sharing the final solution

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -