Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php And Mysql Programming, anyone knows a code for mysql and php
catslic
post May 5 2008, 04:14 PM
Post #1


Newbie
*

Group: Members
Posts: 3
Joined: 5-May 08
Member No.: 61,764



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...smile.gif

Notice from rvalkass:

Moved from Making Money Online to PHP Programming.
Go to the top of the page
 
+Quote Post
rvalkass
post May 5 2008, 04:36 PM
Post #2


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,055
Joined: 28-May 05
From: Hertfordshire, England
Member No.: 7,593
Spam Patrol



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:
SQL
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:
CODE
$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.
Go to the top of the page
 
+Quote Post
catslic
post May 5 2008, 04:49 PM
Post #3


Newbie
*

Group: Members
Posts: 3
Joined: 5-May 08
Member No.: 61,764



thanks man! i appreciate your assistance...i'll let you know once i finished my program...i appreciate the infos biggrin.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How do you test your php code(75)
  2. What Is A T_string?(13)
  3. Php Clock(7)
  4. Change Permission With Php Code(3)
  5. Increment A Mysql Column(6)
  6. Can You Add Images Into A Mysql Database?(20)
  7. Adapting Html Code Embed To Work On Phpnuke(7)
  8. Dynamic Image / Signature Generator(12)
  9. Creating Profiles In Php/mysql ?(7)
  10. Wap Source Code Viewer(4)
  11. Html Code Tester. Online Script(15)
  12. Mysql Won't Update(4)
  13. Will This Code Work(5)
  14. Php + Mysql Question!(4)
  15. Use Rss In Php Code(3)
  1. Programming Competition Work.(2)
  2. Php Code(15)
  3. Php Code Needed(5)
  4. Php Code?(12)
  5. Php Code Needed Iii(10)
  6. Tools Needed!(9)
  7. Best Sites For Learning Php-mysql(4)
  8. Best Php And Mysql Editor For Noobs(6)
  9. Malicious Code Injection(3)
  10. Html Form!(4)
  11. Php Source Code Unveiled In Browser?(7)
  12. Mysql Error(3)
  13. Create Table - Mysql Code - Help(1)


 



- Lo-Fi Version Time is now: 25th July 2008 - 10:24 PM