Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cabbit

macrumors 68020
Original poster
Jan 30, 2006
2,128
1
Scotland
hi hi i seem to get the following error
Notice: Use of undefined constant jennifersp - assumed 'jennifersp' in
followed by
/home/fhlinux169/t/test.jennifersplaygroup.co.uk/user/htdocs/stories.php on line 31

Notice: Use of undefined constant id - assumed 'id' in /home/fhlinux169/t/test.jennifersplaygroup.co.uk/user/htdocs/stories.php on line 35

Notice: Use of undefined constant title - assumed 'title' in /home/fhlinux169/t/test.jennifersplaygroup.co.uk/user/htdocs/stories.php on line 35

Notice: Use of undefined constant author - assumed 'author' in /home/fhlinux169/t/test.jennifersplaygroup.co.uk/user/htdocs/stories.php on line 35

and it keeps repeating and repeating.

You can see for your self on http://www.test.jennifersplaygroup.co.uk/ and click on the story book's link. or the un embedded version is http://www.test.jennifersplaygroup.co.uk/stories.php. The error happens with or without being embedded so i can safely rule that one out.
 
We will need to see line 31 of your PHP code on the file stories.php. Possibly line 35, too.

If I had to take a guess, I would say you are using a viariable without first declaring it. Since it is only a "Notice", it shouldn't be preventing the rest of the code from running.

You can turn off Notices from displaying in your php.ini file, or you can declare the variable first before trying to read it. For example, you could say $jennifersp = ""; if that is indeed avariable you are trying to use.
 
We will need to see line 31 of your PHP code on the file stories.php. Possibly line 35, too.

If I had to take a guess, I would say you are using a viariable without first declaring it. Since it is only a "Notice", it shouldn't be preventing the rest of the code from running.

You can turn off Notices from displaying in your php.ini file, or you can declare the variable first before trying to read it. For example, you could say $jennifersp = ""; if that is indeed avariable you are trying to use.

Code:
<?php
$host = "";
$username = "";
$password = "";
$database = "";
$server = mysql_connect($host, $username, $password);
$connection = mysql_select_db($database, $server);
$server = mysql_connect($host, $username, $password);
$db = mysql_select_db(jennifersp, $server);
$sql = mysql_query('SELECT * FROM `storys` ORDER BY `id` DESC');
print "<table><tr><th>Story</th><th>Author</th><th>Comments</th></tr>";
while($row = mysql_fetch_array($sql, MYSQL_BOTH)) {
printf("<tr><td><a href='/themes/zen/story_display.php?id=%s'>%s</a></td><td><span style=\"TEXT-ALIGN:center\">%s</span></td><td colspan=2><A HREF=\"javascript:popUp('./story_comment_whole.php?id=%s')\">View</A><br /><br /></td>", $row[id], $row[title], $row[author], $row[id]);
}
?>
</table>
 
In the end of the printf line of code,
Code:
, $row[id], $row[title], $row[author], $row[id]);
you should have quotation marks around the array keys, like this:
Code:
, $row["id"], $row["title"], $row["author"], $row["id"]);
 
If this is in line 35, it should be:
Code:
..., $row["id"], $row["title"], $row["author"], $row["id"]);
and in line 31:
Code:
$db = mysql_select_db("jennifersp", $server);
I think you forgot the quotes....
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.