MySQLi and PHP problem with code

115 pts.
Tags:
Concatenate
Database
MySQL
PHP
table
Can someone please tell me what I'm doing wrong with this particular line of code.
echo "<td colspan=3>{$Row['areaCode'] . '-' . $Row['prefix'] . '-' . $Row['lineNumber']}</td></tr>";
I know that the concatenation operator is the . 'areaCode' 'prefix' and 'lineNumber' are all fields in a table within an SQL database. any help would be appreciated. Thanks in advance.  Patricia

Software/Hardware used:
Windows XP Pro, CodeLobster for PHP; WAMP; MySQL

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi.

Parse error: parse error, expecting `’}” in C:\wamp\www\OswaltPatricia_Unit7Assignment\OswaltP_Connect.php on line 48

is the error message. Sorry, don’t know why I didn’t put that in. It also dawned on me that when I created the fields, each of the three fields had max values. areaCode has a max value of 3, same with prefix and the lineNumber has a max value of 4.

I’m not sure if that would make a difference or not when I’m simply trying to display the contents in a table.

Thanks, Patricia

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Patricia, what is the error message ?
    68,470 pointsBadges:
    report
  • PatOswalt
    Hi. Parse error: parse error, expecting `'}'' in C:wampwwwOswaltPatricia_Unit7AssignmentOswaltP_Connect.php on line 48 is the error message. Sorry, don't know why I didn't put that in. It also dawned on me that when I created the fields, each of the three fields had max values. areaCode has a max value of 3, same with prefix and the lineNumber has a max value of 4. I'm not sure if that would make a difference or not when I'm simply trying to display the contents in a table. Thanks, Patricia
    115 pointsBadges:
    report
  • PatOswalt
    Just in case someone else comes across this kind of problem in the future. The code I finally figured out is
    echo "<td colspan=3>({$Row['areaCode']}) {$Row['prefix']}-{$Row['lineNumber']}</td></tr>";
    It will print out the phone number as follows: (000) 000-0000 Works perfectly. Now to finish the rest of the project. Thanks, Patricia
    115 pointsBadges:
    report
  • Reliant
    This is cleaner
    echo '<td colspan=3>(' . $Row['areaCode'] . ') ' . $Row['prefix'] . '-' . $Row['lineNumber'] . '</td></tr>';
    or
    <td colspan=3>(<?=$Row['areaCode']?>)<?=$Row['prefix']?>-<?=$Row['lineNumber']?></td></tr>
    20 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following