Re: [PHP-DB] small database
Check the PHP-DB archives ;-) http://news.php.net/article.php?group=php.dbarticle=22433 Hatem - Original Message - From: Rich Hutchins [EMAIL PROTECTED] To: Seabird [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, November 13, 2002 12:24 AM Subject: RE: [PHP-DB] small database As you'll probably see in a lot of responses, it might be better to store the pictures in a folder on the server and store only the path to the pictures in the db. That keeps the size of the db smaller. If you choose to do that, use an HTML form with enctype=multipart/form-data and an input type=file element, send it to a PHP script to upload the file, move it to a specified directory and put the path and the filname in a table in your db. Then, when you need to display an image, just grab the path and insert it in an img src= tag. I don't know how to store an image directly in a database since I always store just the path. Sorry. HTH, Rich -Original Message- From: Seabird [mailto:jacco;vliegt.nl] Sent: Tuesday, November 12, 2002 11:56 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] small database Hi everyone, I'm creating a sample site for a company that does aircraft sales. I use a MySQL DB to store all the info of the available aircraft. Now, I would like to store pictures directly inside that same table, so that on the details page, it would provide a picture out of (for example) Field5. Is this possible and if so how? (I tried blob etc., but can't get it to work). Thanx, Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] images
hello, you can do it this way (using mysql): ?php /* create table images( img_id int(4) NOT NULL auto_increment, img_name varchar(60), img_file_type varchar(10), img_content blob, PRIMARY KEY (img_id) ) TYPE=MyISAM; */ if (empty($imgfile) or $go!==uploadimg) { // Generate the form to upload the image $form = form method=\post\ action=\\ enctype=\multipart/form-data\ Specify a name for your image : input type=\text\ name=\imgname\br/ Select your image file : input name=\imgfile\ type=\file\br/ input type=\submit\ value=\Submit\ input type=\hiddent\ name=\go\ value=\uploadimg\ /form; echo $form; } else { // You have an image that you can insert it in database /* Connecting, selecting database */ $link = @mysql_connect(mysql_host, mysql_user, mysql_password) or die(Could not connect); @mysql_select_db(my_database) or die(Could not select database); // if the file uploaded ? if (is_uploaded_file($imgfile)) { // Open the uploaded file $file = fopen($imgfile, r); // you can get the $imgtype also here ;) // Read in the uploaded file $image = fread($file, filesize($imgfile)); // Escape special characters in the file $image = AddSlashes($image); } else $image = NULL; $query = INSERT INTO images VALUES (NULL, '$imgname', '$imgtype', '$image'); $result = mysql_query( $query ) or die(Query failed); echo Hope this will help ;); } ? Regards, Hatem - Original Message - From: Edward Peloke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 15, 2002 9:23 PM Subject: [PHP-DB] images How can I allow the user to upload images to a php website and have the image stored in the mysql db? Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] images [Oops]
Oops sorry for never testing before sending :P the script works fine but there is a little change, there is a hiddent should be changed to hidden in the form ;) that's all, enjoy - Original Message - From: Hatem Ben [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 15, 2002 9:46 PM Subject: Re: [PHP-DB] images hello, you can do it this way (using mysql): ?php /* create table images( img_id int(4) NOT NULL auto_increment, img_name varchar(60), img_file_type varchar(10), img_content blob, PRIMARY KEY (img_id) ) TYPE=MyISAM; */ if (empty($imgfile) or $go!==uploadimg) { // Generate the form to upload the image $form = form method=\post\ action=\\ enctype=\multipart/form-data\ Specify a name for your image : input type=\text\ name=\imgname\br/ Select your image file : input name=\imgfile\ type=\file\br/ input type=\submit\ value=\Submit\ input type=\hiddent\ name=\go\ value=\uploadimg\ /form; echo $form; } else { // You have an image that you can insert it in database /* Connecting, selecting database */ $link = @mysql_connect(mysql_host, mysql_user, mysql_password) or die(Could not connect); @mysql_select_db(my_database) or die(Could not select database); // if the file uploaded ? if (is_uploaded_file($imgfile)) { // Open the uploaded file $file = fopen($imgfile, r); // you can get the $imgtype also here ;) // Read in the uploaded file $image = fread($file, filesize($imgfile)); // Escape special characters in the file $image = AddSlashes($image); } else $image = NULL; $query = INSERT INTO images VALUES (NULL, '$imgname', '$imgtype', '$image'); $result = mysql_query( $query ) or die(Query failed); echo Hope this will help ;); } ? Regards, Hatem - Original Message - From: Edward Peloke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 15, 2002 9:23 PM Subject: [PHP-DB] images How can I allow the user to upload images to a php website and have the image stored in the mysql db? Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Some data manipulation
i was trying to do it with preg_replace, but this is much better thanks a lot, Hatem - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Hatem Ben [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, October 06, 2002 3:09 AM Subject: Re: [PHP-DB] Some data manipulation So loop through and check the last char. Am I missing something that makes this harder than the obvious: foreach($arr as $key=$val) { $end = $val[strlen($val)-1]; switch($end) { case '1': $arr[$key] = substr($val,0,-1); break; case '2': case '3': $arr[$key] = substr($val,0,-1) . ((int)$end + 4); break; } } Not sure if you always want to add 4 to the last char when it ends in 2 or 3, but that was the only info you gave. -Rasmus On Sun, 6 Oct 2002, Hatem Ben wrote: hey all i have a database of arrays like this : Array ( [0] = 2- [1] = 8b2 [2] = 8#c3 [3] = 8b2 [4] = 8#f2 [5] = 4a2 [6] = 8a1 [7] = 8a2 [8] = 4a2 [9] = 4a2 [10] = 4a2 ) i just need to change in every string the last value when it is equal to 1,2 or 3 ex :: [0] = 2-won't be changed [0] = 2- [1] = 8b2 will be changed to [1] = 8b6 [2] = 8#c3 will be changed to[2] = 8#c7 [6] = 8a1 will be changed to[6] = 8a and so on Thanks for any help Hatem -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Some data manipulation
hey all i have a database of arrays like this : Array ( [0] = 2- [1] = 8b2 [2] = 8#c3 [3] = 8b2 [4] = 8#f2 [5] = 4a2 [6] = 8a1 [7] = 8a2 [8] = 4a2 [9] = 4a2 [10] = 4a2 ) i just need to change in every string the last value when it is equal to 1,2 or 3 ex :: [0] = 2-won't be changed [0] = 2- [1] = 8b2 will be changed to [1] = 8b6 [2] = 8#c3 will be changed to[2] = 8#c7 [6] = 8a1 will be changed to[6] = 8a and so on Thanks for any help Hatem -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] $_POST And $_REQUEST
$_REQUEST is an associative array consisting of the contents of $_GET, $_POST, $_COOKIE, and $_FILES http://www.php.net/manual/en/reserved.variables.php - Original Message - From: Shoulder to Shoulder Farm [EMAIL PROTECTED] To: PHP Database List [EMAIL PROTECTED] Sent: Sunday, October 06, 2002 1:50 AM Subject: [PHP-DB] $_POST And $_REQUEST Hi all, What is the difference between the $_POST and $_REQUEST functions (I can't find it in the docs)? Thanks, Taj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Very cool -= Code Generator =- !!!
i've check it, and also try it, code generated for a sample database won't run okay, most pages return errors ! if it will support others database, it will be a great tool Best regards, Hatem - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: 'johnny1b1g' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, September 29, 2002 4:19 PM Subject: RE: [PHP-DB] Very cool -= Code Generator =- !!! Use Codejay as your web assistant. Create ASP , PHP, COLDFUSION , ASP.NET web applications Save time and money. Visit www.codejay.com Interesting program, did anyone else check it out?? All it really does is generate reports and create admin interfaces to add/edit data in a database. The reports are pretty good, you can open your database, choose what columns you want, create relationships, add to the SQL Where clause, make the results links (and pass values in them) or images, etc. It would be useful to someone with no programming experience at all, which is always the case with these code generators. There are some issues with the PHP code creation, of course. For some reason, it uses $HTTP_GET_FILES, instead of $HTTP_GET_VARS. This, of course, causes the Prev/Next and other links to fail. There may be others, that's the obvious one I found right away. It also requires the user to turn on output buffering in php.ini. Why? The code for some reason contains a ob_start() and session_start() call, but it never uses a session or does anything with the buffer. If output buffering is required to be on in php.ini, then why call ob_start()?? I think it's a bad idea to require changes to php.ini, anyhow. And, the most blaring oversight, IMO, is that it only generates code for Access and MSSQL. ?? Come on...if you're going to take the time to write this, why not include MySQL? Plus, they need to run a spell and grammar check on the help files... :) Not worth 80 Euro / 82 dollars in my opinion... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Very cool -= Code Generator =- !!!
a php/mysql already exist : http://www.bigprof.com/appgini/ - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: 'johnny1b1g' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, September 29, 2002 4:19 PM Subject: RE: [PHP-DB] Very cool -= Code Generator =- !!! Use Codejay as your web assistant. Create ASP , PHP, COLDFUSION , ASP.NET web applications Save time and money. Visit www.codejay.com Interesting program, did anyone else check it out?? All it really does is generate reports and create admin interfaces to add/edit data in a database. The reports are pretty good, you can open your database, choose what columns you want, create relationships, add to the SQL Where clause, make the results links (and pass values in them) or images, etc. It would be useful to someone with no programming experience at all, which is always the case with these code generators. There are some issues with the PHP code creation, of course. For some reason, it uses $HTTP_GET_FILES, instead of $HTTP_GET_VARS. This, of course, causes the Prev/Next and other links to fail. There may be others, that's the obvious one I found right away. It also requires the user to turn on output buffering in php.ini. Why? The code for some reason contains a ob_start() and session_start() call, but it never uses a session or does anything with the buffer. If output buffering is required to be on in php.ini, then why call ob_start()?? I think it's a bad idea to require changes to php.ini, anyhow. And, the most blaring oversight, IMO, is that it only generates code for Access and MSSQL. ?? Come on...if you're going to take the time to write this, why not include MySQL? Plus, they need to run a spell and grammar check on the help files... :) Not worth 80 Euro / 82 dollars in my opinion... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Conversion from access to mysql
both tools don't work okay for me, i'm just using the export tool in MsAccess then convert database to xml, and thanks to PHP, i convert that to mysql queries. Just one problem when i want to convert binary data (pict or others), still haven't find a suitable solution for that. Best regards, Hatem - Original Message - From: Steven Dowd [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 12:54 PM Subject: Re: [PHP-DB] Conversion from access to mysql also http://www.dbtools.com.br this will work both ways accessmysql also supports excel , dbf, csv etc etc Steven - Original Message - From: Chris Grigor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 10:47 AM Subject: [PHP-DB] Conversion from access to mysql Hey there all This is more than likely a common question, anyone have any guidelines, do's or dont's about converting an access db to mysql db... Regards Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php