Autor | Zpráva | ||
---|---|---|---|
RepporeLLo Profil |
#1 · Zasláno: 6. 4. 2006, 18:23:31
tot je skript s clankami:
.----------------------------- <?php require_once ('mysql_spojit.php'); $titul = '...:::Články!:::...'; include ('sablony/head.inc'); include ('sablony/menu.inc'); @$v = mysql_query("SELECT id_cl, nazov_cl, autor_cl, text_cl, datum_cl FROM clanky ORDER BY id_cl DESC LIMIT 0,8"); @$p = mysql_num_rows($v); if ($p > 0): echo "<div align=center><h1>Články</h1><table width=600 border=0>"; while ($z = mysql_fetch_row($v)) { echo " <tr> <td colspan=3 width=600 bgcolor=#C8C8C8><p><h1>$z[1]</h1> <hr width=600>$z[3]</p></td> </tr> <tr> <td width=250 height=18 bgcolor=#000000><font color=white>autor: <b>$z[2]</b></font></td> <td width=170 height=18 bgcolor=#000000><div align=center><a href=\"komentare.php?id_clanku=$z[0]\">komentáre</a></div></td> <td width=180 height=18 bgcolor=#000000><div align=center><font color=white><b>$z[4]</b></font></div></td> </tr> <tr><td height=18 bgcolor=#ffffff colspan=2></td></tr>"; } echo "</table>\n"; endif; echo "</div>\n"; include ('sablony/bottom.inc'); ?> ---------------------------------------------------------------- toto je skript s komentarmi: ---------------------------------------------------------------- <?php session_name('IDUzivatela'); session_start(); $titul = '...:::Komentáre!:::...'; include('sablony/head.inc'); include('sablony/menu.inc'); require "mysql_spojit.php"; ?> <div align="center"><center> <h1>Komentáre</h1> <table border="0" width="570"> <tr> <td><div align="center"><center> <table border="0"> <form action="komentare.php" method="post"> <input type="hidden" name="send" value="true"> <tr> <td bgcolor="#c8c8c8"><strong>Text:</strong></font></td> <td bgcolor="#000000"><strong><textarea name="text_komentara" rows="3" cols="45"></textarea></strong></font></td> </tr> <tr> <td colspan="2" bgcolor="#c8c8c8"><center><input type="submit" value="Pridať -->"></center> <?php echo("<input type=\"hidden\" name=\"id_clanku\" value=\"". $_GET['id_clanku'] ."\">"); ?> </td></form> </tr> </table> </center></div></td> </tr> </table> </center> </div> <hr size="3" noshade width="600"> <? if (isset($send)) { if ($text_komentara != "" && $nazov_komentara != "") { $text_komentara = HTMLSpecialChars ($text_komentara); $nazov_komentara = HTMLSpecialChars ($nazov_komentara); @$f = mysql_query("INSERT INTO komentare VALUES('','". $_POST['id_clanku'] ."', '". $_SESSION["nick"] ."', '". $text_komentara ."', '". NOW() . "')"); } else { echo (mysql_error()); } } @$v = mysql_query ("SELECT * FROM komentare WHERE id_clanku = '".$_GET['id_clanku']."' ORDER BY id_komentara DESC LIMIT 0,20"); @$p = mysql_num_rows ($v); if ($p > 0): echo "<div align=center><center><table border=0 width=600>"; while ($z = mysql_fetch_row($v)) { echo "<tr><td bgcolor=#000000 width=200 height=18><strong>"; echo "<font color=\"white\">$z[2]</font></td>"; echo "<td bgcolor=#000000 width=200 height=18><p align=center><font color=white>$z[4]</font></p></td></tr><tr><td bgcolor=#C8C8C8 colspan=2><strong>$z[3]</strong></td></tr><tr><td height=18 colspan=2></td></tr>"; } echo "</table>\n"; endif; include('sablony/bottom.inc'); ?> ---------------------------------------------------------------------- --------------- a toto je tabulka s komentarmi: ---------------------------------------------------------------------- --------------- CREATE TABLE komentare ( id_komentara int(9) USIGNED NOT NULL auto_increment, id_clanku int(4) USIGNED NOT NULL, autor_komentara varchar(25) NOT NULL, text_komentara text NOT NULL, cas_komentara datetime NOT NULL, PRIMARY KEY (id_komentara) ); ---------------------------------------------------------------------- -------------------------------------------------------- a problem je ten ze mi nejako nefunguje ten prikaz insert a nevkalda mi komentare do DB... ked komentare vlozim manulane tak ich bez problemov zobrazi...... takze chyba bude v tom vkladani...... a viete kde je chyba tak prosiiiiiiiiiim napiste |
||
RepporeLLo Profil |
#2 · Zasláno: 6. 4. 2006, 18:24:47
ten insert som uz skusal aj takto:
@$f = mysql_query ("INSERT INTO komentare VALUES('','".$_POST[id_clanku]."','{$_SESSION['nick']}','$text_komenta ra','NOW()')"); |
||
djlj Profil |
#3 · Zasláno: 6. 4. 2006, 18:34:16
Možná bys mohl napsat, co ti vyhodí MySQL za chybu.
echo mysql_error(); |
||
Časová prodleva: 17 let
|
Toto téma je uzamčeno. Odpověď nelze zaslat.
0