GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-May-2004, 12:31
cedexfrance cedexfrance is offline
New Member
 
Join Date: May 2004
Posts: 2
cedexfrance is on a distinguished road

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /


I encounted the subject problem. I appreciate if anyone would be able to resolve this. The following is the original script. Many thanks.


PHP Code:

<?
    include ("config_file.php");

    if ($type=="buyers")
    {
        if ($HTTP_POST_VARS['new_message'] != "" and $HTTP_POST_VARS['send']=="Send" )
        {
        $insertSQL = "insert into $bx_db_table_messages values('','".$HTTP_POST_VARS['id']."', '".$user_id."','".$HTTP_POST_VARS['user_type']."', '".$HTTP_POST_VARS['to_seller']."', '".$HTTP_POST_VARS['new_message']."', NOW(),'private')";
        $insert_query = bx_db_query($insertSQL);
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));

        $sel = bx_db_query("select username from $bx_db_table_sellers where user_id='".$HTTP_POST_VARS['to_seller']."'");
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
            $result = bx_db_fetch_array($sel);
            $seller_username = $result['username'];

        $sel = bx_db_query("select username,email from $bx_db_table_buyers where user_id='$user_id'");
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
            $result = bx_db_fetch_array($sel);
            $buyer_username = $result['username'];
            $user_email = $result['email'];

        $sel = bx_db_query("select project_title from $bx_db_table_projects where project_id='".$HTTP_POST_VARS['id']."'");
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
            $result = bx_db_fetch_array($sel);
            $projectname = $result['project_title'];

    $buyer_mail_subject="Got Message from seller";
    $buyer_mail_message=" Dear ".$buyer_username.", \n\n";
    $buyer_mail_message.="$seller_username has just posted a message for for the project $projectname\n\n";
    $buyer_mail_message.=" $HTTP_POST_VARS['new_message']\n";
    $buyer_mail_message.=" You can reply to it by visit this project\n";
    $buyer_mail_message.=HTTP_SERVER."/";
    @mail($user_email,$buyer_mail_subject,$buyer_mail_message,"From:".SITE_MAIL);    


       // refresh(basename($PHP_SELF));
        //exit();
        }
    }

    if ($type=="sellers")
    {
        if ($HTTP_POST_VARS['new_message'] != "" and $HTTP_POST_VARS['send']=="Send" )
        {
        $insertSQL = "insert into $bx_db_table_messages values('','".$HTTP_POST_VARS['id']."', '".$user_id."','".$HTTP_POST_VARS['user_type']."', '".$HTTP_POST_VARS['to_seller']."', '".$HTTP_POST_VARS['new_message']."', NOW(),'private')";
        $insert_query = bx_db_query($insertSQL);
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));

               $sel = bx_db_query("select username from $bx_db_table_buyers where user_id='".$HTTP_POST_VARS['to_seller']."'");
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
            $result = bx_db_fetch_array($sel);
            $buyer_username = $result['username'];

        $sel = bx_db_query("select username,email from $bx_db_table_sellers where user_id='$user_id'");
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
            $result = bx_db_fetch_array($sel);
            $seller_username = $result['username'];
            $user_email = $result['email'];

        $sel = bx_db_query("select project_title from $bx_db_table_projects where project_id='".$HTTP_POST_VARS['id']."'");
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
            $result = bx_db_fetch_array($sel);
            $projectname = $result['project_title'];

    $buyer_mail_subject="Got Message from buyer";
    $buyer_mail_message=" Dear ".$seller_username.", \n\n";
    $buyer_mail_message.="$buyer_username has just posted a message for for the project $projectname\n\n";
    $buyer_mail_message.=" $HTTP_POST_VARS['new_message']\n";
    $buyer_mail_message.=" You can reply to it by visit this project\n";
    $buyer_mail_message.=HTTP_SERVER."/";
    @mail($user_email,$buyer_mail_subject,$buyer_mail_message,"From:".SITE_MAIL);    

       
       // refresh(basename($PHP_SELF));
        //exit();
        }
    }
    include (DIR_FORMS."message_board_form.php");


    include (DIR_FORMS."footer.php");
