0

I've been trying to create a database-driven site, am new to this, have looked it up on Google and tried for myself, but need a bit of help.

<?php
// Connects to your Database
mysql_connect("localhost", "root", "PASSWORDREMOVED") or die(mysql_error());
mysql_select_db("epguides") or die(mysql_error());
$data = mysql_query("SELECT * FROM epguides)
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<td><b>".$info['programdata'] </b>" </td>";
Print " showing on ";
Print ".$info['channel'] ";
Print "<td>".$info['airdate'] </td>";
Print "<td>".$info['episode'] </td>";
Print "<td>"<img src="exclamationmark.gif" height="16" width="22">";
Print "<a href="http://mylocalhostsite/setreminder">Set Reminder</a>"</td></tr>";
}
Print "</table>";
?>

I used this code and it gave the following errors:

Parse error: syntax error, unexpected T_STRING in C:\www\vhosts\mytvsite\testguide.php on line 7

How would I fix these for myself, since I'm new to this sort of thing?

4
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by Arianna
0

Quite a lot of inconsistencies with the quotes is the problem. If you're putting quotes inside a string, they need to be single quotes, not double ones. Try this code.

<?php
// Connects to your Database
mysql_connect("localhost", "root", "PASSWORDREMOVED") or die(mysql_error());
mysql_select_db("epguides") or die(mysql_error());
$data = mysql_query("SELECT * FROM epguides)
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<td><b>" . $info['programdata'] . "</b></td>";
Print " showing on ";
Print $info['channel'];
Print "<td>" . $info['airdate'] . "</td>";
Print "<td>" . $info['episode'] . "</td>";
Print "<td><img src='exclamationmark.gif' height='16' width='22'>";
Print "<a href='http://mylocalhostsite/setreminder'>Set Reminder</a></td></tr>";
}
Print "</table>";
?>
0

I'm now getting this error:

Parse error: syntax error, unexpected T_STRING in C:\www\vhosts\mylocalhostsite\test1.php on line 5

I tried your code and got the above error...

Edited by whitestream6: n/a

0

Line 5 is just missing one it's quotes. It should look like this:

$data = mysql_query("SELECT * FROM epguides")
0

Good point to not forget about the semicolon, it's a very common mistake ... however if you leave line 6 or die(mysql_error()); the way it is you won't need to add it.

0

Ah, sorry for forgetting that! It should work now, as the others have said. Have you tried it?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.