Hi there Brad,
I changed the function to what you suggested(escaping the quotes in the center), but I'm still getting nothing as a result.
Here's my code in it's entirety(I'm sorry for the length, but I imagine my problem lies in the fact that I messed up somewhere else along the way):
include("config.php");
/*this query will get the needed information to create the block as you would like it*/
$result = mysql_query("SELECT debug,main_showtitle,main_showdate,main_showauth,main_showauthweb FROM ".$prefix."config");
while ($row = mysql_fetch_assoc($result)) {
$debug = $row['debug'];
$main_showtitle = $row['main_showtitle'];
$main_showdate = $row['main_showdate'];
$main_showauth = $row['main_showauth'];
$main_showauthweb = $row['main_showauthweb'];
if($debug==1){
error_reporting(E_ALL);
}
//function queryError() {
//echo ("<div align='center'><h2>Woops!</h2></div><br/>
//<p>Looks like there was an error with a MySQL query.</p>");
// }
function queryError() {
echo "<div align=\"center\"><h2>Woops!</h2></div><br/>\n"
. "<p>Looks like there was an error with a MySQL query.</p>\n";
}
echo("<html>
<head>
<title>Automonial</title>
<script language=\"javascript\" type=\"text/javascript\">
<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos==\"random\"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos==\"center\"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!=\"center\" && pos!=\"random\") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
</head>
<body>
<div align=\"center\">");
if(isset($_GET['id'])){
$id = $_GET['id'];
echo ("Below is the requested testimonial. Would you like to <a href=\"form.php\" onclick=\"NewWindow(this.href,'submit','600','400','yes','center');return false\" onfocus=\"this.blur()\">submit your own</a>?
<TABLE border=\"0\" width=\"500\"><tr><td>\n"); //Create the initial table
/* this query will get all of the testimonials */
$query = ("SELECT id,active,author,authorweb,authorwebname,title,testtext," .
"DATE_FORMAT(postdate, '%M %D, %Y') as date " .
"FROM ".$prefix."testimonials WHERE id=$id");
$result = mysql_query ($query) or queryError();
while ($row = mysql_fetch_assoc ($result)) {
/* display testimonials in a simple table */
$active = $row['active'];
if($active != 1){
echo("This testimonial is not active.");
}else{
$date = $row['date'];
$author = stripslashes ($row['author']);
$authorweb = stripslashes ($row['authorweb']);
$authorwebname = stripslashes ($row['authorwebname']);
$title = stripslashes ($row['title']);
$testtext = stripslashes ($row['testtext']);
/* display the data */
echo("<div align=center>
<table width=90% border=1 cellpadding=1 cellspacing=1>
<tr>
<td bgcolor='#ffffff' width=400>");
if($main_showtitle == 1) {
echo(" <font size=3><b>$title</b></font>");
}
echo("</td>
<td bgcolor='#ffffff' width=200>");
if($main_showdate == 1) {
echo(" <font size=1>Added On: $date</font>");
}
echo("</td>
</tr>
<tr>
<td bgcolor='#ffffff' colspan=2>");
if($main_showauth == 1) {
echo("<font size=1>Posted By: $author</font> ");
}
if($authorweb != "") {
if($main_showauthweb == 1) {
echo("<font size=1>Website: <a href='$authorweb' target='_blank'>$authorwebname</a></font>");
}
}
echo("
</td>
</tr>
<tr>
<td bgcolor='#ffffff' colspan=2>
<font size=2>$testtext</font><p>
</td>
</tr>
</table>
</div><br>
<br>");
}
}
echo ("</td></tr></table>");
}else{
echo ("Below is a complete list of our testimonials. Would you like to <a href=\"form.php\" onclick=\"NewWindow(this.href,'submit','600','400','yes','center');return false\" onfocus=\"this.blur()\">submit your own</a>?
<TABLE border=\"0\" width=\"500\"><tr><td>\n"); //Create the initial table
/* this query will get all of the testimonials */
$query = ("SELECT id,active,author,authorweb,authorwebname,title,testtext," .
"DATE_FORMAT(postdate, '%M %D, %Y') as date " .
"FROM ".$prefix."testimonials WHERE active=1 ORDER BY postdate DESC");
$result = mysql_query ($query) or queryError();
while ($row = mysql_fetch_assoc ($result)) {
/* display testimonials in a simple table */
$date = $row['date'];
$author = stripslashes ($row['author']);
$authorweb = stripslashes ($row['authorweb']);
$authorwebname = stripslashes ($row['authorwebname']);
$title = stripslashes ($row['title']);
$testtext = stripslashes ($row['testtext']);
/* display the data */
echo("<div align=center>
<table width=90% border=1 cellpadding=1 cellspacing=1>
<tr>
<td bgcolor='#ffffff' width=400>");
if($main_showtitle == 1) {
echo(" <font size=3><b>$title</b></font>");
}
echo("</td>
<td bgcolor='#ffffff' width=200>");
if($main_showdate == 1) {
echo(" <font size=1>Added On: $date</font>");
}
echo("</td>
</tr>
<tr>
<td bgcolor='#ffffff' colspan=2>");
if($main_showauth == 1) {
echo("<font size=1>Posted By: $author</font> ");
}
if($authorweb != "") {
if($main_showauthweb == 1) {
echo("<font size=1>Website: <a href='$authorweb' target='_blank'>$authorwebname</a></font>");
}
}
echo("
</td>
</tr>
<tr>
<td bgcolor='#ffffff' colspan=2>
<font size=2>$testtext</font><p>
</td>
</tr>
</table>
</div><br>
<br>");
}
echo ("</td></tr></table>");
}
}
echo("</div>
</body>
</html>");
If I choose an id of 37, which exists, but is not active, it tells me that it's not active. If I choose an id of 1, it shows the proper record. If I don't pass an id, it posts all of the records, but if I post an id of 12(which doesn't exist), it shows nothing after asking if I'd like to submit a testimonial of my own.
See any mistakes that would keep it from working?
thanks,
json