Database problem, whats wrong?

Discussion in 'MySQL' started by digitalhaven, Aug 6, 2006.

  1. #1
    I am trying to get a site up, I just did a test signup and the info I type just disappears when I hit submit nothing else happens, what do people reckon is wrong? Everything looks right but ... nothing happens. I am using PHP and MYSQL database.

    Whats wrong?
     
    digitalhaven, Aug 6, 2006 IP
  2. digitalhaven

    digitalhaven Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Anyone who might know what happened? Any one with mysql experience?
     
    digitalhaven, Aug 6, 2006 IP
  3. smatts9

    smatts9 Active Member

    Messages:
    1,089
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    88
    #3
    Showing the PHP code would be helpful.
     
    smatts9, Aug 6, 2006 IP
  4. digitalhaven

    digitalhaven Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I know its not the loactions and detials of the database that are wrong becuase it won't even allow the site to be opened if the detials are even one digit different. Here is a portion of the code I suspect. I was originally just wanting to know what people thought what combination of factors could cuase nothing to happen when the form was submitted and the inputed information dissapearing and going back to the original form. But if you reckon it will help:


    require("program.php");
    require("top.php");

    if ($submit) {
    $db = mysql_connect("$dbhost", "$dbuser", "$dbpass") or die("Could not connect");
    mysql_select_db("$dbname") or die("Could not select database");

    $sql = "SELECT * FROM users WHERE email='$email'";

    $result = @mysql_query($sql);

    if (!$email) {

    echo "Sorry! You didn't fill in all the fields!";

    } elseif (!$result) {

    echo "Sorry! Email not in database!";

    } else {
    $myrow = mysql_fetch_array($result);
    $id = $myrow["id"];
    $first = $myrow["first"];
    $last = $myrow["last"];
    $pass = $myrow["pass"];
    /* recipients */
    $to = "$first $last <$email>";
    /* subject */
    $subject = "$pname Login Information";

    /* message */
    $message = "Dear $first
    Here is your login information:
    Username: $id
    Password: $pass
    You can login at: $url/members.php
    Your referral URL is $url/?r=$id

    Sincerely,
    The $pname Staff
    $url/
    ";

    /* additional headers */
    $headers .= "From: $pname <$admin_email>\r\n";

    /* and now mail it */
    mail($to, $subject, $message, $headers);
    echo "Thank you, an E-mail has been sent to $email with your login information.\n";

    }
    } else {

    ?>

    <center><font size="5"><b>Login</b></font></center><br>
    <br>
    Enter your Email address.<br>
    <form method="post" action="<?php echo $PHP_SELF?>">

    <input type="Text" name="email"><br><input type="Submit" name="submit" value="Send Your Password">

    </form>
    <?php
    }
    require("bottom.php");
    ?>
     
    digitalhaven, Aug 6, 2006 IP
  5. iowadawg

    iowadawg Prominent Member

    Messages:
    10,918
    Likes Received:
    811
    Best Answers:
    0
    Trophy Points:
    380
    #5
    That until the domain propagates throughout the internet, a lot of submissions, etc are on hold.

    It could be, if a new site, that it will take up to 72 hours for this to happen.

    Found this out when my sites were transferred from one server to another, with different ip address.
    Sites were okay, people could submit, but the submissions never showed up.
    After about 48-72, they all showed up at once!
     
    iowadawg, Aug 6, 2006 IP
  6. digitalhaven

    digitalhaven Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That period should be well and truly over for this site, its now been up seven days almost, I did a test signup to see if everything was working and found the form kept blanking out and not going anywhere.
     
    digitalhaven, Aug 6, 2006 IP
  7. dddougal

    dddougal Well-Known Member

    Messages:
    676
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    108
    #7
    The fault is probably with the form
     
    dddougal, Aug 7, 2006 IP
  8. QiSoftware

    QiSoftware Well-Known Member

    Messages:
    805
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    158
    #8
    Check your error log files. Looks like your php code has errors. See -

    
    /* additional headers */
    $headers .= "From: $pname <$admin_email>\r\n";
    
    /* and now mail it */
    mail($to, $subject, $message, $headers);
    echo "Thank you, an E-mail has been sent to $email with your login information.\n";
    
    }
    } else {
    
    ?>
    
    Code (markup):
    Q...
     
    QiSoftware, Aug 7, 2006 IP
  9. digitalhaven

    digitalhaven Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    The problem is the . in $headers .= isn't it?

    Are there any other problems in the code? I'm just new at php.

    Sorry to ask such stupid questions. that error was repeated about 5 different places with $headers and also $refheaders. Buying scripts has disadvantages. Sometimes I wish, I was better at this so I could do it myself.
     
    digitalhaven, Aug 7, 2006 IP
  10. smatts9

    smatts9 Active Member

    Messages:
    1,089
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    88
    #10
    Why is there a '.' before the '=' sign?... Try taking it out?..
     
    smatts9, Aug 7, 2006 IP
  11. digitalhaven

    digitalhaven Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    taken out the "." still have problem.
     
    digitalhaven, Aug 7, 2006 IP
  12. dddougal

    dddougal Well-Known Member

    Messages:
    676
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    108
    #12
    Take out the 'value' part of your submit button.
     
    dddougal, Aug 8, 2006 IP
  13. digitalhaven

    digitalhaven Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    dddougal Can you explain why taking the value out of it would work?

    I have also checked out the form aspect and the form is correct provided that "register_globals" is on. How do I find and change "register_globals"?
     
    digitalhaven, Aug 8, 2006 IP
  14. digitalhaven

    digitalhaven Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Ok, its fixed. Putting this in .htaccess worked a treat:

    php_flag register_globals on
     
    digitalhaven, Aug 8, 2006 IP
  15. jnestor

    jnestor Peon

    Messages:
    133
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Don't take out the . from the .=
    .= is string concatenation.

    $x = "This is the begining";
    $x .= " this is the end";

    at this point $x = "This is the begining this is the end";

    Don't take out the value part of your submit button. That will affect how the form appears but will almost certainly not affect how the form works or doesn't work.

    If this is a 3rd party script that requires register_globals on you can search google for how to turn register_globals on. Given the choice I'd look for a different script. If it's your own script, learn how to write scripts that don't require register_globals.
     
    jnestor, Aug 8, 2006 IP