Problems With Php Saving Data Into Mysql - HELP! I can't get my php documents to work with the mySQL

free web hosting
Free Web Hosting > Computers & Tech > Databases

Problems With Php Saving Data Into Mysql - HELP! I can't get my php documents to work with the mySQL

marksman
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

Reply

livingston
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.

Reply

yordan
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

Reply

Arbitrary
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)

 

 

 


Reply

vhortex
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.

Reply

Habble
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

Reply

yordan
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.

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. php saving data - 137.26 hr back. (1)
  2. mysql bulk insert xml - 330.46 hr back. (1)
  3. mysql - 535.80 hr back. (1)
Similar Topics

Keywords : problems, php, saving, data, mysql, php, documents, work, mysql

  1. Mysql Overhead
    (3)
  2. Problems Using Usb Devices
    with mobile, mp3 and usb key devices (7)
    Hello, For some time I'm having problems using USB and different devices on my Windows XP
    Desktop, I have a motherboard with 6 usb slots, but because it's hard to get to them I'm
    using a cable and one USB slot.. At the beginning I remember I had no problems, I could use
    different USB keys, my mobile phone and my mp3 player.. However, after a while it started to not
    find my devices, when I put my mobile phone, it doesn't show the memory card as removable disk
    L: I need to remove it and put it again and usually after ~5 or 12 put in and put out into the u....
  3. Problems With New Computer
    gForce 9600gt (10)
    Hello, My friend has bought a new computer, a 32 bit quad core with ~4GB of RAM and a gForce 9600gt
    or maybe gs? But as I remember it's a GT and I think it has problems or maybe the drivers or
    something else, so thought to as astahost community for some experience, tried searching the
    Internet, but got a bit tired.. It's working great, as he does not like Vista, he has installed
    XP and drivers from CDs he got in the company he bought it and when he started to play new games
    after about ~10-30 minutes the screen flickers and some errors are outputted and you can....
  4. Type Checking Not Work On For .. In Loop
    Flash 8 - actionscript 2.0 (2)
    It seems that the actionscript 2.0 type checking was not work as expected on some place. When
    variables was created on for .. in loop. It will allow any variable type to be used. Or it is
    default construt !? CODE var dayNames1:Array = ["Sunday",
    "Monday", "Tuesday", 5]; for (var dayName:String in dayNames1) {
        trace(dayNames1[dayName]);
        trace(typeof(dayNames1[dayName])); } CODE 5 number Tuesday
    string Monday string Sunday string ....
  5. Hard Drive Data Recovery Review
    (7)
    Here is a short review from a recent tragedy that I encountered from the loss of a hard drive.
    After an extensive search for free programs I landed upon two different commercial products and here
    is the review for them both. The reason for this review is to get some frustration out about the
    looser because I feel that I am out a good chunk of money and I figure this will help me feel
    better. Good EASEUS Data Recovery Wizard Professional 4.3.6 http://www.easeus.com/ $89.95
    USD Worked first time and I was actually impressed. Bad ARAX Disk Doctor 2.2 http://....
  6. Cpu Upgrade But It Doesn't Work
    (11)
    Okay, so, here's the deal. The guy who originally installed my old CPU installed it in a manner
    that the fan on top of it melted off any product numbers and all that. All I know is that the place
    it hooks into says mPGA478B. It was originally a Celeron. Well, when taking it out, the pins were
    bent, so I needed to buy a new one. I went online to find one, searched the mPGA478B thing, cross
    referenced it with the Dell, it said everything was a-okay. BUT, once I received it, it didn't
    work. The new one is an Intel Pentium 4, Northwood Core 478 Socket with spe....
  7. What You Need Before You Can Create A Text-based Game..
    Using PHP, HTML and MySQL (7)
    Please comment and rate, after you finished reading! /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
    ################################################################# Change log: Aug 22 2008: The
    Tutorial Was Created. V1.0.0 Aug 30 2008: Added XHTML and a small CSS part. Also corrected some
    small things and added this change log. V2.0.0
    ################################################################# OK.. Many people here want to
    create text based games. Many of you ask us here on the forums: "how to create a text-based ....
  8. Wamp Server Problems
    (5)
    im trying to learn php and i downloaded the wamp server, installed it and such. but when i tried to
    put it online it wouldnt do so. ive tried to change the port skype is on/ or uses (still didnt work)
    tested port 80, said i didnt actually use port 80. im not sure what else to do if any one can help
    me to fix this that would be great /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" />....
  9. Any Website Provide Free Host Mysql Host?
    (4)
    any website provide free host mysql host? i need it because i am using 000webhost.com now but it
    only provide 2 mysql database... can i know where or how can i get more databases regards....
  10. How To: Display A Members/user List.
    With PHP, Mysql, and HTML. (3)
    Alright, some of you might want to display your User's or Members on your site. Notes: 1.This
    is to fit in with Feelay's register and Log-in scripts you can find in the tutorial section. 2.I
    made this to show the members of my site who is a member and what their ID is. First off, we must
    set up a connection to our MySQL Database. CODE <?php $con =
    mysql_connect("localhost","database_username","database_username_password
    4;); if (!$con)   {   die('Could not connect: ' .
    mysql_error(....
  11. Image Problems With Windows 2000
    (9)
    Hi, since a while i got two problems related with images files in my Windows 2000 machine, both are
    very closely related because them happen with Windows Explorer and with Internet Explorer 6. The
    problems are: Windows Explorer Thumbnails Preview : The problem with this option of the View menu
    is that it doesn't show any thumbnail preview of any image in my hole computer, i verify this
    problem for jpg, jpeg, gif, png or bmp files, but it works fine and generate the thumbnail previews
    for html files. IE Save as... dialog and JPG files extension : Every time that....
  12. Gimp: Saving As... Issues
    Anybody experiencing compatibility problems (3)
    Hi all you gimp users. I am wondering if you are experiencing problems with your images created in
    GIMP as I am. We here is my story. I take pictures with a camera and upload them to my computer with
    a the camera software. Nothing is changed yet. Then I go to that file location and open the image or
    a copy of the image with GIMP. Then i edit it, add layers, and tweak various settings before saving
    it to .XCF (native GIMP format). Then later I was to export it. I do so as JPEG or TIFF. The
    problem is whatever I create/modify in GIMP, I seem to have trouble opening it ba....
  13. I6networks....does Not Work!
    (4)
    This hosting site (i6networks.com)should be avoided at all costs ,its a big waste of time.......
    They send the confirmation email four days late (and it is supposed to be "automated") And heres
    exactly what they send QUOTE === Please print for future reference === 2008/02/16
    Congratulations! Your web hosting account is ready! This e-mail contains basic setup
    instructions and details on the features of your hosting package. For more information you can
    always reference our online customer support area at: http://www.i6networks.com/support.shtml
    -------....
  14. Theme Hospital Cheats Don't Work
    (10)
    QUOTE Cheat Mode - To enter the cheat mode, press 2,4,3,2,8, on the fax machine. Extra
    $10,000 - While in cheat mode, press + C together. I tried that and a few others but
    nothing happens. It's Xp.....
  15. Internet Connection Sharing Problems
    (2)
    Hello, I am having some trouble setting up Internet Connection Sharing. Here is my setup. My
    internet is through a neighbor who is sharing there internet with me wirelessly, so I don't have
    any type of broadband modem, just a wireless card on my desktop PC. I have a linksys WRT54G router
    connected to the desktop PC and tried following the guidelines for home networking, and works fine,
    but no internet connection now. When I unhook my router then my internet connection comes back.
    Its as if the computer is looking for internet on my network, and I dont know how t....
  16. Php Tutorial: Making A Shoutbox
    Requirements: PHP, MySQL (12)
    Hi everyone, I'm going to tell you how to make a simple shoutbox using PHP and MySQL. To start
    off, open up mysql in the command line, or phpmyadmin, and create a database called shoutbox. Next,
    enter the following sql into the command line, or the phpmyadmin sql box, while using the shoutbox
    database: CODE create table messages(author varchar(30), message text, time
    timestamp, mid int auto_increment, primary key(mid)); This creates the table we need
    to store the messages, note the "mid" column, this gives each message a seperate id nu....
  17. Data Recovery
    what should i use? (15)
    I sent a computer in for a motherboard replacement. I could have done it myself, but i figured why
    not save some time. The computer came back from the shop with not only the motherboard replaced, but
    the hard drive reformatted and windows reinstalled as well. After yelling at the guy for his
    stupidity, I've now settled down to try to recover the lost data. The problem with what i'm
    using (R-studio) is that it will recover a formatted partition, but because windows has been
    installed again on top it only sees that one. What are my chances of recovering the data, a....
  18. Qupis : Free Cpanel Web Hosting (one Line Text Ad At Bottom)
    150 MB space, 10000 MB Bandwidth, php, mysql, CPanel (10)
    Hello Members, We are proud to introduce a new member to Xisto group of sites.
    Qupis : Free Web Hosting 150 MB space, 5000 MB Bandwidth, php,
    mysql, CPanel (Latest). Emails, FTP, Addon domains, Parked Domains etc.
    http://www.Qupis.com
    Feel free to add your reviews and comments about it. -AstaHost
    Management ....
  19. Navcat For MySQL
    is Navcat any good? (9)
    Hello all, i ve recently come across NavCat (GUI tool) for MySQL. I have not bought a copy yet, just
    played around with the demo. Has any one used it beore, if so please let me know if its worth
    buying. I already have PhpMyadmin, Just wanna know if NavCat is better than PhpMyAdmin in usibility
    and functionality. Regards....
  20. Office 2007 Document Problems
    (12)
    I switched over to the final Office 2007 format on one computer. The others are running Beta 2 with
    the service pack. When i save files in the older doc, xls, ppt formats, i can open them fine on both
    computers. when i save them in the new version (docx, xlsx, pptx and so forth) they will open fine
    on the computer that created them, but not if i move them from the beta to the final computer, and
    vice versa. It's irritating, because also before i installed the final on my computer, i had the
    beta2 version, and now that i've upgraded, all documents created in that ....
  21. PHP & MySQL: Displaying Content From A Given ID
    (6)
    Okay so I got this sample link (not working): http://www.acosta.com/joo.asp?id=654 Now suppose
    I have a PHP file that would use MySql in order to get all values in the row where id 654 is found.
    Here's a sample DB: Table: demnyc ______________________________________ | id |
    Name | Age | Email | *----------------------------------------------------* | 1
    | Albert | 17 | no email |
    *----------------------------------------------------* | 2 | YaPow | 888 |
    no email | |__________....
  22. Games For Samsung D900
    Install games with data cable (3)
    Hello everyone. I have a problem and perhaps you can help me out? I have a samsung d900 and I want
    to install games using a data cable. Does anyone know how to do it? Thanks in advance!....
  23. Screensaver Problems
    It wont start (11)
    Hi I just re installed windows on my computer (I know i can hear people saying "Why Windows", but i
    need it to run certain programs) and i have encountered a problem with my screensaver. I have it
    set to load the "My Pictures" screensaver after 3 minutes. But after 3 minutes the screen saver wont
    appear!! I have also set my monitor to turn off (standby) after 5 minutes. The only thing
    that i find strange is that when i have locked the computer (e.g switch user) and it is sitting on
    the login screen, the monitor will go into standby after 5 minutes, but before th....
  24. Problems Installing Vista
    (14)
    I just got a hold of Vista from my friend. He downloaded it from the Microsoft site and burned it on
    a DVD for me. Since I just installed VMware recently, I wanted to give Vista a try. So far it's
    only been giving me headaches. I've been getting all kinds of errors...most likely related to
    the amount of disk space I allocated for the install or the memory assigned. Well, I gave it all I
    got today. I set VMware to give it 15GB of hard drive space and 512MB of memory. It seems to work.
    Got up to the copying files and after a short file it gave me an error code 800....
  25. Important: Basics Of Using PHP And MySQL
    (10)
    I generally notice confusion with new users to PHP and or MySQL and first of all I believe that
    unlike HTML which is automatically associated with a IE browser in a Microsoft system. HTML is
    automatically rendered with whatever browser is the default browser, be it Internet Expolrer Firefox
    Netscape or any other browser that has been set. PHP is a different matter to view the output of a
    PHP file it must be run on a webserver, and if you do not have one set up on your local PC it simply
    will not work. (Note serverside langauge requies a server) HTML is client side and ....
  26. MySQL Output Database Question
    (18)
    I am new to MySql and have just created a database after using a script. My problem is not the
    script, but what it says about putting it into the output file. I cant figure out the right terms
    to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE
    'location' but it isnt working. I'm lost with this stuff, I really am. Can someone
    please help me out?....
  27. [PHP + MySQL] Encrypting Data
    To protect the password of your DB, for example. (11)
    Hi! This is my 2nd code of PHP + MySQL. This code is VERY simple: it encript the data in the
    MySQL DB. Here we go! ------------------------------------------------------------------------
    CODE <?php $password = "abc"; $new_password = md5($password);
    echo $new_password; ?> The password "abc" was codfied using md5() This will be:
    900150983cd24fb0d6963f7d28e17f72 CODE <?php $normal_pass = "abc";
    $encripted_pass = "900150983cd24fb0d6963f7d28e17f72"; if(md5($norm....
  28. Convert Fat32 To Ntfs Without Data Loss (dos-mode)
    (7)
    Some computer's are sold with windows XP pre installed and with FAT32 FORMAT, so there is a way
    to change it without data loss. Go do MS-DOS and type convert c: /fs:ntfs, dont forget to change
    the drive c:\, d:\ , e:\ for the one that you wanna convert . PS : This process
    is impossible to return to FAT32, once you convert you can't turn back , unless you format your
    pc /biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /> cheers
    m8's /biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'....
  29. Nero Problems
    Fixing Nero Problems (29)
    Hey everyone Im having a bit of trouble using Nero for burning CD's. Everytime I start the
    burning process, it will get say about 45% done and then it will stop dead. Usually you can hear the
    actual drive itself whilst the CD is burning, then it will just stop and go quiet. Its really
    annoying because I am wasting countless CD's on it. Does anyone have any suggestions or is it my
    hardware? Thanks /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> Please
    help fix this Nero Problem.....
  30. MySQL Realtime Replication
    how to replicate mysql in realtime (4)
    i dont know if this might be useful to ppl here, but this is a very good knowledge for serious
    siteadmins. while i was digging for mysql backup techniques, i've found that mysql is able to
    do realtime replication. the idea is that there are master server and slave server. both are having
    the same version of mysql installed. the data flows; Master >copy> Slave ( in realtime!)
    you'll never have to manually copy the database file of wasting your time to manually use the
    mysqldump command. here are the links; http://dev.mysql.com/doc/mysql/en/Replication_HOW....

    1. Looking for problems, php, saving, data, mysql, php, documents, work, mysql

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for problems, php, saving, data, mysql, php, documents, work, mysql
advertisement




Problems With Php Saving Data Into Mysql - HELP! I can't get my php documents to work with the mySQL



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE