Jump to content

Please help! something is wierd...


karimali831

Recommended Posts

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 :(

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

example two..

 

does not display script at all ...  :wtf:  :shrug:

 

  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... :)  8)

 

  if($header1 && ($content1_1on1 || $content1_teams)) {
     ?>2<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script><?php
}

Link to comment
Share on other sites

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
}

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.