?>

Last edited by JdS : 23-May-2004 at 00:13. Reason: Please enclose PHP code in [php] & [/php] for syntax highlighting
  #2  
Old 23-May-2004, 00:16
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello cedexfrance,

At a glance, this is what I found:

Try changing the following line:

PHP Code:

<?php
//... edit the line below
// $buyer_mail_message.=" $HTTP_POST_VARS['new_message']\n";
// to
$buyer_mail_message.=" $HTTP_POST_VARS[new_message]\n";
//...
?>

  #3  
Old 23-May-2004, 12:58
cedexfrance cedexfrance is offline
New Member
 
Join Date: May 2004
Posts: 2
cedexfrance is on a distinguished road

Posting Problem


Thanks! It's working now. By the way, could check the below script too.

PHP Code:

<?
include("config_file.php");
    //**DEBUG**//
//echo($type.' '.$user_id);
//$ii=($HTTP_POST_VARS['subcategory_id']);
//postvars($HTTP_POST_VARS);
    //**DEBUG**//

if ($type=="sellers") 
{
    $table_name = $bx_db_table_sellers;
}
else 
{
    
}

$sel = bx_db_query("select * from $table_name where user_id='$user_id'");
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
if(bx_db_num_rows($sel)!=0)
{
    $result = bx_db_fetch_array($sel);
}

