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

Link to comment
Share on other sites

<?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

 

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.