Re: Probleme with MySQL queries
| From: | David DURIEUX | Date: | Wed, 03 Sep 2008 09:35:33 +0000 |
| Subject: | Re: Probleme with MySQL queries | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-45311@lists.php.net to get a copy of this message | ||
Bonjour,
No changes :/
I have always the same things
Cordialement,
David DURIEUX
Tel : 04.74.04.81.34
Port : 06.34.99.45.18
Mail : d.durieux@siprossii.com
Site Web : http://www.siprossii.com/
SIPROSSII
847 route de Frans (Créacité)
69400 Villefranche sur Saône
Le Wed, 3 Sep 2008 11:29:29 +0200
"Evert Lammerts" <evert.lammerts@gmail.com> a écrit:
>Did you actually echo the $sql?
>
>I know it works right now, but try to take away the quotes around the
>value in the query and see if something happens:
>
>$sql = "SELECT * FROM table WHERE id={$var}";
>
>If that doesn't work then var_dump($sql, $var) and write us the
>result. Also let us know the data type of the ID column.
>
>On Wed, Sep 3, 2008 at 11:21 AM, David DURIEUX
><d.durieux@siprossii.com> wrote:
>> At the begining $var is $_GET['id'] and after I try directly $var =
>> 10 but no changes.
>>
>> On the server directly, I can only try with the values :
>> $sql = 'SELECT * FROM table WHERE id="10" '; and for this no problem.
>>
>> The problem is when I use a variable in query
>>
>>
>> Best regards,
>>
>> David DURIEUX
>> Tel : 04.74.04.81.34
>> Port : 06.34.99.45.18
>> Mail : d.durieux@siprossii.com
>> Site Web : http://www.siprossii.com/
>>
>> SIPROSSII
>> 847 route de Frans (Créacité)
>> 69400 Villefranche sur Saône
>>
>>
>>
>> Le Wed, 3 Sep 2008 11:13:11 +0200
>> "Evert Lammerts" <evert.lammerts@gmail.com> a écrit:
>>
>>>> $sql = 'SELECT * FROM table WHERE id="'.$var.'" ';
>>>> $req = mysql_query($sql) or die('Erreur SQL
>>>> !<br>'.$sql.'<br>'.mysql_error());
>>>> while($data = mysql_fetch_assoc($req)) {
>>>> echo $data['id'];
>>>> }
>>>> $sql2 = 'DELETE FROM table WHERE id="'.$var.'" ';
>>>> $req2 = mysql_query($sql2) or die('Erreur SQL
>>>> !<br>'.$sql2.'<br>'.mysql_error());
>>>
>>>I'll ask the obvious: where and how is $var set, and did you echo
>>>your $sql variable to try the query on your mysql server directly?
>>>
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>