Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Mysql Won't Update
ZPGames
post 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
Go to the top of the page
 
+Quote Post
truefusion
post Dec 29 2007, 05:45 AM
Post #2


Ephesians 6:10-17
Group Icon

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.
Go to the top of the page
 
+Quote Post
ZPGames
post 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.
Go to the top of the page
 
+Quote Post
iGuest
post 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
Go to the top of the page
 
+Quote Post
optiplex
post 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 sad.gif";
}

@ 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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Mysql Database Setup : Setting Up Mysql Database(6)
  2. Complete Login System(57)
  3. Increment A Mysql Column(7)
  4. Import From Excel File Into Mysql Database(11)
  5. Problem Installing Sims 2 Nightlife(26)
  6. Mysql Database Size(7)
  7. Subquery In Mysql(5)
  8. Quick Question(10)
  9. Is It Possible To Access The Mysql Remotely?(10)
  10. Qupis : Free Hosting With Php, Mysql, Cpanel. (one Line Text Ad At Bottom)(41)
  11. Runescape Update(4)
  12. Database With Mysql++(7)
  13. Mysql-essential-5.0.51 Installion Problem(2)
  14. Mysql, Php, Apache Downloads And Setup Was A Nightmare(10)
  15. Html Form!(4)
  1. My Spy Suggestions For Team Fortress 2 Next Update S(10)
  2. Remote Access Mysql(8)
  3. Please Explain Me Mysql(4)
  4. How Do I Find My Mysql Password? [resolved](5)
  5. Garden Update(0)
  6. It Went Well For A While(5)
  7. Mysql Db Is Down Getting Following Error(2)
  8. Need Advice On Setting Up Mysql Database.(4)
  9. The Only Reason I Choose Ms Sql Server Rather Than Mysql(0)
  10. Mysql Database Not Working(3)
  11. Creating A Php Login System Using Mysql(10)
  12. Mysql Hacks(1)
  13. [ Aef ] Security Update For Aef Forum Software(1)


 



- Lo-Fi Version Time is now: 11th October 2008 - 07:25 AM