php window location

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mainy
Forum Newbie
Posts: 1
Joined: Sun Apr 04, 2004 8:37 am

php window location

Post by mainy »

why can i not get this to work? i want to relocate my window page.

Code: Select all

$numrows = ora_numrows($cursor);

        if ($numrows=="1"){
    	echo "<script language="JavaScript">";
    	echo "window.location="page7.html"";
    	echo "</script>";
    	return;

		else
		echo "record not found";
		&#125;
any help would be great
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

try

Code: Select all

header("Location: page7.html");
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

just a reminder, you cannot use [php_man]header[/php_man] if you already have sent output to the browser...
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Re: php window location

Post by d3ad1ysp0rk »

mainy wrote:why can i not get this to work? i want to relocate my window page.

any help would be great
I'm so glad you told us what was wrong.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Re: php window location

Post by Illusionist »

mainy wrote:

Code: Select all

$numrows = ora_numrows($cursor);

        if ($numrows=="1")&#123;
    	echo "<script language="JavaScript">";
    	echo "window.location="page7.html"";
    	echo "</script>";
    	return;

		else
		echo "record not found";
		&#125;
obviously this is what is wrong. Was it really that hard for you to understand that he was trying to redirect, and this wasn't working?? Wow...
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

yes but he didn't say what exactly happened, sorry I can't read minds.

posting a script and saying it doesnt work isnt exactly a good way to get help, and besides, you didn't fix it, you just gave him an alternative.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

i didn't try to fix it. It was never my intention to 'fix' anything with it.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

See, I ran it myself and got this:
Parse error: parse error, unexpected T_ELSE in C:\Documents and Settings\Administrator\Desktop\Server\test.php on line 7
Now if he had've told us that, I could've said just to add two brackets:

Code: Select all

//change:
return;
else 

//to
  return;
}
else {
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Illusionist wrote:i didn't try to fix it. It was never my intention to 'fix' anything with it.
"what's wrong with my sql?"
"try using fopen"

sure, it works, but he might've wanted to use javascript.. for some unknown reason.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

"what's wrong with my sql?"
"try using fopen"
Ya, that wouldn't work. Nice try though! Atleast my suggestion was correct, yours.. just wrong.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Ya, it would.

everything databases can do, text files can too.

Don't start acting all high and mighty.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

ya, ok, But a specific question regarding an sql statement, and a reply of "use fopen()" is totally wrong. For that to be possible, one would have to move everything from the database into a textfile.
Sorry dude
Post Reply