Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Open new Window

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open new Window

    Can anyone give me a few pointers on how to do a sql compare, and if I have a match to open up a new window?

    I have this code there
    $sql = "SELECT Trax_ID FROM $REACTION where $AT2";
    $result = mysql_query($sql);
    $cycle = mysql_num_rows($result);
    for ($i = 0; $i < $cycle; $i++)
    {
    $row = mysql_fetch_row($result);
    $sql = "INSERT INTO scratch VALUES (".$row[0].")";
    mysql_query($sql);
    and I want to compare a $PnTeamID variable to the the $AT2. And if I have a match to open a new window, and if not, then just do nothing. Can php do this?

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Just have an if statement
    PHP Code:
    if($PnTeamID == $AT2){
      
    //put javascript window here


  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, thanks

    i'm reading up on how to do this now. Will it be easier to create a new page, and have the newwindow open up the new page?

    All I'm want it to do is to look for a match and if I have a match, tell me "You have new trade offers"

  • #4
    New Coder
    Join Date
    Feb 2004
    Location
    California
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes. Make a new window and have JS open that window.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, I'm at a complete loss at to how you include javascript inside the if statement. I'm still a rookie at php, and do understand a little bit. But this is obviously wrong, as I think i need a few echo statements at the least.
    Code:
       if ($AT2 = $PnTeamID) {
       	 <SCRIPT LANGUAGE = "JavaScript">
       	 <!--
    	function SmallWindow1(wintype) {
    
    	SmallWin=window.open(wintype,"SmallWin","toolbar=no,directories=no,status=no,scrollbars=no,menubar=no,width=360,height=210"); SmallWin.window.focus() }
    
    	 -->
    	</SCRIPT>
    	</head>
    	<BODY onload="JavaScript:SmallWindow1('example.html')">
    	}

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    PHP Code:

    <?php
    if($AT2 == $PnTeamID){
    ?>

    <SCRIPT LANGUAGE = "JavaScript">
    <!--
    function SmallWindow1(wintype) {
        SmallWin=window.open(wintype,"SmallWin","toolbar=no,directories=no,status=no,scrollbars=no,  menubar=no,width=360,height=210"); SmallWin.window.focus()
    }
    window.onload = SmallWindow1('example.html');
    //-->
    </SCRIPT>

    <?php
    }
    ?>
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •