PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ok so i'm building this content management system. And i have a function to add new users and update the users information. Adding new users works fine, and when i test the script on my server (invisibled.com) updating works, but when i test it on my local host updating doesn't work. When i say updating i mean the sql query doesn't update the database. so basicly, i was wondering if anybody could shed some light as to why its not working on my localhost.
my localhost is running php 5 and so is my server (invisibled.com) and the functions get loaded from a class file. i'll paste in the functions i have for updating.
this code is in users.php and runs after you hit submit on the form in usersEdit.php (its all pretty straight forward)
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
yup i know the script works because it works totally fine on my webserver.
when i run it on my localhost there is no error, i just returns back to the users.php page (like it should) but it doesn't update anything in the database
Well, that's what I'm saying. The database credentials on your server are probably different than locally. The default for local servers is 'root' as a username and an empty password.
And if that's not the case, are you sure that both databases have the same structure and data? It's possible that your aren't meeting your WHERE clause locally.
Try to check your post before update. Print the query. Try to check it with phpMyAdmin.
Maybe your DB is broken.
I think it's the best way to find the problem or localize to make more strict question.
MySQL also has permissions for users that are seperate for localhost and everywhere else, you might double-check those in phpmyadmin, just make sure the users you're logging in as have permission for either all/any (I think it just comes up as a '%').
At least, that's what I immediately thought of when you said it works remotely but not locally.