For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > January 2008 > Another new PHP programmer question...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Another new PHP programmer question...
Ben Stones

2008-01-03, 4:00 am

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_que
ry_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.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com