<?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. 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!
See what error this throws: Replace: $result=mysql_query($sql); with: if(!$result=mysql_query($sql)) { die(mysql_error()); }
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.
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
Seems from what your saying the variables are not been caught try this : $sql = "UPDATE " . $tbl_name . " SET detail = " . $detail . " WHERE id = " . $id . ""; PHP:
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
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
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.
GoDaddy has gave me issues too back when I went through them, glad to see you fixed it all though. Take care!