Register FAQ/Rules Forum Spy Search Today's Posts Mark Forums Read

Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate.

 
Go Back   Mac Forums > Special Interests > Web Design and Development
TouchArcade.com - iPhone Game Reviews and News

Reply
 
Thread Tools Search this Thread  
Old Jun 1, 2007, 04:43 PM   #1
babyjenniferLB
macrumors 65816
 
babyjenniferLB's Avatar
 
Join Date: Jan 2006
Location: Scotlands
Notice: Use of undefined constant PHP ERROR HELP PLEASE

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.
babyjenniferLB is offline   Reply With Quote
Old Jun 1, 2007, 06:25 PM   #2
macfaninpdx
macrumors regular
 
Join Date: Mar 2007
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.
macfaninpdx is offline   Reply With Quote
Old Jun 1, 2007, 06:41 PM   #3
babyjenniferLB
Thread Starter
macrumors 65816
 
babyjenniferLB's Avatar
 
Join Date: Jan 2006
Location: Scotlands
Quote:
Originally Posted by macfaninpdx View Post
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>
babyjenniferLB is offline   Reply With Quote
Old Jun 1, 2007, 06:50 PM   #4
macfaninpdx
macrumors regular
 
Join Date: Mar 2007
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"]);
macfaninpdx is offline   Reply With Quote
Old Jun 1, 2007, 06:50 PM   #5
fwhh
macrumors regular
 
Join Date: Aug 2004
Location: Berlin, Germany
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....
__________________
2.33GHz 17" MBP 2GB/160GB, 10.5.4
fwhh is offline   Reply With Quote
Old Jun 2, 2007, 12:03 PM   #6
babyjenniferLB
Thread Starter
macrumors 65816
 
babyjenniferLB's Avatar
 
Join Date: Jan 2006
Location: Scotlands
thank you, fixed.
babyjenniferLB is offline   Reply With Quote

Reply

Mac Forums > Special Interests > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:01 AM.

Mac News | Mac Rumors | iPhone Game Reviews | iPhone Apps

Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 2002-2009, MacRumors.com, LLC