...

View Full Version : Open new Window



Switch17
03-30-2004, 03:09 AM
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?

Nightfire
03-30-2004, 01:02 PM
Just have an if statement


if($PnTeamID == $AT2){
//put javascript window here
}

Switch17
03-30-2004, 06:37 PM
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"

Steveo31
03-30-2004, 10:13 PM
Yes. Make a new window and have JS open that window.

Switch17
03-31-2004, 01:33 AM
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.
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')">
}

Spookster
03-31-2004, 01:58 AM
<?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
}
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum