karimali831 Posted February 19, 2011 Share Posted February 19, 2011 two codes: does not echo the script... if($content1_1on1 || $content1_teams) { echo ''; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } does echo the script... if($content1_1on1 || $content1_teams) { echo 's'; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } can anyone tell me why it does not echo the script if there is nothing in the first echo?? I can't figure it out Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/ Share on other sites More sharing options...
cunoodle2 Posted February 19, 2011 Share Posted February 19, 2011 Do a "view html source" of your page after it runs to see if the html is there but not showing on screen for some reason. Also a php echo is always great for debugging.. Do this with your first IF statement.. <?php echo "<b>1 on 1 (location A) value is:</b>".$content1_1on1; echo "<b>teams (location A) value is:</b>".$content1_teams; if($content1_1on1 || $content1_teams) { echo "<b>1 on 1 (location B) value is:</b>".$content1_1on1; echo "<b>teams (location B) value is:</b>".$content1_teams; echo ''; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } Then do this with your SECOND If statement... <?php echo "<b>1 on 1 (location C) value is:</b>".$content1_1on1; echo "<b>teams (location C) value is:</b>".$content1_teams; if($content1_1on1 || $content1_teams) { echo "<b>1 on 1 (location D) value is:</b>".$content1_1on1; echo "<b>teams (location D) value is:</b>".$content1_teams; echo 's'; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } ?> Based upon that you should be able to trace through your code and see what the actual values are. I'm guessing that the variables change in your code and you are just overlooking something. Also as a side note I'm really not understanding why you have an "echo '';" in your first IF statement. What is it doing? Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176917 Share on other sites More sharing options...
karimali831 Posted February 19, 2011 Author Share Posted February 19, 2011 I did try debugging, this is output of your code: 1 on 1 (location A) value is:X1Kaz vs test7 X1Kaz vs test8 teams (location A) value is:1 on 1 (location B) value is:X1Kaz vs test7 X1Kaz vs test8 teams (location B) value is: 1 on 1 (location C) value is:X1Kaz vs test7 X1Kaz vs test8 teams (location C) value is:1 on 1 (location D) value is:X1Kaz vs test7 X1Kaz vs test8 teams (location D) value is:s this is why it is wierd because it will only ECHO the script if there is a a string contained in the echo. Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176923 Share on other sites More sharing options...
karimali831 Posted February 19, 2011 Author Share Posted February 19, 2011 example two.. does not display script at all ... if($header1 && ($content1_1on1 || $content1_teams)) { ?><script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script><?php } does display script fine... if($header1 && ($content1_1on1 || $content1_teams)) { ?>2<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script><?php } Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176926 Share on other sites More sharing options...
PaulRyan Posted February 19, 2011 Share Posted February 19, 2011 You will most likely have to post more than just that code Karimali831. That alone is not enough to work from. Regards, PaulRyan. Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176928 Share on other sites More sharing options...
karimali831 Posted February 19, 2011 Author Share Posted February 19, 2011 Ok, here: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script src="js/jquery-1.3.2.js"></script> <script src="js/jquery.jgrowl.js"></script> <link rel="stylesheet" type="text/css" href="css/jquery.jgrowl.css"/> <style type="text/css"> div.jGrowl div.iphone { font-family: "Helvetica Neue", "Helvetica"; font-size: 12px; background: url(iphone.png) no-repeat; -moz-border-radius: 0px; -webkit-border-radius: 0px; opacity: .90; filter: alpha(opacity = 90); width: 245px; height: 137px; padding: 0px; overflow: hidden; border-color: #5ab500; color: #fff; } div.jGrowl div.iphone div.message { padding-top: 0px; padding-bottom: 7px; padding-left: 15px; padding-right: 15px; } div.jGrowl div.iphone div.header { padding: 7px; padding-left: 15px; padding-right: 15px; font-size: 17px; } div.jGrowl div.iphone div.close { display: none; } div#random { width: 1000px; background-color: red; line-height: 60px; } </style> </head> </html> <?php include("config.php"); if($loggedin) { $query_1on1=safe_query("SELECT * FROM ".PREFIX."cup_matches WHERE 1on1='1' && confirmscore='0' && (clan1='$userID' || clan2='$userID')"); $query_teams=safe_query("SELECT * FROM ".PREFIX."cup_matches WHERE 1on1='0' && confirmscore='0' && (clan1='".participantTeamID($userID)."' || clan2='".participantTeamID($userID)."')"); $totalRows = mysql_num_rows($query_1on1)+mysql_num_rows($query_teams); if(mysql_num_rows($query_1on1) || mysql_num_rows($query_teams)) $header1 = $unconfirmed_result.($totalRows>1 ? "s" : ""); while($ds=mysql_fetch_array($query_1on1)) { $league = league($ds['matchID']); $type = getleagueType($ds['matchID']); $content1_1on1.=getname1($ds['clan1'],$ds[$type],$ac=0,$league).' vs '.getname1($ds['clan2'],$ds[$type],$ac=0,$league).' <a href='.matchlink($ds['matchID'],$ac=0,$tg=0,$redirect=0).'><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br>'; } while($ds1=mysql_fetch_array($query_teams)) { $league = league($ds1['matchID']); $type = getleagueType($ds1['matchID']); $content1_teams.=getname1($ds1['clan1'],$ds1[$type],$ac=0,$league).' vs '.getname1($ds1['clan2'],$ds1[$type],$ac=0,$league).' - <a href='.matchlink($ds1['matchID'],$ac=0,$tg=0,$redirect=0).'><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br>'; } } if($header1 && ($content1_1on1 || $content1_teams)) { ?>2<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script><?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176930 Share on other sites More sharing options...
cunoodle2 Posted February 19, 2011 Share Posted February 19, 2011 What does "View > Source" show you in the html body of the page? Is anything there? I would change your variable names to be honest. The number "1" and the LOWER case letter "L" look exactly identicle and I'm wondering if you typed something wrong. Also it is hard to read your echo debugging code. Do this instead to make it easier to read.. Change all of the echo lines from this... echo "<b>1 on 1 (location A) value is:</b>".$content1_1on1; echo "<b>teams (location A) value is:</b>".$content1_teams; To this.. echo "<b>1 on 1 (location A) value is:</b>--".$content1_1on1."--<br />\n"; echo "<b>teams (location A) value is:</b>--".$content1_teams."--<br />\n"; That will make it much clearer to read. Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176931 Share on other sites More sharing options...
karimali831 Posted February 19, 2011 Author Share Posted February 19, 2011 ahh ok, I viewed page source where the script WOULD NOT echo and this is what I see: </html> <script type='text/javascript'>$.jGrowl('<b>Unconfirmed Results</b> <br><br> <a href="?site=profile&id=1"><b>X1Kaz</b></a> vs <a href="?site=profile&id=2619"><b>test7</b></a> <a href="?site=cup_matches&matchID=2084&laddID=23" ><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br><a href="?site=profile&id=1"><b>X1Kaz</b></a> vs <a href="?site=profile&id=2620"><b>test8</b></a> <a href="?site=cup_matches&matchID=2083&laddID=23" ><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br> <br> ');</script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> the script is in the SOURCE but not show on the page? Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176933 Share on other sites More sharing options...
karimali831 Posted February 19, 2011 Author Share Posted February 19, 2011 and your second request... 1 on 1 (location A) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location A) value is:---- 1 on 1 (location B) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location B) value is:---- 1 on 1 (location C) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location C) value is:---- 1 on 1 (location D) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location D) value is:---- s2 vars must be right also because data in output is correct. It is just the script not executing if there is no string in echo. Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176934 Share on other sites More sharing options...
karimali831 Posted February 19, 2011 Author Share Posted February 19, 2011 it's annoying that I can't just echo " <script..." it has to be a character, number, symbol or something. if it's invisible string that's fine.. at least it resolves the problem?? Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176936 Share on other sites More sharing options...
BlueSkyIS Posted February 19, 2011 Share Posted February 19, 2011 why is there a closing HTML tag, then a SCRIPT tag, then a DOCTYPE, then an opening HTML tag? that could have profound effects on the execution of the javascript. </html> <script type='text/javascript'>$.jGrowl('<b>Unconfirmed Results</b> <br><br> <a href="?site=profile&id=1"><b>X1Kaz</b></a> vs <a href="?site=profile&id=2619"><b>test7</b></a> <a href="?site=cup_matches&matchID=2084&laddID=23" ><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br><a href="?site=profile&id=1"><b>X1Kaz</b></a> vs <a href="?site=profile&id=2620"><b>test8</b></a> <a href="?site=cup_matches&matchID=2083&laddID=23" ><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br> <br> ');</script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176938 Share on other sites More sharing options...
karimali831 Posted February 19, 2011 Author Share Posted February 19, 2011 OOPZ yeah that was it! Now fixed! Nothing is wierd now. thanks for pointing that one out... :D Quote Link to comment https://forums.phpfreaks.com/topic/228227-please-help-something-is-wierd/#findComment-1176942 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.