...

View Full Version : Script problem



SRBuckey5266
10-13-2009, 09:29 PM
PLEASE NOTE: Line 42 = the line with: if ($message==) { - I just didn't include my CSS, which would make if ($message==) { 42.

My error:

Parse error: syntax error, unexpected ')' in /home/a5488351/public_html/post.php on line 42

My code:


<?php

$con = mysql_connect('', '', '') or die(mysql_errno());
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc())
{
$_POST = array_map('stripslashes', $_POST);
}

$name = mysql_real_escape_string($_POST['name']);
$message = mysql_real_escape_string($_POST['message']);

if ($message==) {
echo "<div class='box'><b><span style='color:red'>You didn't enter a message!</span></b></div>";
}
else
{
//connect
$connect = mysql_connect("","","") or die("Connection failed!");
mysql_select_db("") or die("Database fail!");

//write
$write = mysql_query("INSERT INTO posts VALUES ('','$name','$message')") or die(mysql_eror());

echo "<div class='box'><font face='arial'><b><span style='color:green'>Posted! Your name was:</span> $name</b> - Your message was....<br><br><b>$message - <a href='index.php'>View it!</a></b>";
}


?>

mlseim
10-13-2009, 09:47 PM
Just do this ... (no == )
if ($message) {

SRBuckey5266
10-13-2009, 09:50 PM
But now when I enter a message, it still shows that box. See: http://www.chataddict.netau.net - WHY?!

mlseim
10-13-2009, 09:54 PM
Try ...

if(strlen($message) < 1){

EDIT:

or ...

if(!$message){


either one might work.


.

SRBuckey5266
10-13-2009, 09:57 PM
Doesn't work. :confused:

Edit: Nope, neither work. :/

mlseim
10-13-2009, 11:06 PM
Repost your script, what you currently have now.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum