parse error please help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dwilk28345
Forum Newbie
Posts: 6
Joined: Sat Apr 25, 2009 3:51 am

parse error please help

Post by dwilk28345 »

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/lionsclub/events.inc.php on line 20

I've been at it for hours trying to figure this out. :(


Code: Select all

 
<h2 align = "center">Lions Club Events</h2><br />
 
<?php
 
    $con = mysql_connect("localhost", "guest" , "guest") or die('sorry, the site database is down for maintanence');
    mysql_select_db("lionsclub", $con) or die('sorry, this portion of the site is down for maintanence');
    $query = "SELECT events,title FROM events ORDER BY events,eventid ASC
    $result = mysql_query($query) or die('Sorry, could not retrieve events at this time');
    $num_rows= mysql_num_row($result)
 
if ($num_rows == 0)
 
{
    echo '<h3>Sorry, no events posted at this time, please come back later</h3>';
 
}   else
{
    while($row=mysql_fetch_array($result, MYSQL_ASSOC))
    {
        $eventid = $row['eventid'];
        $title = $row['title'];
        $desc = $row['desc'];
        $sdate = $row['sdate'];
        $stime = $row['stime'];
        $edate = $row['edate'];
        $etime = $row['etime'];
        $club = $row['club'];
        $ocdesc = $row['ocdesc'];
 
        echo "$title $sdate, $stime $edate, $etime";
        echo "$shortdec";
        echo "$ocdesc";
    }
}
?>
 
 
Last edited by Benjamin on Sat Apr 25, 2009 3:58 am, edited 1 time in total.
Reason: Added code tags
Daisy100
Forum Newbie
Posts: 6
Joined: Sat Apr 25, 2009 10:48 am

Re: parse error please help

Post by Daisy100 »

$num_rows= mysql_num_row($result);
(You missed the ; )
dwilk28345
Forum Newbie
Posts: 6
Joined: Sat Apr 25, 2009 3:51 am

Re: parse error please help

Post by dwilk28345 »

lol i spent 4 hours looking for that lol. Thanks


Topic is closed

now there is a new problem

It is not registering the query , it says that no posts can be found all though the posts are submitted and are in the mysql database, u name and pword is both guest for the account and in the code, I also have global privileges to add edit view delete and so on, any ideas?
dwilk28345
Forum Newbie
Posts: 6
Joined: Sat Apr 25, 2009 3:51 am

Re: parse error please help

Post by dwilk28345 »

here is the new code with the mysql problem. It only occurs when I leave SELECT desc, in the list of records to pull from the database.

Code: Select all

 
<h2 align = "center">Lions Club Events</h2><br />
 
<?php
 
    $con = mysql_connect("localhost", "guest" , "guest") or die('sorry, the site database is down for maintanence');
    mysql_select_db("lionsclub", $con) or die('sorry, this portion of the site is down for maintanence');
    $query = "SELECT eventid, title, desc, sdate, stime, edate, etime, club, ocdesc  FROM events ORDER BY eventid ASC";
    $result = mysql_query($query) or die('Sorry, could not retrieve events at this time');
 
if (mysql_num_rows($result) == 0)
 
{
    echo '<h3>Sorry, no events posted at this time, please come back later</h3>';
 
}   else
{
    while($row=mysql_fetch_array($result, MYSQL_ASSOC))
    {
        $eventid = $row['eventid'];
        $title = $row['title'];
        $desc = $row['desc'];
        $sdate = $row['sdate'];
        $stime = $row['stime'];
        $edate = $row['edate'];
        $etime = $row['etime'];
        $club = $row['club'];
        $ocdesc = $row['ocdesc'];
 
        echo "$title, $sdate, $stime $edate, $etime <br />";
        echo "$desc";
        echo "$ocdesc";
    }
}
?>
 
 
Last edited by Benjamin on Sun Apr 26, 2009 12:00 pm, edited 1 time in total.
Reason: Added code tags.
dwilk28345
Forum Newbie
Posts: 6
Joined: Sat Apr 25, 2009 3:51 am

Re: parse error please help

Post by dwilk28345 »

wow this sucks, now it just displays the word desc no information from the database any other suggestions?
dwilk28345
Forum Newbie
Posts: 6
Joined: Sat Apr 25, 2009 3:51 am

Re: parse error please help

Post by dwilk28345 »

never mind, i changed the name to shortdesc and it works now, thanks youall have been a great help.
dwilk28345
Forum Newbie
Posts: 6
Joined: Sat Apr 25, 2009 3:51 am

Re: parse error please help

Post by dwilk28345 »

closed!!!!!!!!!!!!!!11
Post Reply