bslevin
01-21-2006, 03:20 PM
Hello,
I am still new to JavaScript and have a simple JavaScript & PHP journal program that allows the user to enter a title and description to be automatically added to a page that list their journal entries.
Everything works fine except for one part that I am just lost on, at the bottom of the page there is a dropdown menu which lists monthly archives, but when you select any month from the list you get a script error and nothing happens. You are supposed to go to a page that would list al the entries from that month.
Any help would be greatly appreciated as I do not have the knowledge yet to fix this nor can I find the site that originally created this script.
Here is the Error I get:
An Error has occurred in the script of this page
Line: 100
Char: 8
Error: Object expected
Code: 0
URL: http://www.kingoftheheel.com/members/journal/journal.php
Here is the code from the page: (I cut out all the HTML so it is shorter)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>KingOfTheHeel.com - The </title>
<link rel=stylesheet type=text/css href="styles.css">
<style type="text/css">
A:link { color:#ffffcc; }
A:visited { color:#ffffcc; }
A:hover { color:red; }
BODY { FONT-SIZE: 12px; FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
SCROLLBAR-BASE-COLOR: #492263;
SCROLLBAR-ARROW-COLOR: #ffff66; /*
SCROLLBAR-3DLIGHT-COLOR: #000000;
SCROLLBAR-HIGHLIGHT-COLOR: #FF9999;
SCROLLBAR-SHADOW-COLOR: #FF9999;
SCROLLBAR-DARKSHADOW-COLOR: #660000;
SCROLLBAR-FACE-COLOR: #ffff66;
SCROLLBAR-TRACK-COLOR: #000000;*/
</style>
</head>
<body background="../images/stretch.jpg" bgcolor="Black" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 text="White" link="#ffffcc" vlink="#ffffcc" alink="#ffffcc">
<?
include ("common.php");
MYSQL_CONNECT($hostname,$username,$passwrd) OR DIE("Oh damn! Couldnt connect to the database, sorry mate!");
@mysql_select_db($dbName) or die("<strong class=black-large>Unable to select database</strong>");
if ($month)
{ $sortby = " WHERE $maintable.month='" . $month . "' " ;
$limit = " ";}
else {$sortby = " "; }
$query = "
SELECT $maintable.id, $maintable.thedate, $maintable.topic, $maintable.entry, count($commentstable.id) AS comments
FROM $maintable
LEFT OUTER JOIN $commentstable
ON $maintable.id = $commentstable.id
$sortby
GROUP BY $maintable.id
ORDER BY $maintable.id DESC
$limit";
$result = mysql_query($query) or die("<strong class=black-large>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");
if ($result) {
echo "<table border=0 cellspacing=0 cellpadding=5 width=$width align=center>";
while ($r = mysql_fetch_array($result)) {
extract($r);
$entry = nl2br($entry);
echo "
<tr bgcolor=492263><td><strong class=black>$topic</strong></td><td align=right><strong class=black>$thedate</strong></td></tr>
<tr bgcolor=492263><td colspan=2><small class=black-small>$entry</small><br></td></tr>
<tr bgcolor=492263><td colspan=2><hr color=ffffff size=1 width=100%></td></tr>
";
}
echo "</table><br>";
mysql_free_result($result);
}
$query2 = "SELECT month FROM $maintable GROUP BY month ORDER BY id";
$result2 = mysql_query($query2) or die("<strong class=black-large>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");
if ($result2) {
echo "<form><table border=0 cellspacing=0 cellpadding=5 width=$width align=center>
<td align=right colspan=2 valign=top>
<select onchange=\"GoUrl(this)\">
<option> previous journal entries for:
<option> ";
while ($r2 = mysql_fetch_array($result2)) {
extract($r2);
echo "<option value=index.php?month=$month><strong class=black-small> -> $month </strong>";
}
echo "</select> </td>
</tr></table></form> ";
mysql_free_result($result2);
}
mysql_close();
?>
</body>
</html>
thanks for any help you have, i am at a loss :thumbsup:
I am still new to JavaScript and have a simple JavaScript & PHP journal program that allows the user to enter a title and description to be automatically added to a page that list their journal entries.
Everything works fine except for one part that I am just lost on, at the bottom of the page there is a dropdown menu which lists monthly archives, but when you select any month from the list you get a script error and nothing happens. You are supposed to go to a page that would list al the entries from that month.
Any help would be greatly appreciated as I do not have the knowledge yet to fix this nor can I find the site that originally created this script.
Here is the Error I get:
An Error has occurred in the script of this page
Line: 100
Char: 8
Error: Object expected
Code: 0
URL: http://www.kingoftheheel.com/members/journal/journal.php
Here is the code from the page: (I cut out all the HTML so it is shorter)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>KingOfTheHeel.com - The </title>
<link rel=stylesheet type=text/css href="styles.css">
<style type="text/css">
A:link { color:#ffffcc; }
A:visited { color:#ffffcc; }
A:hover { color:red; }
BODY { FONT-SIZE: 12px; FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
SCROLLBAR-BASE-COLOR: #492263;
SCROLLBAR-ARROW-COLOR: #ffff66; /*
SCROLLBAR-3DLIGHT-COLOR: #000000;
SCROLLBAR-HIGHLIGHT-COLOR: #FF9999;
SCROLLBAR-SHADOW-COLOR: #FF9999;
SCROLLBAR-DARKSHADOW-COLOR: #660000;
SCROLLBAR-FACE-COLOR: #ffff66;
SCROLLBAR-TRACK-COLOR: #000000;*/
</style>
</head>
<body background="../images/stretch.jpg" bgcolor="Black" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 text="White" link="#ffffcc" vlink="#ffffcc" alink="#ffffcc">
<?
include ("common.php");
MYSQL_CONNECT($hostname,$username,$passwrd) OR DIE("Oh damn! Couldnt connect to the database, sorry mate!");
@mysql_select_db($dbName) or die("<strong class=black-large>Unable to select database</strong>");
if ($month)
{ $sortby = " WHERE $maintable.month='" . $month . "' " ;
$limit = " ";}
else {$sortby = " "; }
$query = "
SELECT $maintable.id, $maintable.thedate, $maintable.topic, $maintable.entry, count($commentstable.id) AS comments
FROM $maintable
LEFT OUTER JOIN $commentstable
ON $maintable.id = $commentstable.id
$sortby
GROUP BY $maintable.id
ORDER BY $maintable.id DESC
$limit";
$result = mysql_query($query) or die("<strong class=black-large>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");
if ($result) {
echo "<table border=0 cellspacing=0 cellpadding=5 width=$width align=center>";
while ($r = mysql_fetch_array($result)) {
extract($r);
$entry = nl2br($entry);
echo "
<tr bgcolor=492263><td><strong class=black>$topic</strong></td><td align=right><strong class=black>$thedate</strong></td></tr>
<tr bgcolor=492263><td colspan=2><small class=black-small>$entry</small><br></td></tr>
<tr bgcolor=492263><td colspan=2><hr color=ffffff size=1 width=100%></td></tr>
";
}
echo "</table><br>";
mysql_free_result($result);
}
$query2 = "SELECT month FROM $maintable GROUP BY month ORDER BY id";
$result2 = mysql_query($query2) or die("<strong class=black-large>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");
if ($result2) {
echo "<form><table border=0 cellspacing=0 cellpadding=5 width=$width align=center>
<td align=right colspan=2 valign=top>
<select onchange=\"GoUrl(this)\">
<option> previous journal entries for:
<option> ";
while ($r2 = mysql_fetch_array($result2)) {
extract($r2);
echo "<option value=index.php?month=$month><strong class=black-small> -> $month </strong>";
}
echo "</select> </td>
</tr></table></form> ";
mysql_free_result($result2);
}
mysql_close();
?>
</body>
</html>
thanks for any help you have, i am at a loss :thumbsup: