Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Problems With Php Saving Data Into Mysql, HELP! I can't get my php documents to work with the mySQL
marksman
post Apr 10 2007, 12:10 AM
Post #1


Newbie [ Level 1 ]
Group Icon

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
Go to the top of the page
 
+Quote Post
livingston
post Apr 10 2007, 04:45 PM
Post #2


Advanced Member
Group Icon

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
Go to the top of the page
 
+Quote Post
yordan
post Apr 10 2007, 04:57 PM
Post #3


Way Out Of Control - You need a life :)
Group Icon

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
Go to the top of the page
 
+Quote Post
Arbitrary
post Apr 11 2007, 11:36 PM
Post #4


Premium Member
Group Icon

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. smile.gif The insert into basically just puts the data into the database called "people". The database people has columns name and email, of which the values "person" and "person@gmail.com" are added into, respectively.

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)
Go to the top of the page
 
+Quote Post
vhortex
post Apr 12 2007, 12:17 PM
Post #5


Guilty Until Proven Innocent
Group Icon

Group: Members
Posts: 372
Joined: 13-April 05
Member No.: 3,937



QUOTE(marksman @ Apr 10 2007, 08:10 AM) *
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.
Go to the top of the page
 
+Quote Post
Habble
post Mar 15 2008, 08:49 PM
Post #6


Premium Member
Group Icon

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
Go to the top of the page
 
+Quote Post
yordan
post Mar 15 2008, 11:22 PM
Post #7


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 1,980
Joined: 16-August 05
Member No.: 7,896



QUOTE(Habble @ Mar 15 2008, 09:49 PM) *
i reccomend you get a mate to look at it

that's exactly what he is doing right now : we hare his mates and he asks us to have a look at his code.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. MySQL - Trouble With Bulk Insert Statements(3)
  2. MySQL Realtime Replication(4)
  3. Recover Tables From A MySQL .frm File(8)
  4. Mirror My MySQL Database To Another Mysql Server(4)
  5. How To Connect MySQL With Flash?(8)
  6. MySQL Output Database Question(18)
  7. MySQL, Multiple Tables(24)
  8. Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database(4)
  9. Navcat For MySQL(8)
  10. Permission Problem With Mysql Database Creation(8)
  11. Mysql And Php(15)
  12. Login System Using A Mysql Db(5)
  13. Oracle Vs. Mysql Vs. Postgresql(9)
  14. Subqueries In Mysql(1)
  15. Apache Php With Mysql On Windows [solved](9)
  1. Not Understanding Mysql(4)
  2. Mysql Script Help(3)
  3. Mysql - So Hard(14)
  4. Mysql Problem(1)
  5. Sun Bought Mysql(6)
  6. Mysql Backup With Another Address?(4)
  7. I Have An Error With My Mysql Connection(7)
  8. Mysql And User File_priv(0)
  9. Mysql Database Management(1)
  10. Mysql Database Entry By Excel Sheets(2)
  11. Mysql On Computer(9)
  12. Any Website Provide Free Host Mysql Host?(4)
  13. Mysql Multiple Tables(1)


 



- Lo-Fi Version Time is now: 5th September 2008 - 11:45 AM