Redirection

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
Zeyber
Forum Newbie
Posts: 16
Joined: Wed Sep 26, 2007 9:23 pm

Redirection

Post by Zeyber »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I learn't PHP! But I am having little problems with little bits. Here is one problem:
The redirection code I am using keeps having errors.
I only want the redirection to happen if the User exists in the database and do a different redirection otherwise.

Code:

Code: Select all

//Username Check
$username = mysql_query("SELECT * FROM Accounts WHERE Username='$accuser'");
while($row = mysql_fetch_array($username))
  {
  echo $row['Username'] . ": Username Confirmed";
  header("Location: loginpass.php");
  break;
  }
Page:

Zeyber: Username Confirmed
Warning: Cannot modify header information - headers already sent by (output started at /home/www/warriorwars.freehostia.com/logindone.php:10) in /home/www/warriorwars.freehostia.com/logindone.php on line 29

Please help a little young soul towards the light?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
lnt
Forum Newbie
Posts: 12
Joined: Mon Sep 24, 2007 8:47 am

Post by lnt »

Do not output anything before header statement
Zeyber
Forum Newbie
Posts: 16
Joined: Wed Sep 26, 2007 9:23 pm

Post by Zeyber »

Ah nevermind got it!
Post Reply