[PHP] Uploading images to Mysql

2002-11-17 Thread William Glenn
Hey all, need some quick help. I have some code I was trying to get to work but I keep 
getting this error: 
Warning: fopen(, rb) - Success in /home/digital/public_html/upload_test.php3 on 
line 18

Warning: stat failed for (errno=2 - No such file or directory) in 
/home/digital/public_html/upload_test.php3 on line 18

Warning: fread(): supplied argument is not a valid File-Handle resource in 
/home/digital/public_html/upload_test.php3 on line 18


Here's my code:

html
head
titleStore binary data into SQL Database/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body bgcolor=#FF
 ?php
// code that will be executed if the form has been submitted:

if ($submit) {

// connect to the database
// (you may have to adjust the hostname,username or password)

MYSQL_CONNECT(localhost,,);
mysql_select_db(ipp_products);
$data = addslashes(fread(fopen($form_data, rb), filesize($form_data)));
   

$result=MYSQL_QUERY(INSERT INTO display_images (description,data) .
VALUES ('$form_description','$form_data'));

$id= mysql_insert_id();
print pThis file has the following Database ID: b$id/b;

MYSQL_CLOSE();
echo $data;
 
} else {

// else show the form to submit new data:
? 
form method=post action=?php echo $PHP_SELF; ? enctype=multipart/form-data
  File Description:br
  input type=text name=form_description  size=40
  input type=hidden name=MAX_FILE_SIZE value=100
  br
  File to upload/store in database:br
  input type=file name=form_data  size=40
  p
input type=submit name=submit value=submit
/form
?php

}

? 
/body
/html

Any ideas?

Thanks,
William Glenn
Import Parts Plus
http://www.importpartsplus.com


[PHP] Ereg help

2002-10-25 Thread William Glenn
Hey all,
I've been fighting this all night, I need a bit of help. I have a string like.

#21-935 Item Description: $35.95

Where the part # could be 10-2034 a combination of 2 and 3 or 4 digits, and the price 
could be a combination of 1,2,3 . 2 digits. I want to chop that string into Part # / 
Description / Price. 

I'd appreciate any help, I know this is probably real simple :) Thanks in advance.

Thanks,
William Glenn
Import Parts Plus
http://www.importpartsplus.com