keksuss Posted July 21, 2006 Report Share Posted July 21, 2006 (edited) Neesmu 100% pārliwcināts, vai iepriekš kas tāds nav bijis, bet tomēr... Kods sekojošs: <?php include("../cms/config.php"); $id=$_POST['id']; $text = ($_POST['text']); $mod = ($_POST['mod']); mysql_query("UPDATE private SET text=('$text'), mod=('$mod') where id=$id"); echo("Ziņa labota!<br><a href=\"index.php?pageid=labot\">Atgriezties</a>"); ?> querijs negrib/nevar izpildīties! mainīgie ir teksti, kuri arī bāzē tiek likti lauciņos ar text tipu. Varbūt sintaksē kāda kļūda? Edited July 21, 2006 by keksuss Link to comment Share on other sites More sharing options...
koko Posted July 21, 2006 Report Share Posted July 21, 2006 (edited) es izņemtu iekavas, piemēram, text=('$text') pārtaisītu kā text='$text', un vēl labāk uztaisītu text='{$text}' vai text='".$text."'... un nafig tu visu iekavās liec? $text = ($_POST['text']) es arī pārtaisītu par $text = mysql_real_escape_string($_POST['text']); ak jā - un vēl pamēģini iz echo t to tavu kveriju, varbuut paraadaas kaut kas dīvains :) Edited July 21, 2006 by koko Link to comment Share on other sites More sharing options...
keksuss Posted July 21, 2006 Author Report Share Posted July 21, 2006 (edited) ak jā - un vēl pamēģini iz echo t to tavu kveriju, varbuut paraadaas kaut kas dīvains :) mēģināju jau iepriekš, nepalīdz! Edited July 21, 2006 by keksuss Link to comment Share on other sites More sharing options...
GedroX Posted July 21, 2006 Report Share Posted July 21, 2006 Mēģini tā: mysql_query('UPDATE private SET text="' . addslashes($text) . '", mod="' . addslashes($mod) . '" where id=' . (int)$id); Ja nepalīdz, tad apskaties, vai vispār pie mysql konektējas un uztaisi šim qurijam echo un iesveid to pa taisno MySQL. Vai tad tik grūti ir debagot savu kodu? :) Link to comment Share on other sites More sharing options...
keksuss Posted July 21, 2006 Author Report Share Posted July 21, 2006 (edited) Ja nepalīdz, tad apskaties, vai vispār pie mysql konektējas un uztaisi šim qurijam echo un iesveid to pa taisno MySQL. Nekā. Konnektēties konnektējas, bet apdeitot neapdeito! Edited July 21, 2006 by keksuss Link to comment Share on other sites More sharing options...
v3rb0 Posted July 21, 2006 Report Share Posted July 21, 2006 $sql = 'UPDATE private SET text="' . addslashes($text) . '", mod="' . addslashes($mod) . '" where id=' . (int)$id; echo $sql; un to iepastē te vai, pimērām, phpmyadminī. Link to comment Share on other sites More sharing options...
keksuss Posted July 21, 2006 Author Report Share Posted July 21, 2006 (edited) ko "to"? Edited July 21, 2006 by keksuss Link to comment Share on other sites More sharing options...
Delfins Posted July 21, 2006 Report Share Posted July 21, 2006 mēģināju jau iepriekš, nepalīdz! nu bāc, cilvēk, tev saka "uztaisi echo $sql".. protams nekādīgi nepalīdzēs izpildīt query, bet palīdzēs atrast kļūdu... un ieslēdz arī error_reporting() + izmanto mysql_error() Link to comment Share on other sites More sharing options...
keksuss Posted July 21, 2006 Author Report Share Posted July 21, 2006 UPDATE private SET text="cxqwefewr", mod="zfgrtg" where id=48 šito man izspļāva! Link to comment Share on other sites More sharing options...
andrisp Posted July 21, 2006 Report Share Posted July 21, 2006 Esi pārliecināts, ka tev tāds id ir ? Link to comment Share on other sites More sharing options...
keksuss Posted July 21, 2006 Author Report Share Posted July 21, 2006 (edited) Esi pārliecināts, ka tev tāds id ir ? toč zinu :) Edited July 21, 2006 by keksuss Link to comment Share on other sites More sharing options...
andrisp Posted July 21, 2006 Report Share Posted July 21, 2006 pamēģini echo mysql_error(); pēc tā pieprasījuma un paskaties ko izdod Link to comment Share on other sites More sharing options...
v3rb0 Posted July 21, 2006 Report Share Posted July 21, 2006 'text' takš ir mysql keywords. `text` = jāraksta Link to comment Share on other sites More sharing options...
kaszu Posted July 21, 2006 Report Share Posted July 21, 2006 (edited) Iepāstē, tad šito UPDATE private SET text="cxqwefewr", mod="zfgrtg" where id=48 iekš phpmyadmin (vai arī kādu programmu tu lieto) un pasties vai kaut ko izdod ārā, jo sintakse ir pareiza. Edit: Par vēlu iepostēju :) Pamegini, 'text' kaa verbo saka Edited July 21, 2006 by kaszu Link to comment Share on other sites More sharing options...
keksuss Posted July 21, 2006 Author Report Share Posted July 21, 2006 (edited) man rāda sintakses kļūdu! #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mod="zfgrtg" where id=48' at line 1 Edited July 21, 2006 by keksuss Link to comment Share on other sites More sharing options...
Recommended Posts