Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP - SQL LIKE problem

Posted on 2007-12-03
4
Medium Priority
?
1,151 Views
Last Modified: 2013-12-12
I have an SQL statement that setup like this:

Tickets.Subject LIKE \"%value1%\"

I wish to change this so that it uses a variable called $data

Is this possible.
0
Comment
Question by:andyw27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20395864
Tickets.Subject LIKE \"%$data%\"
0
 
LVL 3

Accepted Solution

by:
cforant earned 2000 total points
ID: 20395867
Tickets.Subject LIKE \"%" . $data . "%\"
0
 
LVL 3

Expert Comment

by:cforant
ID: 20395887
you should look something like this

$sql = "select * from table where tickets.subject like \"%" . $data . "%\";
or
$sql = "select * from table where tickets.subject like '%" . $data . "%'";


0
 

Author Closing Comment

by:andyw27
ID: 31412337
Thanks - that has worked great.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question