marcis Posted January 23, 2009 Report Share Posted January 23, 2009 Ir radusies tāda interesanta lieta - tiek izpildīts mysql_query(), kas satur itkā korektu kveriju, bet tas nenostrādā. Kods: $sql="UPDATE `tabula` SET lauks='vertiba' WHERE id=X"; mysql_query($sql)or die(mysql_error()); echo $sql."\n"; echo mysql_affected_rows()."\n"; Izvade: UPDATE `tabula` SET lauks='vertiba' WHERE id=X 1 Itkā viss notiek, bet nekas netiek apdeitots. Kā varētu debug'ot šādu problēmu? Link to comment Share on other sites More sharing options...
Klez Posted January 23, 2009 Report Share Posted January 23, 2009 $sql = "select lauks from tabula where id=X"; $up = "UPDATE `tabula` SET lauks='vertiba' WHERE id=X"; $pirms = mysql_query($sql); mysql_query($up); echo mysql_affected_rows()."\n"; $peec = mysql_query($sql); $pirms1 = mysql_fetch_array($pirms); echo $pirms1['lauks']; $peec1 = mysql_fetch_array($peec ); echo $peec1['lauks']; Link to comment Share on other sites More sharing options...
marcis Posted January 23, 2009 Author Report Share Posted January 23, 2009 (edited) Klez, Tu domā, ka pats es izdomāju, ka ieraksts netiek izmainīts? Loģiski, ka pirms un pēc pārbaudes tika izvadītas. Error's nav, mysql_affected_rows() atgriež, ka 1 ieraksts ticis izmainīts, taču dati, kurus satur ieraksts, ir tādi paši kā pirms UPDATE kverija. Edited January 23, 2009 by marcis Link to comment Share on other sites More sharing options...
Klez Posted January 23, 2009 Report Share Posted January 23, 2009 un ja to kveriiju palaizh pa taisno mysql konsolee ? Link to comment Share on other sites More sharing options...
marcis Posted January 23, 2009 Author Report Share Posted January 23, 2009 Pie konsoles šobrīd netieku. Link to comment Share on other sites More sharing options...
bubu Posted January 23, 2009 Report Share Posted January 23, 2009 Nelieto kautkādus dīvainus mysql wraperus? Moš tev tur kautkāda transakcija ir ieslēgta, kas nav nokomitota (vai nu kā savādāk tas tur mysql'ā saucās) Link to comment Share on other sites More sharing options...
marcis Posted January 23, 2009 Author Report Share Posted January 23, 2009 Nē, jo phpmyadmin'ā un konsolē notiek tieši tas pats. Link to comment Share on other sites More sharing options...
bubu Posted January 23, 2009 Report Share Posted January 23, 2009 Varbūt stulbs jautājums - bet vai tu esi drošs, ka lauka "lauks" vecā vērtība atšķirās no jaunās vērtības? Moš vislaik tu centies vienu un to pašu rakstīt pāri tādai pašai vertībai. Kā ar UPDATE uz to pašu WHERE nosacījumu, bet tik cita lauka vērtības mainīšanai? Tas strādā? Link to comment Share on other sites More sharing options...
yuppio Posted January 24, 2009 Report Share Posted January 24, 2009 bubu: Imho, ja mēģina setot tādu pašu vērtību kāda jau ir attiecīgajam ierakstam, tad mysql_affected_rows() būtu jāatgriež 0. Link to comment Share on other sites More sharing options...
bubu Posted January 24, 2009 Report Share Posted January 24, 2009 Jā, tev taisnība. Link to comment Share on other sites More sharing options...
Klez Posted January 26, 2009 Report Share Posted January 26, 2009 marcis, uz diska vieta pietiek ? pameegini uztaisiit jaunu db, jaunu tabulu un jaunaa tabulaa to kveriju palaist, varbuut ir tev iespeeja uz cita datora to pashu db palaist ... veel var mysql serverim iestatiit lai logo visus pieprasiijumus un sasleegt debugoshanu ... Link to comment Share on other sites More sharing options...
marcis Posted January 26, 2009 Author Report Share Posted January 26, 2009 Tiku pie konsoles un restartēju mysql, viss aizgāja. Kaut ko tādu es pirmo reizi redzēju. Link to comment Share on other sites More sharing options...
Recommended Posts