|
|
|
|
![]() ![]() |
Dec 29 2007, 03:02 AM
Post
#1
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 107 Joined: 4-November 04 Member No.: 2,133 |
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 CODE <?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://www.zpgamez.com/games/admin/?p=featuredauthor'>Back</a>" ?> Any help, I would greatly appreciated. Thanks |
|
|
|
Dec 29 2007, 05:45 AM
Post
#2
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,917 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 |
I believe you're missing one important line of code:
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. |
|
|
|
Dec 29 2007, 06:51 AM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 107 Joined: 4-November 04 Member No.: 2,133 |
Thank you so much, I can't believe I forgot such a silly, but important thing.
|
|
|
|
Jun 26 2008, 06:27 AM
Post
#4
|
|
|
Hail Caesar! ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 5,876 Joined: 21-September 07 Member No.: 50,369 |
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 |
|
|
|
Jun 27 2008, 08:16 PM
Post
#5
|
|
|
Newbie [Level 3] ![]() ![]() ![]() Group: [HOSTED] Posts: 40 Joined: 26-June 08 Member No.: 64,213 |
Hmm
I 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 db mysql_select_db($database); And for the update query if(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 problem for mysql. - optiplex |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 11th October 2008 - 07:25 AM |