|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have the following search:
$query = 'SELECT `brand`, `model`, `price` FROM `return_price` WHERE `model` LIKE CONVERT(_utf8 \'%1600%\' USING latin1) COLLATE latin1_swedish_ci'; This works perfectly. However I would need to edit the 1600 and have it as a variable $gsmcode in php I have tried various combinations of the signs `'"(\ and what not, yet it does not seem the be in the right order. e.g. CONVERT(_utf8 \'%{$gsmcode}%\' USING latin1) does not give me anything. neither does CONVERT(_utf8 \'%{$gsmcode}%\' USING latin1) CONVERT(_utf8 \'%'{$gsmcode}'%\' USING latin1) does not show the page at all. And so I have tried plenty more. What is the correct format to use? A search on google unfortunatly did not result in the solution, so perhaps I was looking for the wrong info. houghi -- At the source of every error which is blamed on the computer you will find at least two human errors, including the error of blaming it on the computer. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
houghi wrote:
> I have the following search: > $query = 'SELECT `brand`, `model`, `price` FROM `return_price` > WHERE `model` LIKE CONVERT(_utf8 \'%1600%\' USING latin1) COLLATE > latin1_swedish_ci'; > > This works perfectly. However I would need to edit the 1600 and have > it > as a variable $gsmcode in php > > I have tried various combinations of the signs `'"(\ and what not, yet > it does not seem the be in the right order. > > e.g. CONVERT(_utf8 \'%{$gsmcode}%\' USING latin1) does not give me > anything. neither does > CONVERT(_utf8 \'%{$gsmcode}%\' USING latin1) > CONVERT(_utf8 \'%'{$gsmcode}'%\' USING latin1) does not show the page > at > all. And so I have tried plenty more. > > What is the correct format to use? A search on google unfortunatly did > not result in the solution, so perhaps I was looking for the wrong > info. > > houghi Try: $query = "SELECT `brand`, `model`, `price` FROM `return_price` WHERE `model` LIKE CONVERT(_utf8 '%{$gsmcode}%' USING latin1) COLLATE latin1_swedish_ci"; |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Paul Lautman wrote:
> Try: > $query = "SELECT `brand`, `model`, `price` FROM `return_price` > WHERE `model` LIKE CONVERT(_utf8 '%{$gsmcode}%' USING latin1) COLLATE > latin1_swedish_ci"; Thanks. That worked. Sometimes I just look to hard. houghi -- At the source of every error which is blamed on the computer you will find at least two human errors, including the error of blaming it on the computer. |
|
![]() |
| Outils de la discussion | |
|
|