0

私はこのエラーを受け取り続けます:

PHP解析エラー:構文エラー、予期しないT_STRING

この行の場合:

if($email_addr == "") /* If real email not found, return FALSE*/

何が悪いのかわからず、色んなことをやってみて、修正せずに2日間調べました。私が間違っていることを他の誰かが見ることができるのだろうか。なぜこのエラーが発生するのですか?ありがとうございました。(機能は以下の通りです)

    function searchRecipient() // function to search the database for the real email
{
    global $MessageSentToMailbox; // bring in the alias email
    $email_addr = mysql_query("SELECT email FROM tbl WHERE source='$MessageSentToMailbox'"); // temp store of the real email
    $row = mysql_fetch_assoc($email_addr); //making temp store of data for use in program
    if($email_addr == "") /* If real email not found, return FALSE*/
    {
        return FALSE;
    }
    else  /* Else, return find the person's name and return both in an array */
    {
        $query = "SELECT * FROM tbl WHERE email = '$email_addr'"; // pulling in the row where the emails match
        $results = mysql_query($query, $email_addr); // temp store of both queries from this function
        $row = mysql_fetch_assoc($results); //making temp store of data for use in program
        $name = $row['author'];  // taking the author data and naming its variable
        return array($name, $email_addr);  // this is the name and the real email address to be used in function call
    }
}
4

2 に答える 2

1

リソースを文字列と比較しています。

あなたが本当にやりたいことはこれです:

if ($row['email']== "")

または、さらに良いこれ:

if (empty($row['email']))
于 2012-05-04T18:34:27.490 に答える
0
if($row['email']== "") /* If real email not found, return FALSE*/
    {
        return FALSE;
    }
于 2012-05-04T18:34:27.150 に答える