1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

GoDaddy won't use my php UPDATE and SET code...HELP please

Discussion in 'PHP' started by rebelagent, Jun 2, 2010.

  1. #1
    
    <?php require ('inc/dbc.php'); 
    require ('inc/head.inc'); 
    require('inc/safe.php');
    require ('inc/menu.inc'); 
    
    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // update data in mysql database
    $sql="UPDATE $tbl_name SET detail='$detail' WHERE id='$id'";
    $result=mysql_query($sql);
    
    // if successfully updated.
    if($result){
    echo "Successful";
    echo "<BR>";
    echo "<a href='edit_emails.php'>View result</a>";
    }
    require('inc/foot.inc'); ?>
    
    PHP:
    I really need help. It doesn't want to work for me. I mean it adds to the database when I INSERT but UPDATE and SET WHERE does not work. :mad::mad::mad::mad:

    And I specified GoDaddy because the two other hosts I use (bluehost and integrityhost) the script works on both of their servers!

    I don't even think the mailing works. I'm beginning to hate godaddy.

    Help is 110% appreciated I'll add rep and try to give you something of course if you solve my prob!
     
    rebelagent, Jun 2, 2010 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    See what error this throws:

    Replace:

    $result=mysql_query($sql);

    with:

    if(!$result=mysql_query($sql)) {
    die(mysql_error());
    }
     
    jestep, Jun 2, 2010 IP
    rebelagent likes this.
  3. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #3
    No error. Just keeps saying "Succesful view result"

    So I guess its thinking it's going through, which it does... just not with godaddy...

    I've got like 20 windows open trying to figure this out >.<

    I've tried a few ways to display the error and nothing comes up at all. So it's going through, or so it thinks. But really isn't processing it. I tried purposely screwing up the script and it displayed an error! but this isn't working for some reason.
     
    rebelagent, Jun 2, 2010 IP
  4. trevHCS

    trevHCS Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It's odd that it should be thinking there's a result, but just incase, maybe try adding these lines below the $result= bit.

    echo mysql_errno();
    echo  mysql_error();
    Code (markup):
    ...and see if they return anything. Don't put them in an if() just incase there's summut really odd going on. If that comes back as blank then do you have something like PhpMyAdmin or similar way to look at the MySQL database or even run the query on the database?

    Trev
     
    trevHCS, Jun 3, 2010 IP
    rebelagent likes this.
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #5
    Seems from what your saying the variables are not been caught try this :
    
    $sql = "UPDATE " . $tbl_name . " SET detail = " . $detail . "  WHERE id = " . $id . "";
    
    PHP:
     
    Last edited: Jun 3, 2010
    MyVodaFone, Jun 3, 2010 IP
    rebelagent likes this.
  6. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #6
    Okay it ended up being really simple.

    On the actual form page I had to change method="post" to method="get"

    On the page that processes the form I had to $_GET['value'];

    Guess the other servers aren't as picky about the post and get
     
    rebelagent, Jun 3, 2010 IP
  7. trevHCS

    trevHCS Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    As long as you're not passing critical information or lots of it I guess that'll work, but sounds like there might be a fault on the server if it doesn't allow POST. Kindof a critical part of web apps.

    Trev
     
    trevHCS, Jun 3, 2010 IP
  8. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #8
    I'm sure post works but I tried using post so I didn't have to go back and change the forums and it didn't work. Meh... I don't like godaddy hosting.

    And their customer support is of no help really. They don't actually KNOW what's the problem, they just google it in hopes someone else has already solved it. 2 representatives told me to google the problem because that all the do 0.o and that there's nothing wrong with their server if there's no error displayed... that's faulty coding. Well I mean yes my fault but it worked on everyone else server but not their's for some reason.

    Awesome. Hope this helps future frustrated godaddy customers.
     
    Last edited: Jun 3, 2010
    rebelagent, Jun 3, 2010 IP
  9. micksss

    micksss Notable Member

    Messages:
    4,427
    Likes Received:
    268
    Best Answers:
    1
    Trophy Points:
    285
    #9
    Glad you figured this out :)
     
    micksss, Jun 3, 2010 IP
    rebelagent likes this.
  10. Visin7

    Visin7 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    GoDaddy has gave me issues too back when I went through them, glad to see you fixed it all though. Take care!
     
    Visin7, Jun 4, 2010 IP