Jump to content
xisto Community
Sign in to follow this  
ZPGames

Mysql Won't Update

Recommended Posts

Ok, so I'm making some arcade administration software so I don't have to add games the hard way, well anyway, one of the features I have is that on the homepage is a featured author and as such I just have it so it updates one line in the mySQL. Well, the page with the form passes on the varibles fine and the updating page recieves them because I echoed everything, then I build the query and I even echo the query and it comes out exactly how I want it to, but for some reason, the database itself won't update even though all the varibles are there.Here's my update page

<?php$ud_author=$_POST['ud_author'];$ud_authorwebsite=$_POST['ud_authorwebsite'];$ud_description=$_POST['ud_description'];echo "$ud_author <br><br>";echo "$ud_authorwebsite <br><br>";echo "$ud_description <br><br>";$username="dbusername";$password="password";$database="datbasename";mysql_connect(localhost,$username,$password);$query="UPDATE featuredauthor SET author='$ud_author', authorwebsite='$ud_authorwebsite', description='$ud_description' WHERE id='1'";mysql_query($query);echo "$query <br><br>";echo "Record Updated <br><br>";mysql_close();echo "<a href='http://forums.xisto.com/no_longer_exists/ help, I would greatly appreciated.Thanks

Share this post


Link to post
Share on other sites

I believe you're missing one important line of code:

mysql_select_db($database);
If you don't select which database to use, then it's not going to work the way you intended it to work.

Share this post


Link to post
Share on other sites

Updation Problem in MySQL

Mysql Won't Update

 

I have a problem in MySQL. When more than one client update same table as the same time,it won't work. So, how do I make out for it? example:In real-time application, one of my client updating same table and same column and at the same time one of my other client also updating the same table and same column, but only one updation is allowed and the other wont work. Can you solve this and let me know?

 

-question by Karthik

Share this post


Link to post
Share on other sites

HmmI think u forgot to select the DB.And you see, on this line 'mysql_connect(localhost,$username,$password);'I think you should type localhost between quotes, like this "localhost", or "127.0.0.1"And after that , select dbmysql_select_db($database);And for the update queryif(mysql_query("UPDATE table SET column = 'lolz' WHERE id = '17'")){echo "updated!";} else {echo "something went wrong ;)";}@ Trap_FeedBacker:I dont think you can fix that, at least dont know how, im sorry.I dont see the problem if multiple queries are being submitted at one time, that shouldnt be a problemfor mysql.- optiplex

Share this post


Link to post
Share on other sites

@ iGuest,I too faced the same problem but still now i have not been able to fix it. So for the time being catch the exception in a try catch block, run a delay loop, within which time the other query will have committed and then try again.Regards.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.