www.webdeveloper.com
Results 1 to 2 of 2

Thread: php mysql image name into database

  1. #1
    Join Date
    Mar 2013
    Location
    Winnipeg, Canada
    Posts
    12

    php mysql image name into database

    I am working on a php file for school. We have to take a form and add first name, last name, email and a photo to a database. I am able to add the names, email to the database but am unable to add the image name to the database. Here is part of the php code and some of the html. If someone can please take a look and give some help. Many thanks in advance.

    <?php include("db_connect.php");?>
    <?php // select the database in which to add a table
    mysql_select_db("final_exam_db",$con);



    $sql ="INSERT INTO drivers_0115061 (ln,fn,month,day,year,photo,email)
    VALUES ('".$_POST["ln"]."',
    '".$_POST["fn"]."',
    '".$_POST["month"]."',
    '".$_POST["day"]."',
    '".$_POST["year"]."',
    '".$_POST['file']['photo']."',
    '".$_POST["email"]."'
    )";

    //$sql="INSERT INTO people (fn,ln,dob,city,prov,pc,gender,hc,nod) VALUES ('steve','douglas',1234567,'winnipeg','manitoba','r3p 6g5','m','grey',2)";

    //echo $sql;


    mysql_query($sql, $con);
    echo mysql_error();
    ?>




    <?php include("db_close.php");?>

    HTML:
    <td>
    Picture
    </td>
    <td>
    <input type="hidden" name="MAX_FILE_SIZE" value="10000000"/>
    <input type="file" id="photo" name="photo"/>
    </td>
    </tr>
    <tr>
    <td>

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,321
    Start by looking at this "sticky" post at the top of this forum: http://www.webdeveloper.com/forum/sh...ages-using-PHP
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles