Jul 25, 2008

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

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

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

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

 

 

 


Reply

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

 

 

 


Reply

catslic
thanks man! i appreciate your assistance...i'll let you know once i finished my program...i appreciate the infos biggrin.gif

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.
Confirm Code:

Similar Topics

Keywords : php mysql programming code mysql php

  1. Html Form! - Using MySQL?! (4)
    Hey, I need your help again! I need some good working tutorial how I can update my SQL through
    HTML form. I did use some tutorials online found with the help of google; but they do not work
    properly; I mean there are still small mistakes. I need to have a good tutorial to follow. It
    should be based on security and more things. It has to be done in proper way......
  2. Mysql Won't Update - (4)
    Ok, so I'm making some arcade administration software so I don't have to add games the hard
    way, well anyway, one of the features I have is that on the homepage is a featured author and as
    such I just have it so it updates one line in the mySQL. Well, the page with the form passes on the
    varibles fine and the updating page recieves them because I echoed everything, then I build the
    query and I even echo the query and it comes out exactly how I want it to, but for some reason, the
    database itself won't update even though all the varibles are there. Here's...
  3. How do you test your php code - (75)
    We know that php is a server side scripting language. So we will need a server with the php parser
    to parse/test our code. How are you doing that. Do you upload it to a server for testing or did you
    instal php and the server (apache) on your computer (localhost)...
  4. Html Code Tester. Online Script - (15)
    Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
    this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
    Current script: CODE <?php //Save this as something like htmltest.php function
    CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
    input $html_safe=str_replace("<?php"," ",$html_unsafe);
    //Starts security measures $html_safe=str_replace("?>","
    ",$html_sa...
  5. Wap Source Code Viewer - Mobile/wap source code viewer page (4)
    This is a source code viewer that will workl on wap/mobile sites but you can easily convert it to
    work on web im sure ;-) CODE <? header("Content-Type:
    text/vnd.wap.wml"); echo '<?xml version="1.0"
    encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head><meta
    http-equiv="Cache-Control" content="no-cache"
    forua="true"/></head> <card title="s60.nerds....
  6. Php Code? - Mathematical Applications (12)
    Hello, everyone. The help is needed again. How can I make calculator in PHP language? That will act
    like that a user just type in the fields known values, then click the button, and it's going to
    be solved automatically. In other words, have can I write a formula in PHP, how to plug it inside
    that language. For example, the formula to find a peremeter of square is: P=4a. So, a user
    just can write the known value which is peremeter itself and it will find the side of a square; and
    vice versa. If you can write many things how to do such formulas, such as comp...
  7. Create Table - Mysql Code - Help - (1)
  8. Tools Needed! - PHP & MySQL (9)
    Hello, everyone! I need some tools for those two things to test PHP scripts coming together with
    database on my laptop, instead checking them on a web-server which takes time....
  9. Php Source Code Unveiled In Browser? - is that possible? (7)
    I am quite new to PHP and this concern came to my mind after playing around a bit with it... When
    PHP is not correctly configured on the web server the source code of a php file we try to access
    through a browser will be shown instead of the result of the code itself. This will normally not
    happen when PHP is working properly, but I was just wondering if it could still be possible to see
    that code if a user wanted to or if something on the server failed. This would for example expose
    sensitive information like mysql passwords and so on... Is anything like that possib...
  10. Mysql Error - (3)
    ok i need some more help from the wonderful coders here at Trap. I'm almost done with my CMS
    script, but i'm having a problem with the installer.php file, when it trys to inseret the user
    data into the database i keep getting the following error: CODE mySQL Error: You have an
    error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
    right syntax to use near ';INSERT INTO `members` (`id`, `name`,
    `username`, `password`, `email`, `title`) ' at lin...
  11. What Is A T_string? - Please help! I'm new at PHP Programming (13)
    I'm new at PHP, and I looked for a while on here, and found some stuff I was looking for about
    form processing, and sending E-Mail through PHP. However, the script I just created won't work.
    I get the following error: Parse error: parse error, unexpected T_STRING in
    /home/hamtaro/public_html/send_feedback.php on line 9 Exactly what is a T_STRING? If I need to post
    my code, I will....
  12. Malicious Code Injection - (3)
    Hi everyone! This is my first post, so be kind! Basically, I'm trying to get a free
    host together so am writing some posts. Here's a little summin' summin' about malicious
    code injection with PHP applications. Basically, this security exploit is one of the oldest tricks
    in the books and all comes down to the fact that PHP allows execution of both local and remote
    scripts with the SAME function... dur. Anyway, this is how it works. Image you've just employed
    a young go getter, straight outta uni, who has found becoming a Jack of all trades a ...
  13. Best Php And Mysql Editor For Noobs - anyone any php or mysql editor that is good for noob (6)
    hi there guys, from my previous posting, i am a noob in php and mysql programming. I want to know
    if there are any php and mysql editors which are best for me as a noob. i appreciate your kindness
    ...
  14. Can You Add Images Into A Mysql Database? - Using Php? (20)
    I'm learning php in class right now, but I'm still not that good at it, what I'm
    wondering is when I write the php so that it can connect with a database, can I at the same time
    have it that it is able to display back images that I choose. Like, I want a search feature, where
    you can search for a keyword, and it will bring back a list of all the possible entries with that
    keyword, but each of these entries will have a photo associated with it. Now, do I put these image
    files directly into the database, or do I write the code to link them from my files to th...
  15. Creating Profiles In Php/mysql ? - (7)
    i've started to learn php..im familiar to basics of php and mysql now.Now for example i want
    that some user can register to my website , and after that he can Login and log out , and he can see
    his profile.is there any tutorial about this ? or any helping url .. or any helping answer please
    /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />...
  16. Adapting Html Code Embed To Work On Phpnuke - Help With This Html Code Pls (7)
    QUOTE how can get this html code to work on my phpnuke site? what tags would i
    have to enable in the $Allowable HTML part of my config.php file?? Edited topic title. Moved
    to Programming. ...
  17. Php Code Needed Iii - (10)
    Hello, everyone. I need your help again! Who might create the PHP code, the picture is
    above this text. Basically, I want when the user fill in all the information in this form, it
    automatically was sent to my email. And, then, the dialog box appears or on the same window, it was
    said that your request has been sent. Moreover, if the user did not fill the entire information,
    the dialog box appears stating that you did not fill some field. Thanks, for help. You always do
    that....
  18. Best Sites For Learning Php-mysql - (4)
    Hi I was reminded of this earlier by a post in a topic, meant to post it but forgot and the topic on
    php books reminded me. Well anyway there is tyhschools for learning php (unless someone else knows
    a better 1) but I wan't to know what is the best site for using php with mysql (using
    phpmyadmin) also whats the difference between postgresql and mysql? though I must admit the
    postgresql version of phpmyadmin whatever it's called looks better (visually)!...
  19. Php Code Needed - Working Together? (5)
    Hello, everyone. I need your help again. This forum is quite good for it. Well, I need create a
    registration form for my web-site using PHP and SQL. The information it should contain: 1) User
    Name 2) First Name 3) Last Name 4) Password 5) e-mail Address 6) Security Image: that images helps
    to protect a random registration, for instance, 56+2=where user have to type an answer in order to
    finish registration. That's all for today. Anymore things, I will post another post over here.
    ...
  20. Php Code - Needed?! (15)
    Well, I am a novice in PHP programming, so there is a script which I wanna get: 1. You go the
    web-site 2. On the main screen, there is a some kind of field windows, the one you get used to type
    in, when you go to google, for instance. 3. He or she types her email address and it's going to
    be saved in my SQL database. 4. That's it. Help me if you can....
  21. Increment A Mysql Column - how to increment a MySQL column one unit (6)
    Hi, I have a column in a MySQL table which contains a counter of the views of the object described
    by this table. I would like to increment this value by one everytime the object is viewed. Obviously
    came into my mind the possibility of retrieving the value of this field, store it in a variable
    increment this value by one and perform an UPDATE query again with this new value. My question is if
    there is a MySQL option to update the field with its actual value plus an unit increment. I hope you
    understand the issue....
  22. Programming Competition Work. - Final stage. (2)
    Well for the past month or so I have been working on a Programming Competition project in AP
    Computer Science. Some may know I am quite fancy with graphics and HTML but yes, I do program too.
    But man, even though I am decent at it, it bores the crap out of me. Well being the project leader I
    do most all of the work and I just use the two other members for support and error testing. We
    receive a packet with our project problem in it. Make a fully functional support site for a company.
    Of course with some other more little details but honestly since we are in the advance...
  23. Dynamic Image / Signature Generator - a simple code to change text on an image (12)
    In search of dynamically changing quote, saying or all other types of text on an image I came across
    a code that I have modified to fit my initial usage. This procedure requires two files and short
    knowledge of PHP. If you are familiar with Trap17's sig rotation code you will understand this
    procedure very fast. Code 1: dynamic_sig.php (you can rename this to index.php and you'll see
    at the end why) Code 2: a simple text file named anything (I will call it name.txt ) Code 1
    CODE <?php header("Content-type: image/png"); �...
  24. Change Permission With Php Code - code to change files' and folders' permissions? (3)
    As everyone know, there two ways (that I can think of) to change files' and directories'
    permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
    client that supports chmod. Well, I'm doing something for my site that requires files to have
    full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
    the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
    alternative to doing this is to change each file permission myself, but that would be...
  25. Use Rss In Php Code - (3)
    so, how can I make RSS reader on my website? thanks in advance...
  26. Php Clock - source Code (7)
    Hi Every one i find this code its very easy simple php clock i think you can use it /blink.gif'
    border='0' style='vertical-align:middle' alt='blink.gif' /> CODE <? // Binary Clock //
    script copyrightŠ 2002 Andreas Tscharnuter // questions? contact: psychodad@psychodad.at ||
    [url=http://www.psychodad.at/clock/]http://www.psychodad.at/clock/[/url] //
    free to use, copy and modify but leave comments untouched;) // just include this file where
    your binary clock should appear // version 1.2   03 September 2003 // below you can ...
  27. Php + Mysql Question! - While inserting data into MySQL, how can I know if the data I'm in (4)
    Basically, I want to know if the Data I'm inserting through a Form is already there or not. Sort
    of a Username registration page. I have this, but it doesn't appear to work... CODE
    $result = mysql_query("SELECT * FROM users WHERE
    username='$username'"); if($result == 1)     {     echo
    '<h1>ERROR!</h1>The username you have chosen already exists!';     }
    ...
  28. Will This Code Work - php linking script ?p= (5)
    hi i'm not that great at php so i'm not to sure if this will work or not. but what i want to
    do is be able to use ?p=staff or what ever page name, with out the php extion, and i would like to
    no if this simple script i made would work. the code is: CODE <?php $p =
    $_GET['p']; if ( !empty($p) &&
    file_exists('./' . $p . '.php') && stristr( $p, '.'
    ) == False ) { // pages = directory where you store your pages    $file = './'
    . $p . '...
  29. [php/mysql]id Trouble [resolved] - (3)
    session_start(); include "database.php"; if (!$_SESSION || $_SESSION { // User
    not logged in, redirect to login page Header("Location: main.php"); } $result =
    mysql_query("select * from users order by id asc"); while($r=mysql_fetch_array($result))
    { $username=$r ; $info=$r ; $msn=$r ; $email=$r ;
    $id=$r ; $password=$r ; $userlevel=$r ; echo "
    user ID User Level U...
  30. [mysql/php]need Som Basic Help - (13)
    QUOTE session_start(); include "database.php"; include "edit.inc.php"; if (!$_SESSION
    ) { // User not logged in, redirect to login page Header("Location: main.php"); }
    if(isset($_POST )){ $email = $_POST ; $msn = $_POST ; $info =
    $_POST ; $updateemail = "UPDATE users SET email = '$email', msn =
    '$msn', info = '$info' WHERE username = '$username'";
    mysql_query($updateemail) or die("culd not edit your info"); echo "info updated"; } //
    Display log...



Looking for php, mysql, programming, code, mysql, php

Searching Video's for php, mysql, programming, code, mysql, php
advertisement



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



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
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