<html>
<head>
</head>
<body>

<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");

mysql_select_db("ong_assesment',$connect);
$query = mysql_query (SELECT Agent_ID,Address/Suburb,Bedrooms/Bathrooms,Price FROM suburbs);

{
echo '<tr>';
echo '<td>'. $row[Agent_ID].'</td>';
echo '<td>'. $row[Address].'</td>';
echo '<td>'. $row[Bedrooms].'</td>';
echo '<td>'. $row[Price].'</td>';

echo '</table>'
mysql_close();
}
?php>
</body>
</html>
Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80
Member Avatar

change to

echo '</table>';
Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

diafol:still the same

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

write ?> not ?php>

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

neha jaltare:still the same

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Try this, bit different to your script.. Have a look at yours, you have many errors:

<html>
<head>
</head>
<body>

<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");

mysql_select_db("ong_assesment",$connect);
$query = "SELECT Agent_ID,Address/Suburb,Bedrooms/Bathrooms,Price FROM suburbs";
$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result))
{
    echo '<tr>';
    echo '<td>'. $row[Agent_ID].'</td>';
    echo '<td>'. $row[Address].'</td>';
    echo '<td>'. $row[Bedrooms].'</td>';
    echo '<td>'. $row[Price].'</td>';
}
    echo '</table>';

?>
</body>
</html>

e.g. in yours you have:

mysql_select_db("ong_assesment',$connect);

should be:

mysql_select_db("ong_assesment",$connect);

Hope this helps

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

yes it work but the database not showing

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80
Member Avatar

WHat editor / IDE are you using? Some editors can spot these errors for you, highlighting the problem lines.

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Is there an error showing? Is there anything in the table?

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

it came out table but no data.
message:No database selected

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

I don't think you're understanding me.. I asked is there an error message showing, NOT what text editor you're using... Ok, try this:

<html>
<head>
</head>
<body>

<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");

mysql_select_db("ong_assesment",$connect);
$query = "SELECT Agent_ID,Address/Suburb,Bedrooms/Bathrooms,Price FROM suburbs";
$result = mysql_query($query) or die(mysql_erro());

if(!mysql_affected_rows() >= 1)
{
    echo 'There are no entries inside the database';
}
while($row = mysql_fetch_array($result))
{
    echo '<tr>';
    echo '<td>'. $row[Agent_ID].'</td>';
    echo '<td>'. $row[Address].'</td>';
    echo '<td>'. $row[Bedrooms].'</td>';
    echo '<td>'. $row[Price].'</td>';
}
    echo '</table>';

?>
</body>
</html>

Do you get the output: There are no entries inside the database? OR do you get something else?

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Is there a database called "ong_assesment"

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

i got no databse selected

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

yes. that is my database name

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Ok, try this:

where you have:

mysql_select_db("ong_assesment",$connect);

change it to:

$db_selected = mysql_select_db("ong_assesment", $connect);

Making sure, your database name is called "ong_assesment".

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Parse error: syntax error, unexpected T_VARIABLE in F:\xampp\htdocs\movies4.php on line 14

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Now you have to insert data, for the data to be shown :) Do you use mysqladmin? If so, you can just throw some example data in just to test!

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

but i already insert data in

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Please post your script, how it looks now.. Removing any passwords etc..

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80
<head>
</head>
<body>
<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");
$db_selected = mysql_select_db("ong_assessment", $connect)
$query = "SELECT Agent_ID,Address,Bedrooms,Price FROM suburbs";
$result = mysql_query($query) or die(mysql_error());
if(!mysql_affected_rows() >= 1)
{
echo 'There are no entries inside the database';
}
while($row = mysql_fetch_array($result))
{
 echo 'There are no entries inside the database';
}
while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td>'. $row[Agent_ID].'</td>';
echo '<td>'. $row[Address].'</td>';
echo '<td>'. $row[Bedrooms].'</td>';
echo '<td>'. $row[Price].'</td>';
}
echo '</table>';
?>
</body>
</html>
Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

LOOK at the syntax..

<head>
</head>
<body>
<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");
$db_selected = mysql_select_db("ong_assessment", $connect);
$query = "SELECT Agent_ID,Address,Bedrooms,Price FROM suburbs";
$result = mysql_query($query) or die(mysql_error());
if(!mysql_affected_rows() >= 1)
{
echo 'There are no entries inside the database';
}

while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td>'. $row[Agent_ID].'</td>';
echo '<td>'. $row[Address].'</td>';
echo '<td>'. $row[Bedrooms].'</td>';
echo '<td>'. $row[Price].'</td>';
}
echo '</table>';
?>
</body>
</html>

Now, if the output is: 'There are no entries inside the database' then there are no records in the table 'suburbs'. There are NO errors now, don't create errors for yourself.

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

ok thank you. i will try it now.

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Yes, your script is wrong. I posted an altered version the script that fixed the errors you had.

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Notice: Use of undefined constant Agent_ID - assumed 'Agent_ID' in F:\xampp\htdocs\movies4.php on line 23

Notice: Use of undefined constant Address - assumed 'Address' in F:\xampp\htdocs\movies4.php on line 24

Notice: Use of undefined constant Bedrooms - assumed 'Bedrooms' in F:\xampp\htdocs\movies4.php on line 25

Notice: Use of undefined constant Price - assumed 'Price' in F:\xampp\htdocs\movies4.php on line 26

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80
<head>
</head>
<body>
<table border='1'>
<tr>
<th>Agent_ID</th>
<th>Address</th>
<th>Bedrooms</th>
<th>Price</th>
<?php
$connect=mysql_connect("localhost","root","");
$db_selected = mysql_select_db("ong_assessment", $connect);
$query = "SELECT Agent_ID,Address,Bedrooms,Price FROM suburbs";
$result = mysql_query($query) or die(mysql_error());
if(!mysql_affected_rows() >= 1)
{
echo 'There are no entries inside the database';
}

while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td>'. $row['Agent_ID'].'</td>';
echo '<td>'. $row['Address'].'</td>';
echo '<td>'. $row['Bedrooms'].'</td>';
echo '<td>'. $row['Price'].'</td>';
}
echo '</table>';
?>
</body>
</html>

Better? They're no longer constants (:

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

yes!!! thank you very much. if i got pronlem again you will help me right?

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Yes, but, try and solve the problems yourself :)! But, you're welcome to post here and we'll help you.

If this is solved, please mark it as solved and give rep to those who helped!

Good luck

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

now i need to write report about this php... any suggestion?

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80
Member Avatar

WHat do you mean write a report?

Re: help me pls Parse error: syntax error, unexpected $end in F:\xampp\htdocs\ 80 80

Look at the syntax, if you have to explain what the script does, then it's pretty self-explanatory.. I cannot do your work for you, that wouldn't be fair and I'm sure you actually want to learn something ;) I'll help you a bit though:

  1. Explain what PHP is
  2. Explain the code you've written (So it retrives data from a table inside a database)
  3. Explain each line of code:

    $connect=mysql_connect("localhost","root","");
    $db_selected = mysql_select_db("ong_assessment", $connect);

This code establishes a connection with the database on the server. The mysql_connect accepts three parameters. The mysql_select_db attempts to select the database that data will be retrived from. It accepts two parameters, one is the name of the database and the other is the connection variable.

...

...

...

Something like this :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.