PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > variable data for a search
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
variable data for a search

Réponse
 
LinkBack Outils de la discussion
Vieux 05/11/2007, 10h56   #1
houghi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut variable data for a search

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.
  Réponse avec citation
Vieux 05/11/2007, 19h54   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: variable data for a search

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";




  Réponse avec citation
Vieux 05/11/2007, 20h20   #3
houghi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: variable data for a search

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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 21h33.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09381 seconds with 11 queries