Jump to content

Script Php Comentarii (comment Script)


Recommended Posts

Posted

Daca doriti un script pentru comentarii, ceva in genul:

4343434343434343434343.png

Creati mai intai o pagina, spre exemplu index.php in care introduceti:

<?php
die("Pagina selectata nu exista!");
                        }
else {

 echo "<center><h1>Hello on page one !</h1></center><br /><br />";

   //Extragem din DB
   $query1="SELECT * FROM comment WHERE commentid='1'";
   $sql1=mysql_query($query1);
   while ($row=mysql_fetch_row($sql1)) {
         echo "<br />".$row[1]."<br />";
                                        } }
?>

<br /><br /><b>Lasa si tu un comentariu !</b><br />
<form action="?" method="post">
Username: <input type="text" name="username"><br />
Comentariu: <textarea name="comment" rows="4" cols="30"></textarea><br />
<input type="submit" name="submit" value="Spune!" /><br />



<?php mysql_close($conexiune); ?>[/code] Dupa aceea aven nevoie de o pagina [color=orange][b]connect.php[/b][/color], spre exemplu, prin care se va face conectarea la baza de date, in care introduceti:
[code]<?php
$hostname="localhost";
$username="username";
$password="password";
$database="bazadedate";

$conexiune=mysql_connect($hostname, $username, $password)
or die ("eroare !");

$bazadate=mysql_select_db($database, $conexiune)
or die ("eroare !");
?>
Dupa crearea acestor 2 fisiere, mai aveti de facut doar tebelul in baza de date:
<?php
include "connect.php";

$table="CREATE TABLE comment (
id int(3) NOT NULL AUTO_INCREMENT,
comentariu varchar(450) NOT NULL ,
commentid int(200) NOT NULL ,
PRIMARY KEY (id)) TYPE=MyISAM";
if(mysql_query($table)){
echo "Tabelul a fost creat";
}
else{
echo "Tabelul nu a fost creat";
}
?>
[/code]

Succes :pct:

Te-ai inregistrat? Ne-ar placea sa te prezinti.

Cum pot sustine forumul?
Cumpara de la eMag folosind acest link.
--------------------
oG2BN9d.gifse1WdXd.gifQG6MtmI.gifRHYjDzD.gifG5p1wui.gif

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.