advice needed on whether this is possible

  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

hi all, I was just after a bit of advice on how to go about setting up a particular MySQL database - and even if its possible to write a PHP front end for it.

We have a number of kit inserts on our network, that the admin girls have to go and look for and attach to email

I would like to devise some kind of system, whereby they can search for the kit insert number.

It would list all the inserts that matched the string entered and display a tick box next to each resulting match.
Then they could tick whichever boxes they wanted and it would go off and attach the ticked inserts to an email

does this sound viable? is it possible?

Cheers everyone

Tommy
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • rjstephens
  • Professor
  • Professor
  • User avatar
  • Posts: 774
  • Loc: Brisbane, Australia

Post 3+ Months Ago

that is not too difficult to do. PHP/MySQL is ideal for that type of job.

To search them do a sql query something like:
select kit_id, kit_data
from kits
WHERE kit_data LIKE '%SEARCH TERM%'

the WHERE part is the important part as far as searching them is concerned.
  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

cheers,

I'm aware of the "where" part but what really makes my head spin is where do I store the actual inserts themselves? Can they somehow be stored inside of the database?

What I mean is, if 1 row consists of kit name, kit id - then can a third column be the actual file itself

Hope that makes sense
  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

and I guess the biggest thing is, how do I get it to attach to an email?
this involves interaction with outlook and well beyond my current scope
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

Just create the form, have a text box so tyhe e-mail it needs to go to can be entered and click send.

The PHP mail function will deal with the e-mailing (if you format it correctly you can attach the kit as well).

No need to do anything with outlook.

As for storing the file in the database it is a bit more complicated but I am sure it can be done.

There you go, storing binary data in MySQL,
http://www.phpbuddy.com/article.php?id=6
  • rjstephens
  • Professor
  • Professor
  • User avatar
  • Posts: 774
  • Loc: Brisbane, Australia

Post 3+ Months Ago

there is no need to deal with outlook, just use mail(), but I'm not sure how attachments are used with it. You'd have to look that up. But I'm sure it's not hard.

TO store files in a mysql database use a blob colum (or smallblob, largeblob, bigblob, etc. depending on how big the files are)

What format are the files in?
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

And here you will find the ref for sending attachments with PHP mail

http://www.zend.com/zend/spotlight/send ... lpart1.php

Man I love PHP
  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

thanks for those links

the files I'd need to use are approx 50k to 500k in size, so which should I use, or will any suffice
  • rjstephens
  • Professor
  • Professor
  • User avatar
  • Posts: 774
  • Loc: Brisbane, Australia

Post 3+ Months Ago

http://dev.mysql.com/doc/mysql/en/Strin ... rview.html

basically you have a choice between BLOB (which is limited at 64kb) and MEDIUMBLOB (which is limited at 16MB)

given that your max size is around 500kb, I would go for MEDIUMBLOB.

and btw if you store a 500kb in a mediumblob colum it only takes up (just over) 500kb - not the full 16MB max capacity.

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 143 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.