FT3 Posted October 30, 2010 Report Share Posted October 30, 2010 vai kads varetu man pateiks kas ši ir pa kļudu ? 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 'from, text) VALUES ('1', '1', 'aaaa')' at line 1 kods ir tads ! <?function add(){ ?> <form action="" method="POST" > <textarea class="commFl" rows="8" cols="30" name="text"></textarea> <input type="submit" name="aiziet" value="Pievienot!"> </form> <?} if ($_POST['aiziet']) { $id = $_GET['id']; $from = $_SESSION['wID']; $text = $_POST['text']; if (($text != "")) { ?> <b>Done!</b> <? mysql_query("INSERT INTO message (id, from, text) VALUES ('$id', '$from', '$text') ") or die(mysql_error()); }}else{add();} ?> Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 30, 2010 Report Share Posted October 30, 2010 Raksti šitā: INSERT INTO message (`id`, `from`, `text`) ... Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 30, 2010 Author Report Share Posted October 30, 2010 tnx nostradaja :D Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 30, 2010 Author Report Share Posted October 30, 2010 vel viens jautajums ! Parse error: syntax error, unexpected T_VARIABLE in C:\AppServ\www\includes\message.php on line 2 $result = mysql_query("SELECT * FROM messages WHERE to = '"$_SESSION['wID']"' ORDER by id LIMIT 1"); Quote Link to comment Share on other sites More sharing options...
Code Posted October 30, 2010 Report Share Posted October 30, 2010 '".$_SESSION['wID']."' OR '{$_SESSION['wID']}' Quote Link to comment Share on other sites More sharing options...
waplet Posted October 30, 2010 Report Share Posted October 30, 2010 php variabļu konkatenācijas simbols ir . vai , '".$_SESSION['wID']."' Quote Link to comment Share on other sites More sharing options...
briedis Posted October 30, 2010 Report Share Posted October 30, 2010 derētu arī palasīt par sql inkjekcijām (mysql_real_escape_string funkcija). Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 30, 2010 Author Report Share Posted October 30, 2010 Kļuda Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\includes\message.php on line 4 kods <?php $result = mysql_query("SELECT * FROM messages WHERE to = '{$_SESSION['wID']}' ORDER by id LIMIT 1"); while($row = mysql_fetch_array($result)) { echo $row['from'] . " " . $row['text']; echo "<br />"; } ?> Quote Link to comment Share on other sites More sharing options...
Code Posted October 30, 2010 Report Share Posted October 30, 2010 (edited) Tu te kopēsi visas kļūdas pēc kārtas, nemaz nepadomājot? Apskaties ar mysql_error() kas notika. Edited October 30, 2010 by Code Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 30, 2010 Author Report Share Posted October 30, 2010 hmm uzrada šo ;/ 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 'to = '1' ORDER by id LIMIT 1' at line 1 palidziet vel šo plizzz , vairs jautajumu nebus ;/ Quote Link to comment Share on other sites More sharing options...
Code Posted October 30, 2010 Report Share Posted October 30, 2010 (edited) Šito jau tev palīdzēja sākumā atrisināt - palasi te. Edited October 30, 2010 by Code Quote Link to comment Share on other sites More sharing options...
waplet Posted October 30, 2010 Report Share Posted October 30, 2010 ieliec to iekš `` Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 30, 2010 Author Report Share Posted October 30, 2010 tnx waplet :)) Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 30, 2010 Author Report Share Posted October 30, 2010 (edited) ka lai ustaisa lai refresh taisitos 2 reiz ? <meta http-equiv='refresh' content='javascript:location.reload(true)'> atrisinats :D Edited October 30, 2010 by FT3 Quote Link to comment Share on other sites More sharing options...
marcis Posted October 30, 2010 Report Share Posted October 30, 2010 (edited) waplet, komats nav php konkatenācijas simbols. Tikai punkts. Topika autoram links uz dokumentāciju: http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html Edited October 30, 2010 by marcis Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.