Another new PHP programmer question...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Thank you for your help previously everyone, I was able to fix that problem.
The thing now, is that I want to add smileys to the messages; i.e. :) would
equal to a smiley image when posting a message.

$con = mysql_connect("localhost","removed","removed") or die("con");
$db = mysql_select_db("ben_test") or die("db");

$post = $_POST['comment'];

if(empty($post)){
echo "<font color='red'><b>Post rejected, field left empty<br
/></b></font>";
}
else if(is_numeric($post)){
echo "<font color='red'><b>Post rejected, numeric data submitted<br
/></b></font>";
}
else if(preg_match("/www/", $post)) {
echo "<font color='red'><b>Post rejected. Advertising is prohibited!<br
/></b></font>";
}

else {
mysql_query("INSERT INTO `comments`(`messages`) VALUES ('$post')") or
die(mysql_error());
}

$mysql_query_one = mysql_query("SELECT * FROM `comments`");
while($rows=mysql_fetch_array($mysql_query_one)) {
echo $rows['messages'] . "<hr>";

I have grasped quite a lot so far, and added many complementry features,
however this is only my first script - so hence it is pretty much basic as
it is!

Thanks once again, hoping someone can assist me further.

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux