[thelist] MySQL CREATE TABLE - img file??

Ben Phillips ben at inchima.com
Wed May 15 04:25:01 CDT 2002


>   I am using php/mysql

>   I've tried modifying the code you wrote and its giving me problems!!
>   I think due to the fact that there won't be an img uploaded
>   everytime so I've enclosed the code in an if else.  Somewhat
>   unsuccessfully (methinks!)
>
  <http://www.kfx-design.co.uk/testarea/bowtechAdmin/bowtechAdd.php>

  my effort:

          // this gets the auto_increment primary key of the most recent
insert
          if (($image != 'none') && ($image != '')) {
            $imageid = mysql_insert_id();

          // save image to photos directory
            $image_location =".$imageurl".$imageid.".gif";
            move_uploaded_file($image, $image_location);
          }
          else {
            $imagefilename = $image;
          }

  //--//--//
===========================
okay,

the logic for adding a new course should work like this:

- form displayed to user
- user fills in form
- form checked for validity
- record created in database
- IF image uploaded
  - check image is valid
  - obtain primary key (mysql_insert_id())
  - move_uploaded_file

voila.

if you want to send me your bowtechAdd.php file offlist, i'll have a
look at it for you.

benji
inchima.com





More information about the thelist mailing list