简体   繁体   English

解析错误:语法错误,意外的']',预期为T_STRING或T_VARIABLE或T_NUM_STRING

[英]Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING

I am trying to retrieve data from database and show that data in the table header in the text mail function,but i am getting an error: 我试图从数据库中检索数据,并在文本邮件功能的表标题中显示该数据,但出现错误:

Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING

can anyone tell how to fix this error 谁能告诉我如何解决此错误

my code : 我的代码:

 $text_mail.= "<table style='margin:0px'>
    <tr>
    <th>Country</th>
    <th>Networkname </th>
    <th>Mcc</th>
    <th>Mnc</th> 
    <th>Oldprice </th>      
    <th>Newprice </th>      
    <th>Comments </th>  
     <?php  


      $dbHost = 'localhost'; // usually localhost
$dbUsername = 'xxxx';
$dbPassword = 'xxxxxxxxx';
$dbDatabase = 'xxxxxxxxxxxx';
$db = mysql_connect($dbHost, $dbUsername, $dbPassword) or die ("Unable to connect to Database Server.");
mysql_select_db ($dbDatabase, $db) or die ("Could not select database.");

    $ColumnNames = mysql_query('select clientid from client_list ORDER BY `clientid` ASC') or die('mysql error');       
    $columnArray=array();
    $i=0;       
    while($data3=mysql_fetch_array($ColumnNames))
    {
        $columnArray[]=$data3[0];

            echo '<th style='width:67px;' class='. $columnArray[$i] .' >" . $columnArray[$i] . " 
                </th>';

            echo'<th></th>';


    $i++;   
            }

    ?>  

    </tr>";

correct these: 更正这些:

$db = mysql_connect($dbHost, $dbUsername, $dbPassword) or die (\"Unable to connect to Database Server.\");
mysql_select_db ($dbDatabase, $db) or die (\"Could not select database.\");

or use single quotes 或使用单引号

if this is not a typo error then you need to add ending " (double quote) after 如果这不是拼写错误,则需要在后面添加结尾“(双引号)

change 更改

    $text_mail.= "<table style='margin:0px'>
    <tr>
    <th>Country</th>
    <th>Networkname </th>
    <th>Mcc</th>
    <th>Mnc</th> 
    <th>Oldprice </th>      
    <th>Newprice </th>      
    <th>Comments </th>

to 

$text_mail.= "<table style='margin:0px'>
<tr>
<th>Country</th>
<th>Networkname </th>
<th>Mcc</th>
<th>Mnc</th> 
<th>Oldprice </th>      
<th>Newprice </th>      
<th>Comments </th> "; 

删除<?php标记,因为您已经在php中

  1. if this is not a typo error then you need to add ending " (double quote) after 如果这不是拼写错误,则需要在后面添加结尾“(双引号)
  2. Remove php tag after ending . 结束后删除php标签。 change 更改

    $text_mail.= " Country Networkname Mcc Mnc Oldprice $ text_mail。=“国家/地区网络名称Mcc Mnc旧价格
    Newprice 新的价格
    Comments 评论

to

$text_mail.= "<table style='margin:0px'>
<tr>
<th>Country</th>
<th>Networkname </th>
<th>Mcc</th>
<th>Mnc</th> 
<th>Oldprice </th>      
<th>Newprice </th>      
<th>Comments </th> "; 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更新功能:语法错误,意外的T_ENCAPSED_AND_WHITESPACE,预期为T_STRING或T_VARIABLE或T_NUM_STRING - update function: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING 语法错误,意外T_ENCAPSED_AND_WHITESPACE,期待T_STRING或T_VARIABLE或T_NUM_STRING - syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Magento 2:语法错误,意外 '"',在 phtml 文件中需要 '-' 或标识符 (T_STRING) 或变量 (T_VARIABLE) 或数字 (T_NUM_STRING) - Magento 2: syntax error, unexpected '"', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in phtml file 出现解析错误,预期为“ T_STRING”或“ T_VARIABLE”或“ T_NUM_STRING” - got a parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' PHP解析错误:语法错误,意外的T_ENCAPSED_AND_WHITESPACE,预期为T_STRING或T_VARIABLE或T_NUM_STRING - PHP Parse Error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING 解析错误:语法错误,意外的“”“,期望”-“或标识符(T_STRING)或变量(T_VARIABLE)或数字(T_NUM_STRING)在PHP的第17行 - Parse error: syntax error, unexpected '"', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) on line 17 in PHP 意外的T_ENCAPSED_AND_WHITESPACE,期待T_STRING或T_VARIABLE或T_NUM_STRING错误邮件 - unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING error mail 无法找出语法错误,意外的T_ENCAPSED_AND_WHITESPACE,预期为T_STRING或T_VARIABLE或T_NUM_STRING - Can not figure outsyntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING 语法错误,意外的&#39;&#39;(T_ENCAPSED_AND_WHITESPACE),期望的标识符(T_STRING)或变量(T_VARIABLE)或数字(T_NUM_STRING)| [初学者] - syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) |[beginner] 如何解决此“ T_ENCAPSED_AND_WHITESPACE,期待T_STRING或T_VARIABLE或T_NUM_STRING”错误? - How do I fix this “T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING” error?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM