[PHP-DB] Re: [PHP] Creating a pdf document
On Thursday 24 January 2002 15:52, Mihail Bota wrote: Hello, I was wondering if I could save the result of a query in a pdf document. I looked for any functions that might help, but I got confused because I could not see how/where exactly to insert the necessary .dll's. First read the chapter PDF Functions. Then decide on, and install one of the supported PDF libraries. I'd like to do this (saving the output of a query) by using mysql installed on a Irix machine, and PHP4. This is absolutely possible. If you decide on using the PDFlib library then I recommend pc4p (http://sourceforge.net/projects/pc4p/). Its a class which makes creating PDFs extremely easy. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* MOUNT TAPE U1439 ON B3, NO RING */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Help -- Oracle
Help, i'm trying to connect to a remote oracle database from win98/apache/php4 and win2k/iis/php4 but it always gives me tns error. Other apps however, works fine with the tns configuration. the php oracle module was loaded successfully on both platforms. I've tried all sorts of possibilities. path to tnsnames.ora is correct. I've even tried with ODBC but when i used it with php, i get server refused connection. However, ODBC test was successfull and other apps can work with it. Thanks in advance. -- yuwin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Help -- Oracle
Help, i'm trying to connect to a remote oracle database from win98/apache/php4 and win2k/iis/php4 but it always gives me tns error. Other apps however, works fine with the tns configuration. the php oracle module was loaded successfully on both platforms. I've tried all sorts of possibilities. path to tnsnames.ora is correct. I've even tried with ODBC but when i used it with php, i get server refused connection. However, ODBC test was successfull and other apps can work with it. Can you give us the exact error message? Cheers, Graeme -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Problem with MySQL4.0.1 speed, cpu- and memory-usage
Hello, in order to be able to use the replication features of MySQL we recently gave version 4.0.1alpha a try, since these features are reportedly more reliable in this version - although it is still alpha. Unfortunately the disadvantages - at least on our machines - don't seem to make up for the advantages: we experienced a very high server load combined with higher memory-usage than usual, the average speed dropped to a level the tested databases became almost unusable. Let me explain our setup: we're running a site-internal messaging system that handles approx. 110.000 messages per day. The databases consists of a header and a content table, the first one being a fixed-length MyISAM-table with almost 40.000.000 records, the second one is a dynamic-length MyISAM-table with some 20.000.000 records. We don't use fancy stuff like InnoDB but only very basic SELECT (on indexed columns) and INSERT statements, not even JOINs. The whole thing runs on a 850MHz dual-pentium with 4GB memory under Linux 2.4.17 and RAID1. Until now we used MySQL 3.23.32 which in our tests remains the fastest version so far, all following versions (including 3.23.47 and 4.0.1alpha) remarkably dropped in speed. Now finally to my question: is there a way to speed up 4.0.1alpha (or any other version with reliable replication), maybe a different OS (BSD is reported to be more performant but we have no experience with that so far) could help? Are there any fine-tunings in the ./configure that may have a positive effect (we didn't notice big changes in speed and memory usage when playing with these options)? Usually we would just stick with 3.23.32 but, as mentioned above, we need the slightly more advanced and reliable replication features of its successors in order to be able to distribute read accesses to several slaves while the master does all the writing stuff. Any help/comments much appreciated Marcus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Pictures in MySQL database
Hello, I would like to create database with many pictures. I have problem with inserting pictures to table in MySQL. I created table where one of the name of column is image. The type of this column is LONGBLOB. How can I insert picture into this column? I tried insert a file (e.g. picture.jpg) to column image but I received so strange chars during selecting table. Best regards Kamil PLS. Send me more info on my private e-mail.
Re: [PHP-DB] Pictures in MySQL database
Re the PLS. Nope, replies to private email are contrary to spirit of the list. Storing inages in a database is not a good practice. Fetches are slow and the database becomes incredibly bloated. Most people store the images on disk and a reference to their location in the database and have found this faster and more reliable. Regards - Miles Thompson At 10:16 AM 1/24/2002 +0100, K wrote: Hello, I would like to create database with many pictures. I have problem with inserting pictures to table in MySQL. I created table where one of the name of column is image. The type of this column is LONGBLOB. How can I insert picture into this column? I tried insert a file (e.g. picture.jpg) to column image but I received so strange chars during selecting table. Best regards Kamil PLS. Send me more info on my private e-mail. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Pictures in MySQL database
Agreed, i think you'll find aan easy way of doing this is to name each image after the primary key to your table (ie 1.jpg, 2.jpg, 3.jpg etc if the primary key is an autonumber. and store them all in a certain file, then when you fetch the record from the table, you can run a simple check to see if there is an image corresponding to the record number in that file, and if so, display it. (if not, you can then use a default image, or a message saying no image. much easier than putting the binary stuff into a database! -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: 24 January 2002 14:04 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Pictures in MySQL database Re the PLS. Nope, replies to private email are contrary to spirit of the list. Storing inages in a database is not a good practice. Fetches are slow and the database becomes incredibly bloated. Most people store the images on disk and a reference to their location in the database and have found this faster and more reliable. Regards - Miles Thompson At 10:16 AM 1/24/2002 +0100, K wrote: Hello, I would like to create database with many pictures. I have problem with inserting pictures to table in MySQL. I created table where one of the name of column is image. The type of this column is LONGBLOB. How can I insert picture into this column? I tried insert a file (e.g. picture.jpg) to column image but I received so strange chars during selecting table. Best regards Kamil PLS. Send me more info on my private e-mail. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Help -- Oracle
Have you tried to replace the tnsname with its exact definition ? not the best thing to do, but it could be a workaround. Example : something like : $oracletns = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = 201.1.1.445) (Port = 1521) ) (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = 201.1.1.445) (Port = 1526) ) ) (CONNECT_DATA = (SID = ORCL) ) ); // instead of $oracletns = mydb_tcp $Conn=OCILogon($oracleusername, $oraclepassword,$oracletns) or die(connexion impossible); Regards, Philippe Yuwin [EMAIL PROTECTED] a écrit dans le message news: [EMAIL PROTECTED] Help, i'm trying to connect to a remote oracle database from win98/apache/php4 and win2k/iis/php4 but it always gives me tns error. Other apps however, works fine with the tns configuration. the php oracle module was loaded successfully on both platforms. I've tried all sorts of possibilities. path to tnsnames.ora is correct. I've even tried with ODBC but when i used it with php, i get server refused connection. However, ODBC test was successfull and other apps can work with it. Thanks in advance. -- yuwin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Php4 and Interbase 6 on linux
Hi there all! I've got a slight problem. I developed a web site using php4, apache 1.3 and Interbase 6 on a Win2000 platform. Now the web page needs to be moved to a linux server. The server is running Suse Linux 7.2 with apache and php4 already installed and is working fine. But now how do I enable Interbase support on linux for php4? On win2000 it was easy, just added the module in the extensions in php.ini and there we went, but how do I do it on linux?? Interbase is also already installed on the Linux server. Thanx guys. Paulu van Zijl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] multi-dimensional array
Hi, I am trying to load a multi-dimensional array to my mysql database and am having difficulty reading the array. I created the array in a script, and sent it to another script through a form. One of the variables that gets passed is $home_team[][]. with the outer array being the week #, and the inner array being the home team id#. Through PHP INFO function, I can see the array exists and has valid values HTTP_POST_VARS[home_team] Array ( [1] = Array ( [1] = 1 [2] = 3 ) [2] = Array ( [1] = 2 [2] = 4 ) [3] = Array ( [1] = 1 [2] = 2 ) [4] = Array ( [1] = 3 [2] = 4 ) [5] = Array ( [1] = 4 [2] = 2 ) [6] = Array ( [1] = 3 [2] = 1 ) ) When I try to view the information as a table, below is what I get: week_num flight_id match_date match_num home_team_id away_team_id 1 1 2002-01-01 1 Array[1] Array[1] 1 1 2002-01-01 2 Array[2] Array[2] 2 1 2002-01-08 1 Array[1] Array[1] 2 1 2002-01-08 2 Array[2] Array[2] 3 1 2002-01-15 1 Array[1] Array[1] 3 1 2002-01-15 2 Array[2] Array[2] 4 1 2002-02-05 1 Array[1] Array[1] 4 1 2002-02-05 2 Array[2] Array[2] 5 1 2002-02-12 1 Array[1] Array[1] 5 1 2002-02-12 2 Array[2] Array[2] 6 1 2002-02-19 1 Array[1] Array[1] 6 1 2002-02-19 2 Array[2] Array[2] The script that generated this table is calling for $home_team[$b][$c], where $b=The Week #(1-6), and $c=match#(1-2). I dont understand why it is outputting Array[1] or Array[2] instead of the home team id#, that I see is getting passed. Can anyone please help? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Creating a pdf document
Thanks a lot guys! This really helps a lot. MySql is not installed on my machine, so it would take a while to install all the necessary libraries. I'll stick with the material given by Daniel, for the moment. Mihai -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: Creating a pdf document
http://www.php.net/pdf You'll need Thomas Mertz' PDFlib, which is free for personal/not-for-profit use, but requires a license fee for commercial use: http://www.pdflib.com/pdflib/index.html -Andy -Original Message- From: Mihail Bota [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 23, 2002 11:53 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Creating a pdf document I was wondering if I could save the result of a query in a pdf document. I looked for any functions that might help, but I got confused because I could not see how/where exactly to insert the necessary .dll's. I'd like to do this (saving the output of a query) by using mysql installed on a Irix machine, and PHP4. If this is not possible, could I create a pdf document or a word document from a query from either Access database or mysql on a win2k system, PHP4.1? Any references that might help? Thanks for your help! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] # of Records in Table
You are incorrect regarding my appreciation of the help I receive from the list. I very much value the help received from everyone who is a contributor to the list. This is one of the reasons (of many) I chose to develop with PHP/MySQL. At this point in time I mainly receive help, however, when my knowledge and experience increases I hope to help those with questions. And the wheel goes round and round. Zach -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 24, 2002 2:02 AM To: Zach Curtis Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] # of Records in Table Zach, On the subject of sharing information we differ big-time: have you heard the story about the three blind men attempting to describe an elephant? Apparently you have failed to appreciate the self-help nature of the list. No one is paid to help you. However your behavior demands/evidences more goodwill and effort from your (several) correspondents than you have demonstrated yourself. Relational technology is all about the logical interrelationship between elements of data, both between tables and within a table. Perhaps some reading/revision is required. Accordingly without information about the subject-table, you are left with the two somewhat-artificial solutions offered: incremented field or timestamp as key, and a nagging feeling that wonders if there might be a 'better way'. You have just mentioned the serial file/data source. That opens a whole new avenue of attack! However time and goodwill can both be quickly exhausted. Let us know how you get on with the suggestions made so far, and if they don't work/you think there might be a better way, consider another approach for assistance. =dn - Original Message - From: Zach Curtis [EMAIL PROTECTED] To: DL Neil [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: 24 January 2002 00:01 Subject: RE: [PHP-DB] # of Records in Table There are many columns of data in the table. The only column that I would like to extract a value from is the password field (this is the key as well). I do not have an AUTO_INCREMENT field. Although, I see how adding that field could be of use by using it with the SELECT MAX() as you mentioned. The last record is whatever the last record was inserted using INSERT INTO. To give you the overall picture of what I am trying to accomplish: 1) I am opening up a db table and searching for the password of the last record in the table 2) I then open a flat file and search for that password and grab the next record after that (as records are appended to the end of the flat file) and any other subsequent records added to the flat file 3) Write those new records to the db table In this scenario, the last record would be the last record from the flat file added to the db table. Another suggestion from [EMAIL PROTECTED] was to: Select your password field, and whatever other fields you need to Use -mysql_num_rows() to capture the number of rows returned -mysql_data_seek() to position pointer on last row (remember indexing starts at 0) -mysql_fetch_row() or mysql_fetch_array(), your choice, to return the data. This is done with one select statement, however all the passwords from the table have to be loaded into array (perhaps not the most efficient way? But better than what I had come up with.). I do generally find that the more brief I am in describing an issue, the more likely I am to get a reply. Then details can be given if needed, in further correspondences. I will give that AUTO_INCREMENT and SELECT MAX() a try as well. Zach -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 23, 2002 3:27 PM To: Zach Curtis Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] # of Records in Table Zach, We're going back and forth on this and getting no where... So far all you have informed us is that the table has one column, which contains a bunch of passwords (I also suggest that this is not really the case and there'll at least be some sort of userId field - but you haven't bothered to tell me/us that) The concept of last in relational terminology is ambiguous. Do you mean last entered, or do you mean the row with the field containing the highest value in the column - for example. Some people are used to the idea that there is also some 'phantom' rowId that counts/labels each row. In other file systems this might have been the case, but the physically last record in an RDBMS table-file may not conform to either of the last definitions mentioned above. There is no such 'highest' in an RDBMS unless you put it there - as mentioned by another correspondent, it's a good idea to use some sort of 'id' field in every table. This can be generated for you with the AUTO_INCREMENT feature. With appropriate design, eg first record has id=1 and the succeeding records have id-s with ascending values, then you can use SELECT MAX() against
RE: [PHP-DB] How to find out the number of rows in a table?
SELECT count(*) AS ctr FROM mytable; -Original Message- From: Andy [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 24, 2002 10:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to find out the number of rows in a table? Hi there, I am trying to find out the number of rows in a table. The mysql docu says there is a mysql_num_rows statement but it requiers a sql statement in front. How could I do this more efficiently? Can anybody make an example, please? I am sure that there is an more easy way. Cheers Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySQL Persistent-Links in SafeMode PHP4.1.1 on Linux
Hi Group, im encountering a problem with safemode and pers. links: Running unsafe mode everything is fine, when i turn on safemode the call to mysql-db with mysql_pconnect fails with cant connect to mysql thru socket /tmp/mysql.sock. This will only hasppend if i use persistent connect - normal connects work fine. I havent found a socket-file in /tmp but in /var/lib/mysql - so might be thats the prob - but why is it working in unsafe mode then ?? any hints ?? Oli -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How to find out the number of rows in a table?
Try the following: $sql = select count(*) as c from your_table ; $result = mysql_query(your_db, $sql, your_connection_identifier) ; $row_count = mysql_result($result, 0, 'c') ; Now $row_count contains the number of rows in your table named your_table HTH --Sam Masiello Andy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there, I am trying to find out the number of rows in a table. The mysql docu says there is a mysql_num_rows statement but it requiers a sql statement in front. How could I do this more efficiently? Can anybody make an example, please? I am sure that there is an more easy way. Cheers Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Count(*)
Thank you everyone. The "COUNT(*) AS c" worked great. ---Original Message--- From: Kai Voigt Date: Friday, 25 January 2002 11:11:06 a. To: Barry Rumsey Cc: [EMAIL PROTECTED] Subject: Re: Count(*) Barry Rumsey wrote: I have this small query on a page:emit source="sql" host=xoops query= SELECT COUNT(*) FROM xp_topics WHERE artist='artist' ORDER BY topicid DESC LIMIT 1"sql.artist;/emitUse "SELECT COUNT(*) AS C FROM ..." instead. Then you can access thecount value as sql.c;Kai-- dreiecksplatz 8, d-24105 kiel, +49-431-22199869, http://k.123.org/. IncrediMail - Email has finally evolved - Click Here
Re: [PHP-DB] Php4 and Interbase 6 on linux
Hi, You need to recompile PHP with support for Interbase. I would recommend reading the instructions on linux PHP installations on the PHP website. I imagine the conifgure option is something like --with-interbase=path_to_interbase but definately don't quote me on that. Cheers, db Paulu van Zijl wrote: Hi there all! I've got a slight problem. I developed a web site using php4, apache 1.3 and Interbase 6 on a Win2000 platform. Now the web page needs to be moved to a linux server. The server is running Suse Linux 7.2 with apache and php4 already installed and is working fine. But now how do I enable Interbase support on linux for php4? On win2000 it was easy, just added the module in the extensions in php.ini and there we went, but how do I do it on linux?? Interbase is also already installed on the Linux server. Thanx guys. Paulu van Zijl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- Dan Barton Terrestrial Program Biologist Point Reyes Bird Observatory http://www.prbo.org [EMAIL PROTECTED] 415.868.0655 x374 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] dynamic sql
Is it possible to do a sort of dynamic sql. For instance, if I have a form with a bunch of field/data variables and I send them to a php processor, can I just create a loop to have it update all the fields without having to specify each field. In scratch code, I guess I'm looking for something like this: sql = UPDATE my_table SET $table_field_name = $table_field_value WHERE table_id = $table_id If you see how I'm trying to make the field name a dynamic variable, then you can see what I'm trying to do. I have no problem with the dynamic field value, it's just the dynamic field name that I'm not sure how/if I can create it dynamically. Can anyone help with this? Or can anyone tell me it can't be done? Thanks Mike
[PHP-DB] problem with LOAD DATA INFILE for date format
Hi, I have a sample data like below in text file (policy.txt). PolicyNo,DateOfBirth,PaidToDate 0003573607, 9/25/1973, 8/27/2001 708802,11/26/1959, 5/25/1998 0002776507, 3/19/1973,11/18/1999 0002776703, 3/13/1969,11/18/1999 Policy table structure: +---+-+ | Field | Type| +---+-+ | PolicyNumber | char(10)| | DateOfBirth | date| | PaidToDate| date| +---+-+ When I do: LOAD DATA INFILE policy.txt INTO TABLE Policy FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n' IGNORE 1 LINES; All data in field DateOfBirth PaidToDate become -00-00 I notice this is because mysql only accept date format in -mm-dd. However, in my text file, the date format is in mm/dd/ format. Any idea? Thanks in advance. Hendra -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] dynamic sql
Have you tried it? I've done this sort of thing before, and it works just fine. By the time the query string is executed, the variables have been interpreted. So, if $colName = id, and $id = 12, then your query variable looks something like select * from myTable where $colName = $id. By the time you get to executing the query, it's been interpolated (?) to select * from myTable where id = 12. Michael K. Dolan Jr. wrote: Is it possible to do a sort of dynamic sql. For instance, if I have a form with a bunch of field/data variables and I send them to a php processor, can I just create a loop to have it update all the fields without having to specify each field. In scratch code, I guess I'm looking for something like this: sql = UPDATE my_table SET $table_field_name = $table_field_value WHERE table_id = $table_id If you see how I'm trying to make the field name a dynamic variable, then you can see what I'm trying to do. I have no problem with the dynamic field value, it's just the dynamic field name that I'm not sure how/if I can create it dynamically. Can anyone help with this? Or can anyone tell me it can't be done? Thanks Mike -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupery Push the button, Max! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] dynamic sql
Rich, thanks. I got the dynamic sql to work (i had a syntax problem), now my problem is what's the most efficient way to loop it through all the form fields that are passed to the processor? This is my current sql statement which handles 1 field: $sql_update = UPDATE md_users SET .$formName. = '$formValue' WHERE user_id = $user_id; How can I loop this through all the form fields? efficiently? I'm thinking of 2 scenarios, 1. loop and create an update and execute statement for each variable, but that has to be inefficient. 2. concantinate all the fields and then enter the names values where I have .$formName and $formValue - I don't know how to access an array of the posted values in php. I can do it in ASP with a request array, but I'm stuck on the PHP equivalent. If anyone can help, I'd appreciate it. Thanks, Mike
Re: [PHP-DB] problem with LOAD DATA INFILE for date format
There may be a better way, but in migrating from Filemaker to MySQL, I encountered similar problems. My solution was to pass the data through Excel and use that to convert the dates into the required format (CTRL-1, Custom, -mm-dd). Of course, you ned to watch out for those nasty ' ' ' that Excel puts around any cell containing a comma. So you might need to filter the output from excel in a text editor too but if its a one-off, its worth it. george - Original Message - From: Hendra [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 25, 2002 5:09 AM Subject: [PHP-DB] problem with LOAD DATA INFILE for date format Hi, I have a sample data like below in text file (policy.txt). PolicyNo,DateOfBirth,PaidToDate 0003573607, 9/25/1973, 8/27/2001 708802,11/26/1959, 5/25/1998 0002776507, 3/19/1973,11/18/1999 0002776703, 3/13/1969,11/18/1999 Policy table structure: +---+-+ | Field | Type| +---+-+ | PolicyNumber | char(10)| | DateOfBirth | date| | PaidToDate| date| +---+-+ When I do: LOAD DATA INFILE policy.txt INTO TABLE Policy FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n' IGNORE 1 LINES; All data in field DateOfBirth PaidToDate become -00-00 I notice this is because mysql only accept date format in -mm-dd. However, in my text file, the date format is in mm/dd/ format. Any idea? Thanks in advance. Hendra -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]