shujjah Posted June 15, 2008 Share Posted June 15, 2008 I have spent like 2 hours on it trying to figure out the problem but just couldn't find it so I thought I might consult you guys.I dont know where to start ok this is the getscreen function found in includes/media.inc.php function getScreenshots($gameId = '', $typeName = '', $template = 'screenshots') { $sql = "SELECT gamecms_image.imageId, gamecms_game.systemId, gamecms_game.gameId, gamecms_game.gameName FROM gamecms_image LEFT JOIN gamecms_game ON gamecms_image.gameId = gamecms_game.gameId WHERE gamecms_game.gameId='$gameId' AND gamecms_image.imageType='$typeName' AND gamecms_image.auth='1' ORDER BY gamecms_image.imageId DESC"; $this->db->query($sql); $screenCount = $this->db->num_rows(); $screenNumber = 1; If ($screenCount > 0) { while ($this->db->next_record()) { $imageId = $this->db->f("imageId"); $gameId = $this->db->f("gameId"); $gameName = $this->db->f("gameName"); $systemId = $this->db->f("systemId"); $sql = "SELECT * FROM gamecms_mediatype WHERE typeName='$typeName'"; $this->db2->query($sql); $this->db2->next_record(); $thumbX = $this->db2->f("thumbX"); $thumbY = $this->db2->f("thumbY"); include "./templates/".$template.".tpl.php"; $screenNumber++; } } else { echo "No screenshots available"; } } this is screenshots.tpl.php <a href="http://localhost/images/screenshots/<?php echo $imageId; ?>.jpg"><img src="http://localhost/images/screenshots/thumbs/<?php echo $imageId; ?>.jpg" alt="" width="<?php echo $thumbX; ?>" height="<?php echo $thumbY; ?>" style="border: 1px solid #000000;" /></a> this is popup.tpl.php <a href="#" onclick="popup('./screenViewer.php?gameId=<? echo $gameId; ?>&imageId=<? echo $imageId; ?>&screenNumber=<? echo $screenNumber; ?>&screenCount=<? echo $screenCount; ?>', 850, 675)" border="0"><img src="http://<?php echo $_SERVER['HTTP_HOST']; ?>/images/screenshots/thumbs/<? echo $imageId.".jpg"; ?>" style="border: 1px solid #000000;" title="<? echo $comment; ?>" width="<? echo $thumbX; ?>" height="<? echo $thumbY; ?>" border="0" /></a> Now only the part in red concerns my problemthis is gameinfo.php <?phprequire_once './php-bin/db_mysql.inc.php';$db = &new DB_Sql();$db2 = &new DB_Sql();include_once './includes/media.inc.php';$media = &new Media($db, $db2);include_once './includes/poll.inc.php';$poll = &new Poll($db);include_once './includes/game.inc.php';$game = &new Game($db);$gameId = $_REQUEST['gameId'];$system = $_REQUEST['system'];?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title><?php $game->getGameName($gameId); ?> - Gamerz Galore</title><link href="style.css" rel="stylesheet" type="text/css" /><script src="./js/popup.js"></script></head> <body> <div id="page"> <?php include './includes/topNav.inc.php'; ?> <?php include './includes/header.inc.php'; ?> <?php include './includes/loginBar.inc.php'; ?> <div id="left"> <?php include './includes/leftMenu.inc.php'; ?> <?php include './includes/leftSearch.inc.php'; ?> <?php include './includes/leftPoll.inc.php'; ?> <?php include './includes/leftScreen.inc.php'; ?> </div> <div id="right"> <?php include './includes/gameInfo.inc.php'; ?> </div> <div style="clear: both; margin-bottom: 10px;"></div> <div class="bar"> <?php include './includes/footer.inc.php'; ?> </div> </div> </body></html>this is gameinfo.inc.php<div id="newsheader1"> Game Information</div> <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $game->getGameInfo($gameId); ?> </td> </tr> </table> <div id="searchheader">Related Items</div> Screenshots <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $media->getScreenshots($gameId, 'Screenshot', 'popup'); ?> </td> </tr> </table> Reviews <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $game->getReviews1($gameId, 'Reviews'); ?> </td> </tr> </table> Previews <table id="news" cellspacing="0"> <tr> <td class="newslink1"><?php $game->getArticles1($gameId, 'Previews'); ?> </td> </tr> </table> Cheats <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $game->getCheats($gameId); ?> </td> </tr> </table> News <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $game->getNews($gameId); ?> </td> </tr> </table><div id="searchheader"></div>this is review.php<?phprequire_once './php-bin/db_mysql.inc.php';$db = &new DB_Sql();$db2 = &new DB_Sql();include_once './includes/media.inc.php';$media = &new Media($db, $db2);include_once './includes/poll.inc.php';$poll = &new Poll($db);include_once './includes/game.inc.php';$game = &new Game($db);include_once './includes/article.inc.php';$article = &new Article($db);include_once './includes/rating.inc.php';$rating = &new Rating($db);$articleId = $_REQUEST['articleId'];$system = $_REQUEST['system'];?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title><?php $article->getArticleName($articleId); ?> - Gamerz Galore</title><link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <div id="page"> <?php include './includes/topNav.inc.php'; ?> <?php include './includes/header.inc.php'; ?> <?php include './includes/loginBar.inc.php'; ?> <div id="left"> <?php include './includes/leftMenu.inc.php'; ?> <?php include './includes/leftSearch.inc.php'; ?> <?php include './includes/leftPoll.inc.php'; ?> <?php include './includes/leftScreen.inc.php'; ?> </div> <div id="right"> <?php include './includes/reviewPage.inc.php'; ?> </div> <div style="clear: both; margin-bottom: 10px;"></div> <div class="bar"> <?php include './includes/footer.inc.php'; ?> </div> </div> </body></html>and this is reviewpage.inc.php<?php$con = mysql_connect("localhost","root","");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("gamecms", $con);$result = mysql_query("SELECT gameId FROM gamecms_articleWHERE articleId='$articleId'");while($row = mysql_fetch_array($result)) { $gameId = $row['gameId']; }$article->getGameInfo($gameId);?> <div id="newsheader1"> Review</div> <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $article->getArticle($articleId); ?><?php $article->getPageContents($articleId, $_REQUEST['page'], 'reviewPage'); ?> </td> </tr> </table> Screenshots <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $media->getScreenshots($gameId, 'Screenshot','popup'); ?> </td> </tr> </table> <div id="newsheader1"> Verdict</div> <table id="news" cellspacing="0"> <tr> <td class="newslink"><?php $rating->getRatings($articleId); ?> </td> </tr> </table>Now here comes the problem as you can see I am using the same function in gameinfo.inc.php and in reviewpage.inc.php<?php $media->getScreenshots($gameId, 'Screenshot','popup'); ?> When I have opened gameinfo.inc.php the getscreenshots function works fine the thumbnails show and when I click on them a popup window opens ( screenviewer ) which shows the screenshots However when I have opened reviewpage.inc.php the screenshots thumbnails do show fine but when I click them nothing happens ? No popup window opens ? No screenviewer opens in a popup window.Now I don't understand I am using the exact same function but in one it seems to work fine and in the other it does not ?and the popup in the getscreenshots function corresponds to popup.tpl.phpPlease I have tried hard to find the problem but just couldn't. I know I might be overlooking a very basic principle but I just cant seem to figure it out.Thanks in advance for your help,Best Regards, Link to comment Share on other sites More sharing options...
jhecht Posted June 15, 2008 Share Posted June 15, 2008 perhaps there is an error in the PHP file before/after on reviewpage.php? By the way, Next time just give us the function and the two pages its not working on... we really don't need all the rest. I'm pretty sure thats why no one's responded yet, due to the fact that you gave ALOT of code. Link to comment Share on other sites More sharing options...
shujjah Posted June 15, 2008 Author Share Posted June 15, 2008 well if there is an error then I cant figure it out can you help me please ? Link to comment Share on other sites More sharing options...
jhecht Posted June 15, 2008 Share Posted June 15, 2008 well first we need to make sure we can see the errors. so let's add this at the top of every MAJOR page (I.E. not the page being included) ini_set('display_errors',1);error_reporting(E_ALL); If any red errors now show up, post 'em back so that we could read them. If not, then just post up the function definition and the two instances in which you are using them. I don't need to know about the TPL since its obviously not an issue with that otherwise the first case wouldn't work. Link to comment Share on other sites More sharing options...
shujjah Posted June 16, 2008 Author Share Posted June 16, 2008 Alright I got some errors firstly I get this in the top of both gameinfo.php and review.php Notice: Undefined index: system in D:\xampp\htdocs\gameInfo.php on line 14and then again I get this error in both gameinfo and review when I hover over the screenshot thumbnail I get that unidentified variable : comment in popup.tpl line 1 but yet still when I click on the thumbnail in gameinfo the popup window opens but not so in review.phpIf not, then just post up the function definition and the two instances in which you are using themAlright I posted the function in my first post. And in gameinfo I am using that function to get the screenshots of that game and in review.php I first get the gameid by using the articleid and then use the same screenshots functionThanks for your help Link to comment Share on other sites More sharing options...
boen_robot Posted June 16, 2008 Share Posted June 16, 2008 You might want to get yourself XDebug (and of course, install it), and then track the error from the verbose error message that will appear.XDebug, unlike the built in messages, also shows a trace of the error i.e. you can see the line in which the variable was first used when it shouldn't be. The error you see instead shows where the executed functioin is, but not where the function was defined, and not where the actual undefined index is.With your "db" and "db2" objects, the "getScreenshots" method starts to get really complicated, so a debugger like this will certainly ease the pain. Link to comment Share on other sites More sharing options...
shujjah Posted June 16, 2008 Author Share Posted June 16, 2008 I downloaded it and now I have no idea how to use it ? Isnt there a simpler way ?Edit sorry didnt see the install it link Link to comment Share on other sites More sharing options...
justsomeguy Posted June 17, 2008 Share Posted June 17, 2008 You're not including popup.js on the second page. Using something like Firebug or another debugger would help you find errors like that. Link to comment Share on other sites More sharing options...
shujjah Posted June 21, 2008 Author Share Posted June 21, 2008 popup.js I dont think I have a script pop.js ? I thought popup was a built in function ? Link to comment Share on other sites More sharing options...
Synook Posted June 21, 2008 Share Posted June 21, 2008 No. There is open() and alert() but no popup(). Link to comment Share on other sites More sharing options...
shujjah Posted June 21, 2008 Author Share Posted June 21, 2008 THANKS A TON EVERYONE especially like always justsomeguy . See I told you it must be a silly mistake that I just couldn't figure out lol Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.