Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 136,124 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,778 people online right now. Registration is fast and FREE... Join Now!




unexpected $end

 
Reply to this topicStart new topic

unexpected $end, unexpected $end

rpjd
8 Mar, 2007 - 01:27 PM
Post #1

D.I.C Head
**

Joined: 8 Mar, 2007
Posts: 85


My Contributions
I have the following code
[code]
<?php require 'DB.php';
$db_conn = pg_connect("dbname=allied_auto_parts user=user host=localhost);
if ($db_conn)
{
echo 'Connection attempt succeeded.';
}
else
{
echo 'Connection attempt failed.;
}
$query = \"select level from parts\";
$result = pg_exec($db_conn, $query);
echo \"Number of parts:\" . <textarea name=\"level\">;
echo htmlspecialchars($result);
echo \"</textarea>\";
pg_close($db_conn);
?>
[code]
getting the following :
Parse error, syntax error, unexpected $end in file on line 18. I am new to PHP and there are only 17 line of code.
Does anyone see anything obvious. I am learning as aI go! smile.gif
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Unexpected $end
8 Mar, 2007 - 01:31 PM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
CODE

echo 'Connection attempt failed.;

There is no closing quote on this line.
User is offlineProfile CardPM
+Quote Post

Styx
RE: Unexpected $end
8 Mar, 2007 - 09:40 PM
Post #3

D.I.C Head
Group Icon

Joined: 4 Mar, 2007
Posts: 192


Dream Kudos: 225
My Contributions
There are several things wrong with this, just concerning missing end quotes and things:
CODE
<?php
require 'DB.php';
$db_conn = pg_connect("dbname=allied_auto_parts user=user host=localhost");
if ($db_conn)
{
  echo 'Connection attempt succeeded.';
}
else
{
  echo 'Connection attempt failed.';
}
$query = "select level from parts";
$result = pg_exec($db_conn, $query);

echo 'Number of parts: <textarea name="level">' . htmlspecialchars($result) . '</textarea>';

pg_close($db_conn);
?>


This post has been edited by Styx: 8 Mar, 2007 - 09:51 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 10:12PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month