Jump to content

Echoing data from a mysql database error


blink359

Recommended Posts

Hi,

 

Im getting this error with my script that im using to try and echo content for my website:

Parse error: syntax error, unexpected T_ECHO in /home/a9855336/public_html/test.php on line 16

my php code is

<?php
$host="mysql12.000webhost.com"; // Host name 
$username="a9855336_root"; // Mysql username 
$password="n4th4n%"; // Mysql password 
$db_name="a9855336_mail"; // Database name 

// Connect to server and select databse.
mysql_connect($host, $username, $password);
mysql_select_db($db_name);


$query  = "SELECT title, content, FROM members where ID = 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result)

echo $row['title'];

?>
html stuff
<?php

echo $row['content'];

?>

 

If anyone can help me fix this problem or sugguest a dfiferent way to go about this it would  be greatly appriciated.

 

Thanks,

 

Blink359

<?php
$host="mysql12.000webhost.com"; // Host name 
$username="a9855336_root"; // Mysql username 
$password="n4th4n%"; // Mysql password 
$db_name="a9855336_mail"; // Database name 

// Connect to server and select databse.
mysql_connect($host, $username, $password);
mysql_select_db($db_name);


$query  = "SELECT title, content, FROM members WHERE id = '1'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);

echo $row['title'];
echo $row['content'];

?>

Its now got the semi colon but

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9855336/public_html/test.php on line 14

Its this i was initially wanting to get fixed i obviously took the semi colon out by axedent before post

 

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.