Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 14th, 2005, 03:34 PM
Registered User
Join Date: Jun 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parse Error

The code below works fine on my local machine , but on a live server "http://www.crestway.wcape.school.za/courselist/admin.php I get the following error message:


Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /usr/vweb/www.crestway.wcape.school.za/courselist/class.SimpleMail.php on line 4

The admin transact code is the following:


$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
  or die('Could not connect to MySQL database. ' . mysql_error());

mysql_select_db(SQL_DB, $conn);

if (isset($_POST['action'])) {
  switch ($_POST['action']) {
    case 'Add New Mailing List':
      $sql = "INSERT INTO cl_lists (listname) " .
             "VALUES ('" . $_POST['listname'] . "')";
        or die('Could not add mailing list. ' . mysql_error());

    case 'Delete Mailing List':
      $sql = "DELETE FROM cl_lists WHERE cl_id=" . $_POST['cl_id'];
        or die('Could not delete mailing list. ' . mysql_error());
      $sql = "DELETE FROM cl_subscriptions " .
             "WHERE cl_id=" . $_POST['cl_id'];
        or die('Could not delete mailing list subscriptions. ' .

    case 'Send Message':
      if (isset($_POST['msg'], $_POST['cl_id'])) {
        if (is_numeric($_POST['cl_id'])) {
          $sql = "SELECT listname FROM cl_lists " .
                 "WHERE cl_id='" . $_POST['cl_id'] . "'";
          $result = mysql_query($sql, $conn)
            or die(mysql_error());
          $row = mysql_fetch_array($result);
          $listname = $row['listname'];
        } else {
          $listname = "Master";

        $sql = "SELECT DISTINCT usr.email1, usr.first_name, usr.person_id " .
               "FROM person usr " .
               "INNER JOIN cl_subscriptions mls " .
               "ON usr.person_id = mls.person_id " .
               "WHERE mls.pending=0";
        if ($_POST['cl_id'] != 'all') {
          $sql .= " AND mls.cl_id=" . $_POST['cl_id'];

        $result = mysql_query($sql)
          or die('Could not get list of email addresses. ' . mysql_error());

        $headers = "From: " . ADMIN_EMAIL . "\r\n";

        while ($row = mysql_fetch_array($result)) {
          if (is_numeric($_POST['cl_id'])) {
            $ft = "You are receiving this message as a member of the ";
            $ft .= $listname . "\n mailing list. If you have received ";
            $ft .= "this e-mail in error, or would like to\n remove your ";
            $ft .= "name from this mailing list, please visit the ";
            $ft .= "following URL:\n";
            $ft .= "http://" . $_SERVER['HTTP_HOST'] .
                   dirname($_SERVER['PHP_SELF']) . "/remove.php?u=" .
                   $row['person_id'] . "&cl=" . $_POST['cl_id'];
          } else {
            $ft = "You are receiving this e-mail because you subscribed ";
            $ft .= "to one or more\n mailing lists. Visit the following ";
            $ft .= "URL to change your subscriptions:\n";
            $ft .= "http://" . $_SERVER['HTTP_HOST'] .
                   dirname($_SERVER['PHP_SELF']) . "/user.php?u=" .

          $msg = stripslashes($_POST['msg']) . "\n\n";
          $msg .= "--------------\n";
          $msg .= $ft;

          $email = new SimpleMail();

            or die('Could not send e-mail.');

header('Location: admin.php');


How can I resolve the problem. Any help is much appreciated.

Reply With Quote
  #2 (permalink)  
Old April 26th, 2006, 03:51 AM
Registered User
Join Date: Apr 2006
Location: Newcastle upon Tyne, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Kev_Akas Send a message via Yahoo to Kev_Akas

I had this problem testing this code on a PHP4 server and not a PHP5 server. I'll test it on my PHP5 server tonight.

Kev Atkinson
Reply With Quote
  #3 (permalink)  
Old April 27th, 2006, 05:56 AM
Authorized User
Join Date: May 2005
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts

What is the content of 'class.SimpleMail.php' ?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 02:27 AM
Parse error: parse error, unexpected $end Ayodeji Adegbaju Pro PHP 3 January 12th, 2007 12:21 PM

All times are GMT -4. The time now is 01:10 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.