Page 1 of 1

php window location

Posted: Sun Apr 04, 2004 8:37 am
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

Posted: Sun Apr 04, 2004 1:00 pm
by Illusionist
try

Code: Select all

header("Location: page7.html");

Posted: Sun Apr 04, 2004 2:22 pm
by vigge89
just a reminder, you cannot use [php_man]header[/php_man] if you already have sent output to the browser...

Re: php window location

Posted: Sun Apr 04, 2004 5:37 pm
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.

Re: php window location

Posted: Sun Apr 04, 2004 5:42 pm
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...

Posted: Sun Apr 04, 2004 5:46 pm
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.

Posted: Sun Apr 04, 2004 5:48 pm
by Illusionist
i didn't try to fix it. It was never my intention to 'fix' anything with it.

Posted: Sun Apr 04, 2004 5:49 pm
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 {

Posted: Sun Apr 04, 2004 5:50 pm
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.

Posted: Sun Apr 04, 2004 5:57 pm
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.

Posted: Sun Apr 04, 2004 6:00 pm
by d3ad1ysp0rk
Ya, it would.

everything databases can do, text files can too.

Don't start acting all high and mighty.

Posted: Sun Apr 04, 2004 6:07 pm
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