vitao.web Posted February 16, 2010 Report Share Posted February 16, 2010 Esmu iesacejs, tadel nelamajaties un nesmejaties, bet palidziet :) <?php define("KEY", true); #error_reporting(~E_ALL); require('../configs/config.php'); ?> <?php $name = mysql_real_escape_string($_POST['nosaukums']); $author = mysql_real_escape_string($_POST['autors']); $message = mysql_real_escape_string($_POST['raksts']); $class = mysql_real_escape_string($_POST['sadala']); $ip = $_SERVER['REMOTE_ADDR']; if (!isset($_POST['txtName'])) { $query = "SELECT id, nosaukums, autors, sadala, raksts, DATE_FORMAT(date, '%e/%m/%Y %H:%i') as newdate FROM zinas ORDER BY id DESC"; $result = mysql_query($query); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>tests</title> </head> <body> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <label for="Nosaukums">Nosaukums: </label> <input type="text" title="Nosaukums" name="Nosaukums" size="36" /><br> <label for="Nosaukums">Autors: </label> <input type="text" title="autors" name="autors" size="36" /><br> <label for="Nosaukums">Sadaļa </label> <select size="1" name="sadala"> <option>Jaunumi</option> <option>Spēļu apraksti</option> <option>Par komandu</option> <option>Galerija</option> </select> <label for="raksts">Raksts: </label> <textarea title="Raksts" name="raksts"></textarea> <br> <label title="Pievienot"> <input type="submit" value="Pievienot" /></label> </form> <?php } elseif (empty($name)) { echo "Ievadi raksta nosaukumu! Pēc 5 sekundēm mēģini vēlreiz. <meta http-equiv='refresh'content='5';>"; } elseif (empty($message)) { echo "Ievadi rakstu!<br> Pēc 5 sekundēm mēģini vēlreiz. <meta http-equiv='refresh'content='5';>"; } else { $query = "INSERT INTO zinas SET raksts='$message',autors'$author', nosaukums='$name', sadala='$class', date=NOW(), ip='$ip'"; echo "Ieraksts tika veiksmīgi pievienots!"; $result = mysql_query($query); } ?> </body> </html> Link to comment Share on other sites More sharing options...
yeahz Posted February 16, 2010 Report Share Posted February 16, 2010 Jauki, jauki. Man arī patīk tas kods. :) Link to comment Share on other sites More sharing options...
vitao.web Posted February 16, 2010 Author Report Share Posted February 16, 2010 Jauki, jauki. Man arī patīk tas kods. :) Bet kur ir ta klume? Neesmu kadu pareizi nodefinejis vai ari ieks <form> kaut kas nepareizi? Link to comment Share on other sites More sharing options...
chizijs Posted February 16, 2010 Report Share Posted February 16, 2010 Un kāds ir errors? Link to comment Share on other sites More sharing options...
vitao.web Posted February 16, 2010 Author Report Share Posted February 16, 2010 Un kāds ir errors? errors principa nekads vienkarsi, ka izdarot to zinas pieivenosanu, ta uzreiz AppServer pakaras... don't send ... hvz :( Link to comment Share on other sites More sharing options...
briedis Posted February 16, 2010 Report Share Posted February 16, 2010 Stilīga insert sintakse :) INSERT INTO zinas SET raksts='$message',autors'$author', nosaukums='$name', sadala='$class', date=NOW(), ip='$ip' Pameklē gūglē kā tad īsti rakstās INSERT kvērijs ;) Link to comment Share on other sites More sharing options...
chizijs Posted February 16, 2010 Report Share Posted February 16, 2010 mysql_query("INSERT INTO zinas(raksts, autors..) VALUES('$message', '$author'..)"); Link to comment Share on other sites More sharing options...
vitao.web Posted February 16, 2010 Author Report Share Posted February 16, 2010 mysql_query("INSERT INTO zinas(raksts, autors..) VALUES('$message', '$author'..)"); Un vai varetu sadu pasu mazu piemerinu ar select ? :) Tad man jau dzive bus daudz skaidraka :) Link to comment Share on other sites More sharing options...
chizijs Posted February 16, 2010 Report Share Posted February 16, 2010 mysql_query("SELECT * FROM zinas") or die(mysql_error()); Link to comment Share on other sites More sharing options...
briedis Posted February 16, 2010 Report Share Posted February 16, 2010 (edited) vitao.web, nezini tādu feinu adresīti www.google.com? :) Edited February 16, 2010 by briedis Link to comment Share on other sites More sharing options...
vitao.web Posted February 16, 2010 Author Report Share Posted February 16, 2010 Zinu zinu, bus japaskatas :) Paldies par palidzibu ! Link to comment Share on other sites More sharing options...
xPtv45z Posted February 16, 2010 Report Share Posted February 16, 2010 Vispār jau tas insert nav nekas nepareizs - http://dev.mysql.com/doc/refman/5.0/en/insert.html Link to comment Share on other sites More sharing options...
briedis Posted February 16, 2010 Report Share Posted February 16, 2010 Vispār jau tas insert nav nekas nepareizs - http://dev.mysql.com/doc/refman/5.0/en/insert.html Hehe, toč :D (pieļāvu tādu iespēju, bet pašam bija slinkums pārbaudīt) Nu vo, es ar kaut ko iemācījoš šodien :D Link to comment Share on other sites More sharing options...
waplet Posted February 16, 2010 Report Share Posted February 16, 2010 LOl man jau prikolē :D 13 posti un notiem neviens nav viņam palīdzejis :D btw.. error.log neko nerāda :? uzliec appserv 2.5.8 tas ir viss stabilākais Link to comment Share on other sites More sharing options...
vitao.web Posted February 16, 2010 Author Report Share Posted February 16, 2010 LOl man jau prikolē :D 13 posti un notiem neviens nav viņam palīdzejis :D btw.. error.log neko nerāda :? uzliec appserv 2.5.8 tas ir viss stabilākais Ja samaisija man te galvu ar to "nepareizo" INSERT utt :D Bet paldies waplet soreiz tu biji trapijis 10tnieka... uzliku tavu doto appserv versiju un viss iet :))) Super :D Link to comment Share on other sites More sharing options...
Recommended Posts