Another new PHP programmer question...
| From: | Ben Stones | Date: | Thu, 03 Jan 2008 08:56:58 +0000 |
| Subject: | Another new PHP programmer question... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-44476@lists.php.net to get a copy of this message | ||
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.