already tried that, and it really couldn’t matter much whether i used single quote or double quotes for the varying roles. i tried both ways, but neither worked. what actually happened though is my friend helped me out by writing a seperate script for the function that’s called that uses mysql_data_seek. here’s the script:
[php]
function printcomments( $tablename, $id, $offset=“10” ) {
$comments_querystring = "SELECT title, author, date, post FROM ".$tablename." WHERE id = '".$id."' LIMIT ".$offset;
$comments_query = mysql_query($comments_querystring) or die( "Couldn't query: ".mysql_error() );
$comments_output = "<table>";
for($i=0; $i < 10; $i++) {
if( !mysql_data_seek( $comments_query, $i ) ) {
break;
};
$comments_object = mysql_fetch_object($comments_query);
$comments_output .= "<tr><td><b>title:</b> ".$comments_object->title."</td></tr>";
$comments_output .= "<tr><td><b>posted by:</b> ".$comments_object->author." on ".$comments_object->date."</td></tr>";
$comments_output .= "<tr><td><b>comment:</b><br />n".$comments_object->post."</td></tr>";
}
$comments_output .= "</table>";
return $comments_output;
}[/php]
the function is stored in a seperate file from the script calling the function.
the results of calling this script from a seperate documment, view_comments.php (see below for script) can be seen at http://www.time2changefbcy.com/view_com … ype=a&id=9
script of view_comments.php:
[php]
if( isset( $_GET[‘type’] ) and isset( $_GET[‘id’] ) ) {
$type = $_GET[‘type’];
$id = $_GET[‘id’];
include( "mysql_info.php" );
$conn = mysql_connect( "localhost", $mysql_username, $mysql_password );
mysql_select_db( "time2ch_comments" );
include( "printcomments.php" );
if( $type == "a" ) {
if( isset( $_GET['offset'] ) ){
printcomments( "article", $id, $_GET['offset'].", 10" );
} else {
printcomments( "article", $id );
};
} elseif( $type == "p" ) {
if( isset( $_GET['offset'] ) ) {
printcomments( "poll", $id, $_GET['offset'].", 10" );
} else {
printcomments( "poll", $id );
};
};
mysql_close( $conn );
} else {
print “Error: Link has incorrect syntax.
n
Please contact the webmaster.
n
Include the following: n
- Name
n
- Time of error
n
- Which article or poll you were trying to comment on
n”;
};[/php]