5 Replies - 2880 Views - Last Post: 24 October 2008 - 11:51 AM Rate Topic: -----

#1 Guest_DonWar*


Reputation:

PHP Help ... ("Location: logged_in.php")

Posted 23 October 2008 - 10:15 AM

Am making a mafia site and am codin the crew part ..

I wont it to move to different pages by the database data.

Am connected to the database.
<?php
if ($fetch->crew=="None")
echo header("Location: logged_in.php")
else echo " Well come to your crew.";
?>


Can any body tell me why this isnt working?

Daz.

This post has been edited by William_Wilson: 23 October 2008 - 03:30 PM

Is This A Good Question/Topic? 0

Replies To: PHP Help ... ("Location: logged_in.php")

#2 akozlik   User is offline

  • D.I.C Addict
  • member icon

Reputation: 91
  • View blog
  • Posts: 798
  • Joined: 25-February 08

Re: PHP Help ... ("Location: logged_in.php")

Posted 23 October 2008 - 10:16 AM

We're missing a lot of code to be able to help you. What object is $fetch a part of? Has it been instantiated? Does the value == "None"?

What do you mean by this?

Quote

I wont it to move to different pages by the database data.


We need more information about your program to really be able to help you.
Was This Post Helpful? 0
  • +
  • -

#3 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3796
  • View blog
  • Posts: 13,742
  • Joined: 08-August 08

Re: PHP Help ... ("Location: logged_in.php")

Posted 23 October 2008 - 12:11 PM

Proper grammar and spelling would be nice too. Programming is about arranging thoughts in logical ways. If you can't do that with words, you're not likely to do it with code.
Was This Post Helpful? 0
  • +
  • -

#4 Moonbat   User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 424
  • Joined: 30-June 08

Re: PHP Help ... ("Location: logged_in.php")

Posted 23 October 2008 - 03:20 PM

I have a feeling that your Mafia site won't turn out too well....

But anyway, the reason you aren't moving anywhere is because you are echoing the header statement, instead of just putting it. Change this:

echo header("Location: logged_in.php")

to this:

header("Location: logged_in.php")

Also, add the curly braces to your if-else statement. That might fix problems as well.

This post has been edited by Moonbat: 23 October 2008 - 03:20 PM

Was This Post Helpful? 0
  • +
  • -

#5 William_Wilson   User is offline

  • lost in compilation
  • member icon

Reputation: 207
  • View blog
  • Posts: 4,812
  • Joined: 23-December 05

Re: PHP Help ... ("Location: logged_in.php")

Posted 23 October 2008 - 03:30 PM

:code:

I believe the word you are looking for in your 2nd echo, is Welcome, not "Well come"
Was This Post Helpful? 0
  • +
  • -

#6 zellyman   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 24-October 08

Re: PHP Help ... ("Location: logged_in.php")

Posted 24 October 2008 - 11:51 AM

Headers are not echo'ed , they written as is and PHP handles the rest. echo'ing ANYTHING to the browser will cause headers to be sent, and make any header() call after that useless
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1