catslic 0 Report post Posted May 5, 2008 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... Notice from rvalkass: Moved from Making Money Online to PHP Programming. Share this post Link to post Share on other sites
rvalkass 5 Report post Posted May 5, 2008 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` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `firstName` TEXT NOT NULL , `lastName` TEXT NOT NULL , `age` INT NOT NULL , `address` LONGTEXT NOT NULL ) ENGINE = InnoDB 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
catslic 0 Report post Posted May 5, 2008 thanks man! i appreciate your assistance...i'll let you know once i finished my program...i appreciate the infos Share this post Link to post Share on other sites