Re: Probleme with MySQL queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bonjour,

I have print and it's OK, the query is good like if I put the value
directly in the query

Cordialement,

David DURIEUX
Tel : 04.74.04.81.34
Port : 06.34.99.45.18
Mail : d.durieux@xxxxxxxxxxxxx
Site Web : http://www.siprossii.com/

SIPROSSII
847 route de Frans (Créacité)
69400 Villefranche sur Saône



Le Wed, 3 Sep 2008 17:17:51 +0800
"Kendo Tom" <kendotom@xxxxxxx> a écrit:

>Hi ,
>
>        For this situation , you should print out the SQL statement to
> check 
>the value of the variable "$var" .
>
>--------------------------------------------------
>From: "David DURIEUX" <d.durieux@xxxxxxxxxxxxx>
>Sent: Wednesday, September 03, 2008 5:07 PM
>To: <php-db@xxxxxxxxxxxxx>
>Subject:  Probleme with MySQL queries
>
>> Hello
>>
>> There is a problem when I select a line in mysql table and afet I
>> delete it.
>>
>>
>> 1/ It works :
>> $sql = 'SELECT * FROM table WHERE id="10" ';
>> $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="10" ';
>> $req2 = mysql_query($sql2) or die('Erreur SQL
>> !<br>'.$sql2.'<br>'.mysql_error());
>>
>> 2/ It don't work :
>>
>> $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());
>>
>>
>> Results of this queries :
>>
>> In first case (it works) : I see the id get in mysql and it delete it
>> after
>>
>> In second case (it don't work) : I don't see id get in mysql. It's
>> like if it delete it first and after select.
>>
>> I have not error in php log.
>>
>>
>> If somebody can help me, because I try since few hours...
>>
>>
>> Best regards,
>>
>> David DURIEUX
>> Tel : +33 (0)4.74.04.81.34
>> Port : +33 (0)6.34.99.45.18
>> Mail : d.durieux@xxxxxxxxxxxxx
>> Site Web : http://www.siprossii.com/
>>
>> SIPROSSII
>> 847 route de Frans (Créacité)
>> 69400 Villefranche sur Saône
>>
>>
>> -- 
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> 
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux