Jump to content
xisto Community

Php And Mysql Programming anyone knows a code for mysql and php

Recommended Posts

hi everyone!


I am making a program using php and mysql...I am a noob on this so i need your help guys...I want to make a simple program that will some values and then store them on a database and then retrieve them...uhmm let me give an example out put of what i need.


This is the example say..: Enter First Name:

Enter Last Name:

Enter Age:

Enter Address:


..those are the data needed for input values...my question now is how can I make a database which will store the data of the inputed values and then retrieve them afterwards? I know there are lots of php and mysql gurus here which can help me...thanks guys in advance...:lol:


Notice from rvalkass:

Moved from Making Money Online to PHP Programming.

Share this post

Link to post
Share on other sites

To create the database, I suggest making use of a tool such as phpMyAdmin. This will allow you to create the fields you need for your database to store your data. An example of the sort of table code I would use for this task is:

CREATE TABLE `addresses` (
`firstName` TEXT NOT NULL ,
`lastName` TEXT NOT NULL ,
`age` INT NOT NULL ,

Once your table is set up in your database, you will need to have some PHP code to connect to the database, to insert new rows, and to retrieve rows from the database. You will need the following basic code to connect to the MySQL database:

$dbh = mysql_connect('localhost', 'MYSQL USERNAME', 'MYSQL PASSWORD') or die('Error: ' . mysql_error());mysql_select_db('DATABASE NAME') or die('Could not select database');

Obviously, replace the bits in capital letters with your relevant information.

There is a basic example on the PHP website, along with a full function list. They will be useful to you.

Your PHP script will need to accept values from an HTML form, and INSERT them into the database. It will also need to SELECT the values in the database and display them to the user.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.