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
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>';

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.