|
|
|
|
![]() ![]() |
Apr 10 2007, 12:10 AM
Post
#1
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 2 Joined: 10-April 07 Member No.: 21,377 |
i have a server that says it allows php and mysql and in the control panel i can access mysqladmin and phpmyadmin but i cant get the php to save data into the mysql, i am trying to make a text-based MMOG so i need to save my users/passwords into a database(i thought) and it won't do it, can anyone help me
|
|
|
|
Apr 10 2007, 04:45 PM
Post
#2
|
|
|
Advanced Member Group: Members Posts: 149 Joined: 14-February 07 From: Tuticorin, India Member No.: 20,415 |
Please share the code snippet that you used to do the process or the details about the CMS if you use any. Only then we'll be able to help you.
This post has been edited by livingston: Apr 10 2007, 04:49 PM |
|
|
|
Apr 10 2007, 04:57 PM
Post
#3
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 1,980 Joined: 16-August 05 Member No.: 7,896 |
As soon as Fantastico will work again, I suggest that you install phpbb forum or 4image gallery, and look how the autimatically installed php program insert data into the mysql databas and how they retrieve the forum posts from the database and display them on the webpage.
yordan |
|
|
|
Apr 11 2007, 11:36 PM
Post
#4
|
|
|
Premium Member Group: [HOSTED] Posts: 363 Joined: 17-June 06 From: Adblock life Member No.: 13,992 |
Well, in order to do that...you'd have to connect to the database first:
CODE <?php mysql_connect("hostname", "username", "password") or die("Unable to connect to MySQL"); mysql_select_db("name"); ?> The hostname on most servers is usually "localhost". If you find that that doesn't work, then you should probably contact your host. (Usually if it doesn't work, the host has some sort of warning telling you that as well...) The die part basically just prints an error message. If you want more detailed error messages, then mysql_error() would work better. Then, to insert stuff: CODE mysql_query("INSERT INTO people (name, email) VALUES('Person', 'person@gmail.com' ) ") or die(mysql_error()); Most mysql queries are nice like that. That's about it for inserting data. Though for passwords it would obviously be a good idea to md5 hash it before inserting it into the database. And even before that, it'd be more secure if you got rid of quotes, semicolons and slashes. (php's stripslashes is quite nice for the latter) |
|
|
|
Apr 12 2007, 12:17 PM
Post
#5
|
|
|
Guilty Until Proven Innocent Group: Members Posts: 372 Joined: 13-April 05 Member No.: 3,937 |
i have a server that says it allows php and mysql and in the control panel i can access mysqladmin and phpmyadmin but i cant get the php to save data into the mysql, i am trying to make a text-based MMOG so i need to save my users/passwords into a database(i thought) and it won't do it, can anyone help me Can you provide some more details.. If you like, I can give you the class I am using to access the database. The class is just a wrapper and very easy to understand. Works with mySQL only since I am using mySQL with my webbase needs. |
|
|
|
Mar 15 2008, 08:49 PM
Post
#6
|
|
|
Premium Member Group: [HOSTED] Posts: 274 Joined: 17-June 07 From: Tasmania Member No.: 22,699 |
hmmmmmmmmmmmmmmmmmmmmmmmmm i see well all i can reccomend for this is get free hosting with mysql and run it on there ummmmmmmmmmmmm are you sure its not you script the may not be coded right i reccomend you get a mate to look at it it would be way to hard to explan how to fix some thing like that on a forum Lol
|
|
|
|
Mar 15 2008, 11:22 PM
Post
#7
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 1,980 Joined: 16-August 05 Member No.: 7,896 |
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th September 2008 - 11:45 AM |