Current location: Hot Scripts Forums » Programming Languages » PHP » Parse error - line 14


Parse error - line 14

Reply
  #1 (permalink)  
Old 02-24-06, 10:23 AM
sondogg's Avatar
sondogg sondogg is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Parse error - line 14

I can't seem to figure out this parse error! When I run it, it returns an error that says: Parse error: parse error in /view_users.php on line 14

Here is my script:

<?php # - view_users.php
//This script retieves all the records for the users table.
ini_set('display_errors', 1);
error_reporting(E_ALL);
$page_title = 'View the Current Users';
include ('header.html');

//Page Header
echo '<h1 id="mainhead">Registered Users</h1>';

require_once ('Connections/dbc.php' //Connect to the db

//Make the query
$query = "SELECT CONCAT(last_name, ', ', first_name) AS name, DATE_FORMAT(registration_date, '%M %d, $Y') AS dr FROM test.users ORDER BY registration_date ASC";
$result = @mysql_query ($query); //Run the query

if ($result) { // If it ran OK, display the records

//Table header
echo '<table align="center" cellspacing="0" cellpadding="5">
<tr><td align="left"><b>Date Registered</b></td></tr>
';

//Fetch and print all the records
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo '<tr><td align="left">' . $row['name'] . '</td><td align="left">' . $row['dr'] . '</td></tr>
';
}

echo '<table>';

mysql_free_result ($result); //Free up the resources

}else{ //If it did not run OK.
echo '<p class="error">The current users could not be retieved. We apologize for any inconvenience.</p>'; //Public message
echo '<p>' . mysql_error() . '<br><br>Query: ' . $query . '</p>'; // Debugging message
}

mysql_close(); //Close the database connection

include ('footer.html'); //Include the footer

?>

Thanks for your help.

Sonny
Reply With Quote
  #2 (permalink)  
Old 02-24-06, 10:52 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
require_once ('Connections/dbc.php' //Connect to the db

should be:


require_once ('Connections/dbc.php'); //Connect to the db
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #3 (permalink)  
Old 02-24-06, 11:27 AM
sondogg's Avatar
sondogg sondogg is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you! I didn't notice I left that out. I'm still getting a parse error on that line (14); but it actually runs the script now. What could it be?
Reply With Quote
  #4 (permalink)  
Old 02-24-06, 11:30 AM
sondogg's Avatar
sondogg sondogg is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Actually nevermind....I found it. I used a $Y when it should have been a %Y.

Thanks for all your help!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRIN aprogrammer PHP 20 08-31-11 05:56 AM
weird parse error. cant find a solution fridyrls PHP 1 11-03-05 11:26 AM
Parse error: parse error, unexpected T_VARIABLE aussietogo PHP 4 08-16-05 08:14 PM
Another Parse error conehead PHP 2 06-05-05 06:36 PM
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE | help? culticka PHP 1 11-25-04 03:10 PM


All times are GMT -5. The time now is 06:34 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.