Error message for this line of code

I’ve been receiving an error message for the following PHP 4 code:


    $sql = "SELECT * FROM ml_users " .
        "WHERE user_id='" . $_GET['u'] . "';";
    $result = mysql_query($sql,$conn);
    $row = mysql_fetch_array($result);
    $firstname = $row['firstname'];
    $e-mail = $row['e-mail'];

[05-Jul-2008 01:28:39] PHP Parse error:  parse error, unexpected '=' in /_test/mailings/user_transact.php on line 106

Line 106 is

$e-mail = $row['e-mail'];

Can anyone tell me what the issue is?

replace $e-mail with $email

So PHP doesn’t like the hyphen in a variable name?

Probably not. You can use - as a delimiter in some cases. You can, however, use underscrore.

Try: $e_mail = $row[‘e_mail’];

Ya, you will need to change the field name to e_mail too. Try it out & let us know.

Hope it helps. Good luck!