SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    CHicago
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Server upgrade, php script failure

    OK so I have been with my web host for about 5 years, no complaints, recently they upgraded everyone on my server to a new server. Yay! Right? Wrong.


    Ever since, a very simple PHP script that I have for submiting data into a mysql database has failed. I have checked all the settings to ensure that host, database name, user name, password are all correct. Looks good.

    The only thing I can think is perhaps an incompatibility due to maybe a newer version of php and or mysql? Maybe you guys can look at this form and give me some advice or see something I am missing?

    Imagine a standard html form that submits (posts) to a seperate file, which I call the "engine". Below is the engine file...

    Code:
    <?
    //      MySQL server hostname 
            $dbhost = "localhost"; 
            //      MySQL server username 
            $dbuser = "edited"; 
            //      MySQL server password 
            $dbpasswd = "edited"; 
            //      MySQL server connect 
            $db=mysql_connect("$dbhost","$dbuser","$dbpasswd"); 
            //      MySQL database name 
            $db_name="reliable_relamedata"; 
            mysql_select_db($db_name,$db); 
           $table="estimate_requests"; 
           $query = "SELECT * FROM $table WHERE id='$id'"; 
           $result=mysql_query($query) or die(mysql_error()); 
           $nombre = mysql_num_rows($result); 
    //_________________________ADD__________________________ 
           if ($action=='add')        { 
          if(mysql_num_rows($result)) { 
           echo "No Addition, the entry <b>$id</b> already exists"; 
             } 
           else { 
            $query2="INSERT INTO $table (firstName, lastName, orginization, jobAddress, jobCity, jobState, jobZip, mailAddress, mailCity, mailState, mailZip, dayPhone, evePhone, cellPhone, faxNo, eMail, workType, estimateDesc, referer, rep_id, request_date, requestTime, status, proposal_no) VALUES ('$firstName', '$lastName','$orginization', '$jobAddress', '$jobCity','$jobState', '$jobZip','$mailAddress', '$mailCity','$mailState', '$mailZip', '$dayPhone', '$evePhone', '$cellPhone', '$faxNo', '$eMail', '$workType', '$estimateDesc', '$referer', '$rep_id','$request_date', '$requestTime', '$status',  '$proposal_no')"; 
           $result2=mysql_query($query2); 
            
           echo "The entry  $firstName  $lastName was added to the Lead Bank.<br>"; 
           echo "<a href=\"open_estimates.php\">View Open Estimates.</a> 
                 <a href=\"index.php\">Return to Employee Home Page.</a> <br>"; 
             } 
           } 
           else { 
           echo "You can not access this file directly."; 
           } ?>

  2. #2
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you provide any more information than it's failed? What is it doing? Is it providing an error? Is it putting it into the db at all, partially, or just wrong?

  3. #3
    SitePoint Member Five 25 Media's Avatar
    Join Date
    May 2009
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where is $id and $action being set at? If it's done via the url, like script?id=1&action=add then it could be the fact that registered globals is off and you need to change them to $_GET['id'] and $_GET['action']


Bookmarks

Posting Permissions

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