//verify seller pay status
if ($result['pay_status']=="yes") 
{

$SQL = "select * from $bx_db_table_email_notification where user_type='sellers' and user_id=$user_id";
$notification_query = bx_db_query($SQL);
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
$res_notification=bx_db_fetch_array($notification_query);

//**If user is not in table**//
if ($HTTP_POST_VARS['update']=="Update" and ($HTTP_POST_VARS['notification_enter']=="

notification_enter") and $res_notification=='')
{
    $category_list=$HTTP_POST_VARS['subcategory_id'];
    $category_notification_string=",";
    for ($i=0;$i < (count($HTTP_POST_VARS['subcategory_id'])) ;$i++ )
    {
        $category_notification_string.=$category_list[$i];
        $category_notification_string.=",";
    }
    $insertSQL = "insert into $bx_db_table_email_notification values('','".$user_id."','".$type."

','".$category_notification_string."','".$HTTP_POST_VARS['bid_notification']."','".$HTTP_POST_VARS[

'message_notification']."','".$HTTP_POST_VARS['newsletter_notification']."')";
    $insert_query = bx_db_query($insertSQL);
    SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
}

//**If user is already in table**//
if ($HTTP_POST_VARS['update']=="Update" and ($HTTP_POST_VARS['notification_enter']=="

notification_enter") and $res_notification!='')
{   
    $category_list=$HTTP_POST_VARS['subcategory_id'];
    $category_notification_string=",";
    for ($i=0;$i < (count($HTTP_POST_VARS['subcategory_id'])) ;$i++ )
    {
        $category_notification_string.=$category_list[$i];
        $category_notification_string.=",";
    }
    $updateSQL = "update $bx_db_table_email_notification set category_notification='".

$category_notification_string."', bid_notification='".$HTTP_POST_VARS['bid_notification']."', 

message_notification='".$HTTP_POST_VARS['message_notification']."', newsletter_subscribe='".

$HTTP_POST_VARS['newsletter_notification']."' where user_id='".$user_id."' and user_type='".$type."'";
    $update_query = bx_db_query($updateSQL);
    SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
}

//**Subscribe to newsletter**//
if ($HTTP_POST_VARS['update']=="Update" and ($HTTP_POST_VARS['notification_enter']=="

notification_enter") and ($HTTP_POST_VARS['newsletter_notification']=="1"))
{   
    $x="bx_db_table_".$type;
    $xtable=$$x;
    $SQL = "select * from $xtable where user_id='".$user_id."'";
    $sel_email = bx_db_query($SQL);
    SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
    $res_email=bx_db_fetch_array($sel_email);

    $SQL = "select * from $bx_db_table_newsletter_subscribers where email='".$res_email['email']."'";
    $sel = bx_db_query($SQL);
    SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
    if(bx_db_num_rows($sel)==0)
    {   
        $SQL = "insert into $bx_db_table_newsletter_subscribers values('','".$res_email['email']."

','daily',now(),'active')";
        $ins = bx_db_query($SQL);
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
    }
}

//**Unsubscribe from newsletter**//
if ($HTTP_POST_VARS['update']=="Update" and ($HTTP_POST_VARS['notification_enter']=="

notification_enter") and ($HTTP_POST_VARS['newsletter_notification']=="0"))
{
    $x="bx_db_table_".$type;
    $xtable=$$x;
    $SQL = "select * from $xtable where user_id='".$user_id."'";
    $sel_email = bx_db_query($SQL);
    SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
    $res_email=bx_db_fetch_array($sel_email);

    $SQL = "select * from $bx_db_table_newsletter_subscribers where email='".$res_email['email']."'";
    $sel = bx_db_query($SQL);
    SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
    if(bx_db_num_rows($sel) > 0)
    {   
        $SQL = "DELETE FROM $bx_db_table_newsletter_subscribers where email='".$res_email['email']."'";
        $ins = bx_db_query($SQL);
        SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
    }
}

$SQL = "select * from $bx_db_table_email_notification where user_type='sellers' and user_id=$user_id";
$notification_query = bx_db_query($SQL);
SQL_CHECK(0,"SQL Error at ".__FILE__.":".(__LINE__-1));
$res_notification=bx_db_fetch_array($notification_query);

//**'Checked' variables for radio inputs**//
if ($res_notification=='')
{
    $bid_notif_sel="checked";    
    $bid_notif_unsel="";    
    $message_notif_sel="checked";    
    $message_notif_unsel="";    
    $newsletter_notif_sel="checked";    
    $newsletter_notif_unsel="";    
}else{
    if ($res_notification['bid_notification']=='1')
    {
        $bid_notif_sel="checked";
        $bid_notif_unsel="";
    }else{
        $bid_notif_sel="";
        $bid_notif_unsel="checked";
    }
    if ($res_notification['message_notification']=='1')
    {
        $message_notif_sel="checked";
        $message_notif_unsel="";
    }else{
        $message_notif_sel="";
        $message_notif_unsel="checked";
    }
    if ($res_notification['newsletter_subscribe']=='1')
    {
        $newsletter_notif_sel="checked";
        $newsletter_notif_unsel="";
    }else{
        $newsletter_notif_sel="";
        $newsletter_notif_unsel="checked";
    }
        
    $bid_notif_sel="checked";    
    $message_notif_sel="";    
    $message_notif_sel="checked";    
    $newsletter_notif_sel="";
    $newsletter_notif_sel="checked";
} 
?>
<br>
<table border="0" cellpadding="1" cellspacing="0" bgcolor="<?=REGISTRATION_FORM_BORDER_COLOR?>" align

="center" width="<?echo TABLE_WIDTH;?>">
    <tr>
        <td>
        <table border="0" cellpadding="4" cellspacing="0" align="center" bgcolor="<?=

REGISTRATION_FORM_BODY_BGCOLOR?>" width="100%">
        <form method="post" action="e_notification.php" enctype="multipart/form-data">
        <tr bgcolor="<?=REGISTRATION_FORM_HEAD_BGCOLOR?>"><td colspan="2" height="15" align="center"

><font color="<?=REGISTRATION_FORM_HEAD_TEXT_COLOR?>" class="text1"><b>Email Notifications</b></font><

/td></tr>
        <tr><td class="text1" colspan="2">Change your subscription settings for emails from 

ConnectPlace </td></tr>
        
        <tr><td colspan="2" class="text1"><br><u><b>Administrative Emails</b></u></td></tr>
        <tr><td class="text1" colspan="2">Receive an email whenever a project you are interested in is 

posted.</td></tr>
        <tr><td class="text1" colspan="2">You can <b>select</b> or <b>deselect</b> more than one 

category by holding down the CTRL key.<br></td></tr>
        <tr><td width="20%">&nbsp;</td><td>
        <select name="subcategory_id[]" SIZE=4 MULTIPLE>
        <?
        $SQL = "select * from $bx_db_table_project_category order by category_name";
        $category_select_query = bx_db_query($SQL);
        $i = 0;
        if(bx_db_num_rows($category_select_query))
              
            while ($category_select_result = bx_db_fetch_array($category_select_query))
            {
                $SQL = "select * from $bx_db_table_project_subcategory where category_id='".

$category_select_result['category_id']."'";
                $subcategory_select_query = bx_db_query($SQL);
                if ($count_subcategory = bx_db_num_rows($subcategory_select_query))
                    while ($subcategory_select_result = bx_db_fetch_array($subcategory_select_query))
                    {
                    
                        echo "<option value='".$subcategory_select_result['subcategory_id']."' ";
                        //echo $category_select_result['category_id'];
                        
                        //exit;
                        if ((ereg(",".$subcategory_select_result['subcategory_id'].","

,$res_notification['category_notification'])))
                        {
                            echo "selected";
                        }
                        echo">".$category_select_result['category_name'].": ".

$subcategory_select_result['subcategory_name']."</option>";
                    }
            }
        ?>
        </select>
        </td></tr>
        
        <!-- <tr><td class="text1" colspan="2">Receive an email regarding a bid you've placed on a 

project (e.g. bid is declined).<br></td></tr>
        <tr><td width="20%">&nbsp;</td><td class="text1"><input type="radio" name="bid_notification" 

value="1" <?=$bid_notif_sel?>>Subscribe<br>
        <input type="radio" name="bid_notification" value="0" <?=$bid_notif_unsel?>>Unsubscribe</td></

tr> -->
        <tr><td class="text1" colspan="2">Receive an email when a new message is posted on your private 

message board.<br></td></tr>
        <tr><td width="20%">&nbsp;</td><td class="text1"><input type="radio" name="

message_notification" value="1" <?=$message_notif_sel?>>Subscribe<br>
        <input type="radio" name="message_notification" value="0" <?=$message_notif_unsel?

>>Unsubscribe</td></tr>
        <tr><td colspan="2" class="text1"><br><u><b>Newsletter Emails</b></u></td></tr>
        <tr><td class="text1" colspan="2">Receive newsletter emails from CP.<br></td></tr>
        <tr><td width="20%">&nbsp;</td><td class="text1"><input type="radio" name="

newsletter_notification" value="1" <?=$newsletter_notif_sel?>>Subscribe<br>
        <input type="radio" name="newsletter_notification" value="0" <?=$newsletter_notif_unsel?

>>Unsubscribe</td></tr>
        <input type="hidden" name="notification_enter" value="notification_enter">
        <tr><td align="center" colspan="2"><input type="submit" class="button" name="update" value="

Update"></td></tr>

    </td></tr>
    </form>
  </table>
      </td>
  </tr>
</table><br>

<?
}//$result['pay_status']=="yes"
else 
{
    ?>
    <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" height="100">
        <tr>
            <td class="text1" align="center"><font color="<?echo ERROR_TEXT_COLOR?>">You cannot 

access this section because your payment was not finished! &nbsp;&nbsp; Click <a href="<?=HTTP_SERVER?

>/my_account.php" class="head"><b>here</b></a> to access the payment form!</font></td>
        </tr>
    </table>
    <?
}


include (DIR_FORMS."footer.php");
?>



--------------------------------------------------------------------------

Regards,
John
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:35.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.