|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
macrumors 65816
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 |
| View Public Profile |
| Find More Posts by babyjenniferLB |
|
|
#2 |
|
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 |
| View Public Profile |
| Find More Posts by macfaninpdx |
|
|
#3 | |
|
Thread Starter
macrumors 65816
Join Date: Jan 2006
Location: Scotlands
|
Quote:
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 |
| View Public Profile |
| Find More Posts by babyjenniferLB |
|
|
#4 |
|
macrumors regular
Join Date: Mar 2007
|
In the end of the printf line of code,
Code:
, $row[id], $row[title], $row[author], $row[id]); Code:
, $row["id"], $row["title"], $row["author"], $row["id"]); |
|
|
|
| macfaninpdx |
| View Public Profile |
| Find More Posts by macfaninpdx |
|
|
#5 |
|
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"]); Code:
$db = mysql_select_db("jennifersp", $server);
__________________
2.33GHz 17" MBP 2GB/160GB, 10.5.4 |
|
|
|
|
|
#6 |
|
Thread Starter
macrumors 65816
Join Date: Jan 2006
Location: Scotlands
|
thank you, fixed.
|
|
|
|
| babyjenniferLB |
| View Public Profile |
| Find More Posts by babyjenniferLB |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|