Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2005
    Location
    UK
    Posts
    88

    Database driven script

    I need some help with a project.

    I want to create a script to collect information from users, and store that information in a MySQL database, with an admin panel to manage user information.

    But Im not sure where to start, can anyone give me any pointers?

  2. #2
    You can see the tutorials in this page:

    http://www.phpfreaks.com/tutorials.php
    http://www.empresasdehosting.com
    THE WEB HOSTING INDEX IN SPANISH
    http://www.empresasdehosting.net
    THE WEB HOSTING DIRECTORY IN SPANISH

  3. #3
    What to advice you - i don't know. My first script was guestbook, written on Visual C++ several years ago, and runned under Windows Apache as CGI. I was proud of it.

    All depends on your programming skills and what do you know. Do you know any programming language? If you know PHP or Perl a little, then learn tutorials and move forward. Good luck
    HostNodeList Web Host Directory, DEV.INTOEX.COM - products for online business

    Experienced web-developer | PHP | Smarty | Zend | Databases | Graphic design - looking for long-time relationship

  4. #4
    Join Date
    Jan 2005
    Location
    UK
    Posts
    88
    Thanks for the link there empresasdehosting.

    I know HTML fairly well. Im just about to start PHP, and thought that this would be a good first script.

  5. #5
    Join Date
    Sep 2004
    Location
    Flint, Michigan
    Posts
    5,765
    If you are just looking to store information it would be best to do it with a simple POST to a php script:

    SQL Query to run on your database:

    Code:
    CREATE TABLE `users` (
    `id` INT( 5 ) NOT NULL AUTO_INCREMENT ,
    `firstname` VARCHAR( 255 ) NOT NULL ,
    `lastname` VARCHAR( 255 ) NOT NULL ,
    `age` VARCHAR( 3 ) NOT NULL ,
    PRIMARY KEY ( `id` )
    ) TYPE = MYISAM ;
    information.html
    Code:
    <form name="userinfo" method="post" action="infograbber.php">
    <input type="hidden" name="add" value="add">
      First Name: 
        <input type="text" name="first"> 
        Last Name: 
        <input type="text" name="last"> 
        Age: 
        <input type="text" name="age"> 
        <input type="submit" name="Submit" value="Submit">
    </form>

    infograbber.php
    Code:
    <?
    if($_POST['add']) {
    $dbname = "databsename";
    $dbpass = "databasepass";
    $dbuser = "databaseusername";
    $dbhost = "localhost";
    
    $link = mysql_connect($dbhost, $dbuser, $dbpass);
    if (!$link) {
       die('Could not connect: ' . mysql_error());
    }
    $db_selected = mysql_select_db($dbname, $link);
    if (!$db_selected) {
       die ('Can\'t use database : ' . mysql_error());
    }
    $first = mysql_real_escape_string($_POST['first']);
    $last = mysql_real_escape_string($_POST['last']);
    $age = mysql_real_escape_string($_POST['age']);
    
    $q = "INSERT INTO `users` (`id`, `firstname`, `lastname`, `age`) VALUES ('', '$first', '$last', '$age')";
    mysql_query($q, $link);
    echo ("Thank you for your submission");
    
    }
    
    ?>
    Please note that this code has not been tested and I am quite tired, so I appologize for any bugs or mistakes.
    Mike from Zoodia.com
    Professional web design and development services.
    In need of a fresh hosting design? See what premade designs we have in stock!
    Web design tips, tricks, and more at MichaelPruitt.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •