473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

php header function not working

the code below is not working can anyone help me?

Expand|Select|Wrap|Line Numbers
  1.                                     $query2 = "SELECT `username` FROM `users` WHERE `username` = '$new_username'";
  2.                                     $query2_run = mysql_query($query2);
  3.                                     if(mysql_num_rows($query2_run)==1) {
  4.                                         echo 'The username '.$new_username.' already exists.';
  5.                                     }else{
  6.                                         $query2 = "INSERT INTO `users` VALUES ('".mysql_real_escape_string($new_email)."','".mysql_real_escape_string($new_username)."','".mysql_real_escape_string($new_passhash)."','".mysql_real_escape_string($new_firstname)."','".mysql_real_escape_string($new_lastname)."')";
  7.                                         if ($query2_run = mysql_query($query2)) {
  8.                                             header('Location: success.php');
  9.                                         }else{
  10.                                             echo 'Sorry, we could not register at this time. Please try again later.';
  11.                                         }
  12.                                     }
  13.  
Feb 1 '12 #1
4 1776
PsychoCoder
465 Expert Mod 256MB
It sure would be nice if you provided something other than "It doesnt work". What is it doing versus what you need it to do? Are you getting any errors, if so what are they? These are very helpful pieces of information
Feb 1 '12 #2
After registering a user I want to redirect them to a page but the header function does not work.
Feb 1 '12 #3
Dormilich
8,658 Expert Mod 8TB
there could be output preventing the header to work. enable error reporting to see if that’s the case.
Feb 1 '12 #4
found the answer
i had to put "exit;" after the "header("Location: success.php")"
Feb 1 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Frank Thorstens | last post by:
Hi, i try to give my script headers so the output text would be downloaded in the client's browser and not displayed. But it doesn't work at all in my IE 6 and Opera. <?...
3
by: mail1_fr | last post by:
Hi, I have 2 questions : 1 - How to launch a sheet S2 from a sheet S1 ? ------------------------------------------------ We have to is the header() function or do there is something else ?...
2
by: MrCode2k | last post by:
Hello, Trying to do: I just want a table that I can scroll and that has fixed headers. Problem: I got it to work but when I added the onmouseover event it didn't work anymore....
8
by: warezguy05 | last post by:
Hi I'd like to forward users to a 'thank-you' page after they've submitted a form. I used this code and it worked perfectly till yesterday; header("Location:...
1
by: eros | last post by:
page1.php (with header function) <?php header("Content-type: text/vnd.wap.wml"); print "<?xml version=\"1.0\" encoding=\"Shift-JIS\"?>"; $test = 123; ?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD...
1
oll3i
by: oll3i | last post by:
i have such line at the end of the script header("Location:".$config->paths."/pracodawca/konto/offers_history/language/$language/modul_vert_menu/$modul_vert_menu");<----i use rewrite rule for...
10
by: jessica87 | last post by:
hi there, i m using this coding to retrieve the file from database so that my user can download the file... <?php if (!isset($_GET)) die('Invalid Parameter'); include...
5
by: maryanncanor | last post by:
Hi, I have an input excel file that needs to be imported to Table1. However, the fieldnames or header in the excel file doesnt match the fieldnames in the database. The fieldnames in the excel file...
8
by: JRough | last post by:
What is the purpose of caching in the header below? I used something like this for downloading a detail page to Excel but in this example it looks like it is for cache control? Why would you...
2
Prakash Gnana
by: Prakash Gnana | last post by:
I have some doubts regarding header function in php. If 2 or 3 header functions are given in the php coding, there occurs some errors. Can anyone give me the reason why those errors occur. Thank...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.