Current location: Hot Scripts Forums » Programming Languages » PHP » Script Help


Script Help

Reply
  #1 (permalink)  
Old 04-09-04, 08:39 PM
Fitzo Fitzo is offline
New Member
 
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Script Help

I run this script and i get a parse error? i cant seem to see why

code:

<?php
if (isset($addnews));
?>
<table align="center" cellspacing="1" cellpadding="0" width="415" border="1" bordercolor="#000000">
<tr>
<td class="td" background="images/v1.gif">
<center><b>Post News</b></center>
</td>
</tr>
<tr>
<td class="td">
<form action="<?php echo($PHP_SELF); ?>" method=post>
<P align="center"><strong>Write News Here</strong><BR>
<textarea name="news" class="form" rows="10" cols="40" wrap></textarea>
<BR>
<input type="submit" name="submit" Vvalue="SUBMIT">
</p>
</form>

<?php

else {

// Connect to the database server
$dbcnx = @mysql_connect("localhost", "root", "pass"); if (!$dbcnx) { echo( "<P>Unable to connect to the " . "database server at this time.</P>" ); exit(); }

// Select the database
if (! @mysql_select_db("db") ) { echo( "<P>Unable to locate the news" . "database at this time.</P>" ); exit(); }

// If a joke has been submitted, add it to the database.
if ("SUBMIT" == $submitnews) { $sql = "INSERT INTO news SET " . "title='$title', " . "date=CURDATE()" . "user='$user'" . "news='$news'"; exit(); }
}
?>
</td>
</tr>
</table>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 04-11-04, 01:51 AM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

You don't want to close if statement at line 2 yet. You need to start a code block there for if-true condition, so replace ; with { and place } (to close if block) before else {. HTH.
__________________
Blavv =|
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 04-11-04, 08:35 AM
Z-Paul Z-Paul is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Just to clear that up,

<?php
if (isset($addnews)) {
?>


And replace

else {

with

} else {
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with my largest perl script. Grabbing data from a file. Sunnmann Perl 2 04-23-08 04:27 AM
Looking for a good review management script griz_fan Script Requests 10 07-29-07 06:08 AM
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 01:12 AM
will pay. php script needed. upload, resize, & email jamjammo Script Requests 4 02-29-04 09:30 PM
Affiliate script (PHP) whtiebear Job Offers & Assistance 2 12-21-03 01:12 AM


All times are GMT -5. The time now is 08:15 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.