Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Registration problem

    Hi,

    I'm having problems with the process end of a registration script... I have done this many times & really don't understand why it's returning a blank screen and not adding a record to the database. The process code is:

    PHP Code:
    <?php
    include ("dbconnection.php");
    $uname mysql_real_escape_string($_POST['uname']);
    $upass md5($_POST['upass']);

    if(isset(
    $submit2))
    {

    $checkuser mysql_query("SELECT * FROM jobseekers WHERE uname = \"$uname\""); 
    $username_exist mysql_num_rows($checkuser); 

    if(
    $username_exist 0)

    $error 'This email address is currently in use. Please choose another email address';
    echo (
    "Sorry this email address is already in our database, please use your browsers back button.");
    exit(); 
    }
    else
    {

     
    $EXday date('d'mktime(0,0,0,0date(d) + 00));
     
    $EXmonth date('m'mktime(0,0,0date(m), date(d) + 00));
     
    $EXyear date('Y'mktime(0,0,0,date(m) ,date(d) + 0date(Y)));

     
    $q1 "insert into jobseekers set
         regdate = \"$EXmonth/$EXday/$EXyear\",
         uname = \"$uname\",
         upass = \"$upass\",
         title = \"$mtitle\",
         lname = \"$lname\",
         fname = \"$fname\",
         address = \"$address\",
         zip = \"$zip\",
         country = \"$country\",
        categories = \"$categories\",
        experience = \"$experience\",
         phone = \"$phone\""
    ;

     
    $r1 mysql_query($q1) or die('error');

     
    $q2 "select * from jobseekers where uname = \"$uname\" ";
     
    $r2 mysql_query($q2) or die(mysql_error(Error5));
     
    $a2 mysql_fetch_array($r2);

     
    $q4 "insert into resumes set
         jobseekerid = \"$a2[jobseekerid]\""
    ;

     
    $r4 mysql_query($q4) or die('error');
     
     echo 
    "Registration success";
     }
     }
    ?>
    I have checked the credentials in the dbconnection.php file and they are 100% correct. Can anyone see what I may be overlooking?

    Many thanks,

    Greens85
    Last edited by greens85; 11-03-2009 at 01:27 PM.

  • #2
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts
    PHP Code:
         $q1 "INSERT INTO `jobseekers` (regdate, uname, upass, title, lname, fname, address, zip, country, categories, experience, phone) VALUES ('$EXmonth/$EXday/$EXyear', '$uname', '$upass', '$mtitle', '$lname', '$fname', '$address', '$zip', '$country', '$categories', '$experience', '$phone')"
    PHP Code:
     $r1 mysql_query($q1) or die('error' mysql_error()); 
    Last edited by Phil Jackson; 11-03-2009 at 12:45 PM.
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Phil Jackson View Post
    PHP Code:
         $q1 "INSERT INTO `jobseekers` (regdate, uname, upass, title, lname, fname, address, zip, country, categories, experience, phone) VALUES ('$EXmonth/$EXday/$EXyear', '$uname', '$upass', '$mtitle', '$lname', '$fname', '$address', '$zip', '$country', '$categories', '$experience', '$phone')"
    PHP Code:
     $r1 mysql_query($q1) or die('error' mysql_error()); 
    Hi Phil,

    I've made the amends as you mentioned but the problem is still the same... a white screen is returned & no records are added to the database!

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,079
    Thanks
    2
    Thanked 320 Times in 312 Posts
    The posted code is dependent on $submit2 being set to do anything. Where in that code are you setting $submit2 to a value?
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts
    PHP Code:
    $q4 "INSERT INTO `resumes` (jobseekerid) VALUES ('$a2[jobseekerid]')"
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 

  • #6
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by CFMaBiSmAd View Post
    The posted code is dependent on $submit2 being set to do anything. Where in that code are you setting $submit2 to a value?
    submit2 is the name of the button used to submit the form... I was assuming that particular line would just check to make sure submit2 had been hit... or do I actually need to post the value like:

    PHP Code:
    $submit2 $_POST['submit2']; 
    ?

  • #7
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts
    Quote Originally Posted by CFMaBiSmAd View Post
    The posted code is dependent on $submit2 being set to do anything. Where in that code are you setting $submit2 to a value?
    also i can not see this error in your code

    no records are added to the database
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 

  • #8
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Thanks for the reply guys.... CFM appears to have been correct. It was because I wasnt actually posting the value of the submit button. Adding the line has now got the script to work!

    Many thanks for your replies!

    Much appreciated


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •