• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1156
  • Last Modified:

PHP - SQL LIKE problem

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
andyw27
Asked:
andyw27
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Tickets.Subject LIKE \"%$data%\"
0
 
cforantCommented:
Tickets.Subject LIKE \"%" . $data . "%\"
0
 
cforantCommented:
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
 
andyw27Author Commented:
Thanks - that has worked great.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now