Jump to content

Parse error: syntax error, unexpected $end


genzedu777

Recommended Posts

Hi,

 

After adding this code, I received an error. Anyone can advise what is the possible reason? Thanks

 

"Parse error: syntax error, unexpected $end in D:\inetpub\vhosts\championtutor.com\httpdocs\tutor_registration.php on line 594"

 

<?php

/***Teaching Credentials***/

 

echo '<label for="teaching_credentials" class="label">Teaching Credentials</label>';

 

 

$dbc = mysqli_connect('localhost', '111', '111', '111')

or die(mysqli_error());

$query = ("SELECT * FROM tutor_teaching_credentials ORDER BY credentials_id ASC");

$sql = mysqli_query($dbc, $query)

or die(mysqli_error());

 

 

while($data = mysqli_fetch_array($sql)) {

 

 

 

echo '<select name="teaching_credentials" id="teaching_credentials">

        <option value="">--Please select one--</option>

        <option value="'.$data['credentials_id'].'">'.$data['credentials_name'].'</option></select>';

 

 

mysqli_close($dbc);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/217822-parse-error-syntax-error-unexpected-end/
Share on other sites

 

Which line is 594 ?

 

Possible causes:

 

1) Badly placed or missing curly braces..

 

2) If this is part of a larger class, and you segmented the code with <?php ?>, could cause this.

 

3) Using short tags <? ?> instead of <php ?> possibly on something that is tied into this script or page.

 

My suspicion tells me to start looking at this line:

<option value="'.$data['credentials_id'].'">'.$data['credentials_name'].'</option></select>';

 

missing the closing curly in the while judging from what you have posted, and the structure you have there..

 

BTW, you need to construct the <select> OUTSIDE the loop, it's the <option></option> that needs to be looped through in this instance from what I can see here.

 

Rw

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.