RE: [PHP-DB] Dynamic data from user file
Sean, Not sure if this helps, but when I developed an in house app for my company I have to migrate from very messy access db to mysql and I still have to import once a week from the old db as other people still use it. I just setup an array with oldtable and newtable then oldfield, newfield etc. then parse through that array with a loop that inserts the new value line for line and it works fine for me. There is possibly a better way of going about it, but this works for me. Cheers Simon -Original Message- From: John Patrick [mailto:[EMAIL PROTECTED]] Sent: 9 October 2002 00:15 To: [EMAIL PROTECTED] Subject: [PHP-DB] Dynamic data from user file Greetings: I currently am using the fgetcsv function to read in fields from a user-defined file. The delimited file is read and displayed just fine. Firstly, what I'm trying to accomplish: The MySQL database has a table with about 30 fields. The user-defined file may contain only some of these fields and in no particular order. I'm trying to achieve a way for the user to specify what each field is so the insert into MySQL is done correctly. (An analogy would be a custom import. The problem I'm having is finding the best way to go about this. I've been able to read in the data via fgetcsv and dynamically displaying a drop down box above each field with all possible choices but am unable to create a way to link the two for each field successfully. Been looking for solutions as well as trial and error to no avail. Any suggestions? -Sean. -- 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] Informix
Does anyone know of a good infrmix list I am in a fix.. Thanks _ Simon Taylor AfriTol (Pty) Ltd. ? [EMAIL PROTECTED] Å+27 12 361 3303 ext 257 Å+27 72 471 1833 Æ+27 12 365 3810 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MS Access Connectivity
Hi I have a problem connecting to ms access over a network as follows. I have set up the system dsn with the correct path, I use odbc_connect( dsn, user, pwd ); to connect. I get a sql error [odbc Microsoft Access Driver] '(unknown)' is not a valid path sql state S1009 in sqlConnect ... If i copy the db to the local drive and amend the system dsn to map to the local drive it works, MS Excel can also connect to the db over the network. Any ideas? Regards Steve Dodkins IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Advanced search scripts
What database are you using? ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 2:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Advanced search scripts I was wondering if anyone has some resources (links or scripts) on 'advanced site searches'. Something that is similar to the way regular search engines process requests. ie. phrase or two word +required -not included Also, returning details of that search, say for example returning 10 words before and 10 words after and displaying it in search results. The ability to search similar words (eg. ignoring punctuation) would be cool aswell. I am interested in this for database (all text fields), and also searching text files on filesystem. Now, I'm not trying to recreate Google or anything, and this is just for my own research (at this time), but I eventually would like to be able to create a smarter site searching engine. Can anyone give suggestions? or any links to tutorials (or books) I have used regex a little bit before, but not in PHP (only ASP and JavaScript). Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Advanced search scripts
Well, for this example, you could use mySQL, but really, I would be looking to utilise this on any database. Personally, I don't think this would be database dependent (unless you have other ideas). Adam On Wednesday, October 9, 2002, at 08:46 PM, John W. Holmes wrote: What database are you using? ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 2:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Advanced search scripts I was wondering if anyone has some resources (links or scripts) on 'advanced site searches'. Something that is similar to the way regular search engines process requests. ie. phrase or two word +required -not included Also, returning details of that search, say for example returning 10 words before and 10 words after and displaying it in search results. The ability to search similar words (eg. ignoring punctuation) would be cool aswell. I am interested in this for database (all text fields), and also searching text files on filesystem. Now, I'm not trying to recreate Google or anything, and this is just for my own research (at this time), but I eventually would like to be able to create a smarter site searching engine. Can anyone give suggestions? or any links to tutorials (or books) I have used regex a little bit before, but not in PHP (only ASP and JavaScript). Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Advanced search scripts
If you're looking at a PHP only solution, then you've got to build an engine that'll parse the search text, i.e. separate the quoted areas, the +words, -words, etc and form that into a usable SQL query. As for the table you search, using LIKE would be horribly slow on a large table, so you'll probably have to build a keyword table and relate each keyword back to the original table it was in. Then you'd search on these keywords. It would probably be better and faster to use a database solution, i.e. fulltext indexing in MySQL. It already supports searching with +word and -word, not sure about quotes, though. I'm sure other databases have their own method of doing this and I'm sure it would be faster overall because the database knows where everything is at and you don't have to build a keyword table. My $0.02. ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 6:54 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Advanced search scripts Well, for this example, you could use mySQL, but really, I would be looking to utilise this on any database. Personally, I don't think this would be database dependent (unless you have other ideas). Adam On Wednesday, October 9, 2002, at 08:46 PM, John W. Holmes wrote: What database are you using? ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 2:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Advanced search scripts I was wondering if anyone has some resources (links or scripts) on 'advanced site searches'. Something that is similar to the way regular search engines process requests. ie. phrase or two word +required -not included Also, returning details of that search, say for example returning 10 words before and 10 words after and displaying it in search results. The ability to search similar words (eg. ignoring punctuation) would be cool aswell. I am interested in this for database (all text fields), and also searching text files on filesystem. Now, I'm not trying to recreate Google or anything, and this is just for my own research (at this time), but I eventually would like to be able to create a smarter site searching engine. Can anyone give suggestions? or any links to tutorials (or books) I have used regex a little bit before, but not in PHP (only ASP and JavaScript). Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Advanced search scripts
FYI about MySQL Fulltext searching. It's got everything you already want (in version 4.0.1+): The boolean full-text search capability supports the following operators: + A leading plus sign indicates that this word must be present in every row returned. - A leading minus sign indicates that this word must not be present in any row returned. By default (when neither plus nor minus is specified) the word is optional, but the rows that contain it will be rated higher. This mimicks the behaviour of MATCH() ... AGAINST() without the IN BOOLEAN MODE modifier. These two operators are used to change a word's contribution to the relevance value that is assigned to a row. The operator decreases the contribution and the operator increases it. See the example below. ( ) Parentheses are used to group words into subexpressions. ~ A leading tilde acts as a negation operator, causing the word's contribution to the row relevance to be negative. It's useful for marking noise words. A row that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator. * An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended. The phrase, that is enclosed in double quotes , matches only rows that contain this phrase literally, as it was typed. http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html #Fulltext_Search ---John Holmes... -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 7:02 AM To: 'Adam Royle' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts If you're looking at a PHP only solution, then you've got to build an engine that'll parse the search text, i.e. separate the quoted areas, the +words, -words, etc and form that into a usable SQL query. As for the table you search, using LIKE would be horribly slow on a large table, so you'll probably have to build a keyword table and relate each keyword back to the original table it was in. Then you'd search on these keywords. It would probably be better and faster to use a database solution, i.e. fulltext indexing in MySQL. It already supports searching with +word and -word, not sure about quotes, though. I'm sure other databases have their own method of doing this and I'm sure it would be faster overall because the database knows where everything is at and you don't have to build a keyword table. My $0.02. ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 6:54 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Advanced search scripts Well, for this example, you could use mySQL, but really, I would be looking to utilise this on any database. Personally, I don't think this would be database dependent (unless you have other ideas). Adam On Wednesday, October 9, 2002, at 08:46 PM, John W. Holmes wrote: What database are you using? ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 2:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Advanced search scripts I was wondering if anyone has some resources (links or scripts) on 'advanced site searches'. Something that is similar to the way regular search engines process requests. ie. phrase or two word +required -not included Also, returning details of that search, say for example returning 10 words before and 10 words after and displaying it in search results. The ability to search similar words (eg. ignoring punctuation) would be cool aswell. I am interested in this for database (all text fields), and also searching text files on filesystem. Now, I'm not trying to recreate Google or anything, and this is just for my own research (at this time), but I eventually would like to be able to create a smarter site searching engine. Can anyone give suggestions? or any links to tutorials (or books) I have used regex a little bit before, but not in PHP (only ASP and JavaScript). Adam -- 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] Advanced search scripts
John (and list), Do you know if MySQL 4.0.x and PHP 4.2.x are fully compatible? I'm interested in the topics you have been discussing in this thread and don't really want to pursue upgrading MySQL if the support is only experimental at this stage (i.e. Apache 2.0). Thanks, Rich -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 7:08 AM To: 'Adam Royle' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts FYI about MySQL Fulltext searching. It's got everything you already want (in version 4.0.1+): The boolean full-text search capability supports the following operators: + A leading plus sign indicates that this word must be present in every row returned. - A leading minus sign indicates that this word must not be present in any row returned. By default (when neither plus nor minus is specified) the word is optional, but the rows that contain it will be rated higher. This mimicks the behaviour of MATCH() ... AGAINST() without the IN BOOLEAN MODE modifier. These two operators are used to change a word's contribution to the relevance value that is assigned to a row. The operator decreases the contribution and the operator increases it. See the example below. ( ) Parentheses are used to group words into subexpressions. ~ A leading tilde acts as a negation operator, causing the word's contribution to the row relevance to be negative. It's useful for marking noise words. A row that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator. * An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended. The phrase, that is enclosed in double quotes , matches only rows that contain this phrase literally, as it was typed. http://www.mysql.com/documentation/mysql/bychapter/manual_Refe rence.html #Fulltext_Search ---John Holmes... -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 7:02 AM To: 'Adam Royle' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts If you're looking at a PHP only solution, then you've got to build an engine that'll parse the search text, i.e. separate the quoted areas, the +words, -words, etc and form that into a usable SQL query. As for the table you search, using LIKE would be horribly slow on a large table, so you'll probably have to build a keyword table and relate each keyword back to the original table it was in. Then you'd search on these keywords. It would probably be better and faster to use a database solution, i.e. fulltext indexing in MySQL. It already supports searching with +word and -word, not sure about quotes, though. I'm sure other databases have their own method of doing this and I'm sure it would be faster overall because the database knows where everything is at and you don't have to build a keyword table. My $0.02. ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 6:54 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Advanced search scripts Well, for this example, you could use mySQL, but really, I would be looking to utilise this on any database. Personally, I don't think this would be database dependent (unless you have other ideas). Adam On Wednesday, October 9, 2002, at 08:46 PM, John W. Holmes wrote: What database are you using? ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 2:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Advanced search scripts I was wondering if anyone has some resources (links or scripts) on 'advanced site searches'. Something that is similar to the way regular search engines process requests. ie. phrase or two word +required -not included Also, returning details of that search, say for example returning 10 words before and 10 words after and displaying it in search results. The ability to search similar words (eg. ignoring punctuation) would be cool aswell. I am interested in this for database (all text fields), and also searching text files on filesystem. Now, I'm not trying to recreate Google or anything, and this is just for my own research (at this time), but I eventually would like to be able to create a smarter site searching engine. Can anyone give suggestions? or any links to tutorials (or books) I have used regex a little bit before, but not in PHP (only ASP and JavaScript). Adam -- PHP
RE: [PHP-DB] Advanced search scripts
Well, MySQL 4 is still marked as a development version, so it's not completely finished yet. PHP will interface with it no problem, though, all it really does is connect and send queries. Nothing has changed there. PHP 4.3 will provide support for connecting to the database with SSL. That's the only thing so far that's not supported, as far as I know. ---John Holmes... -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 8:35 AM To: '[EMAIL PROTECTED]' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts John (and list), Do you know if MySQL 4.0.x and PHP 4.2.x are fully compatible? I'm interested in the topics you have been discussing in this thread and don't really want to pursue upgrading MySQL if the support is only experimental at this stage (i.e. Apache 2.0). Thanks, Rich -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 7:08 AM To: 'Adam Royle' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts FYI about MySQL Fulltext searching. It's got everything you already want (in version 4.0.1+): The boolean full-text search capability supports the following operators: + A leading plus sign indicates that this word must be present in every row returned. - A leading minus sign indicates that this word must not be present in any row returned. By default (when neither plus nor minus is specified) the word is optional, but the rows that contain it will be rated higher. This mimicks the behaviour of MATCH() ... AGAINST() without the IN BOOLEAN MODE modifier. These two operators are used to change a word's contribution to the relevance value that is assigned to a row. The operator decreases the contribution and the operator increases it. See the example below. ( ) Parentheses are used to group words into subexpressions. ~ A leading tilde acts as a negation operator, causing the word's contribution to the row relevance to be negative. It's useful for marking noise words. A row that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator. * An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended. The phrase, that is enclosed in double quotes , matches only rows that contain this phrase literally, as it was typed. http://www.mysql.com/documentation/mysql/bychapter/manual_Refe rence.html #Fulltext_Search ---John Holmes... -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 7:02 AM To: 'Adam Royle' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts If you're looking at a PHP only solution, then you've got to build an engine that'll parse the search text, i.e. separate the quoted areas, the +words, -words, etc and form that into a usable SQL query. As for the table you search, using LIKE would be horribly slow on a large table, so you'll probably have to build a keyword table and relate each keyword back to the original table it was in. Then you'd search on these keywords. It would probably be better and faster to use a database solution, i.e. fulltext indexing in MySQL. It already supports searching with +word and -word, not sure about quotes, though. I'm sure other databases have their own method of doing this and I'm sure it would be faster overall because the database knows where everything is at and you don't have to build a keyword table. My $0.02. ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 6:54 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Advanced search scripts Well, for this example, you could use mySQL, but really, I would be looking to utilise this on any database. Personally, I don't think this would be database dependent (unless you have other ideas). Adam On Wednesday, October 9, 2002, at 08:46 PM, John W. Holmes wrote: What database are you using? ---John Holmes... -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 2:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Advanced search scripts I was wondering if anyone has some resources (links or scripts) on 'advanced site searches'. Something that is similar to the way regular search engines process requests. ie. phrase or two word +required -not included Also, returning details of that search, say for example returning 10 words before and 10 words after
RE: [PHP-DB] Advanced search scripts
For what its worth. I wrote to the MySql folks asking about a production release date and the reply was that they consider the latest in Beta, and according to them, that is 'production ready' as it has gone through adn passed all their rigorous testing. Have I upgraded yet? No. But, I've seen this mentioned a couple times out here and thought it was worth sharing. Jeff John W. Holmes holmes072000@chaTo: 'Hutchins, Richard' [EMAIL PROTECTED] rter.netcc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts 10/09/2002 08:46 AM Please respond to holmes072000 Well, MySQL 4 is still marked as a development version, so it's not completely finished yet. PHP will interface with it no problem, though, all it really does is connect and send queries. Nothing has changed there. PHP 4.3 will provide support for connecting to the database with SSL. That's the only thing so far that's not supported, as far as I know. ---John Holmes... -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 8:35 AM To: '[EMAIL PROTECTED]' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts John (and list), Do you know if MySQL 4.0.x and PHP 4.2.x are fully compatible? I'm interested in the topics you have been discussing in this thread and don't really want to pursue upgrading MySQL if the support is only experimental at this stage (i.e. Apache 2.0). Thanks, Rich -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 7:08 AM To: 'Adam Royle' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts FYI about MySQL Fulltext searching. It's got everything you already want (in version 4.0.1+): The boolean full-text search capability supports the following operators: + A leading plus sign indicates that this word must be present in every row returned. - A leading minus sign indicates that this word must not be present in any row returned. By default (when neither plus nor minus is specified) the word is optional, but the rows that contain it will be rated higher. This mimicks the behaviour of MATCH() ... AGAINST() without the IN BOOLEAN MODE modifier. These two operators are used to change a word's contribution to the relevance value that is assigned to a row. The operator decreases the contribution and the operator increases it. See the example below. ( ) Parentheses are used to group words into subexpressions. ~ A leading tilde acts as a negation operator, causing the word's contribution to the row relevance to be negative. It's useful for marking noise words. A row that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator. * An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended. The phrase, that is enclosed in double quotes , matches only rows that contain this phrase literally, as it was typed. http://www.mysql.com/documentation/mysql/bychapter/manual_Refe rence.html #Fulltext_Search ---John Holmes... -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 7:02 AM To: 'Adam Royle' Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Advanced search scripts If you're looking at a PHP only solution, then you've got to build an engine that'll parse the search text, i.e. separate the quoted areas, the +words, -words, etc and form that into a usable SQL query. As for the
[PHP-DB] Separating content from style
Folks, I've just learned a bit about Java Beans and how they are useful in separating content from style. They let you do XSLT'ish stuff in your HTML to grab data while not bogging down your HTML with database-related function calls. I've heard this setup referred to as templates and 3-tier. It has all kinds of advantages, the biggest of which is probably the ability to specialize: Allow your web-designer to work with HTML/CSS and your DBA to work with SQL, with no overlap. Obviously, PHP doesn't really lend itself to this sort of setup at first. At least, I haven't found a good way to do it. Does anyone have any good docs on how to setup a 3-tier templated system in PHP that separates content from style? If not, how about a few words on this idea? What are your thoughts? How can PHP tackle this problem? advTHANKSance, Dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] DEALING WITH RETRIEVING AND WRITING DATE VALUE FROM/TO TABLE
I need to know how to retrieve a date field from a database table using MYSQL_DB_QUERY to create recordset. As well as writing a Date Variable to a table using MYSQL_QUERY . YOURS Truly, Robert Leahong. [EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DEALING WITH RETRIEVING AND WRITING DATE VALUE FROM/TO TABLE
I need to know how to retrieve a date field from a database table using MYSQL_DB_QUERY to create recordset. As well as writing a Date Variable to a table using MYSQL_QUERY . For one, don't use mysql_db_query(), it's depreciated. You'd use mysql_query() for both instances and mysql_fetch_row/array/assoc/object to fetch the returned data. Please learn some SQL and read over the MySQL chapter of the PHP manual. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Separating content from style
One of the most popular template engines is Smarty. Search on google for it. There are plenty of others and even some modules that can be installed into PHP for faster performance. YOu can easily seperate logic from presentation with PHP, but most people choose not to. For most simple projects out there, there's no reason to involve database abstraction and templating... ---John Holmes... - Original Message - From: Dave Smith [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 11:26 AM Subject: [PHP-DB] Separating content from style Folks, I've just learned a bit about Java Beans and how they are useful in separating content from style. They let you do XSLT'ish stuff in your HTML to grab data while not bogging down your HTML with database-related function calls. I've heard this setup referred to as templates and 3-tier. It has all kinds of advantages, the biggest of which is probably the ability to specialize: Allow your web-designer to work with HTML/CSS and your DBA to work with SQL, with no overlap. Obviously, PHP doesn't really lend itself to this sort of setup at first. At least, I haven't found a good way to do it. Does anyone have any good docs on how to setup a 3-tier templated system in PHP that separates content from style? If not, how about a few words on this idea? What are your thoughts? How can PHP tackle this problem? advTHANKSance, Dave -- 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] Separating content from style
Op woensdag 09 oktober 2002 18:29, schreef u: One of the most popular template engines is Smarty. Search on google for it. http://smarty.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Separating content from style
My $0.02 worth, For the purposes of sanity (mine) I treat a combination of PHP/HTML in the web page as the middle tier (Controller), the browser and any JavaScript as the front-end (View) and a combination of PHP objects and the database as the backend (Model). This warped view of MVC allows me to incorporate some PHP in the HTML so I can avoid things like tag libraries and template engines. (Nothing wrong with them, they are just one MORE level of abstraction) As a rule, I do not allow the code that is in my web page to access the database. All database access is done through objects. I also do not let objects (with 1 exception, my FormBuilder class) generate HTML. Depending on the project, I may code mysql_* commands in my objects or (my preferred method) utilize ADODB as my database abstraction layer. (BTW, I don't use it because I switch databases a lot, I use it because I like the feature set.) Therefore, my web pages usually: Instantiate the objects necessary to build the page. Manipulate the objects and wrap them in HTML. Destroy the objects and send the page to the browser. It's not true MVC or pure OOP but it's the best compromise I've come up with. =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Dave Smith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Separating content from style Folks, I've just learned a bit about Java Beans and how they are useful in separating content from style. They let you do XSLT'ish stuff in your HTML to grab data while not bogging down your HTML with database-related function calls. I've heard this setup referred to as templates and 3-tier. It has all kinds of advantages, the biggest of which is probably the ability to specialize: Allow your web-designer to work with HTML/CSS and your DBA to work with SQL, with no overlap. Obviously, PHP doesn't really lend itself to this sort of setup at first. At least, I haven't found a good way to do it. Does anyone have any good docs on how to setup a 3-tier templated system in PHP that separates content from style? If not, how about a few words on this idea? What are your thoughts? How can PHP tackle this problem? advTHANKSance, Dave -- 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] Separating content from style
John, On October 9, 2002 04:29 pm, 1LT John W. Holmes wrote: One of the most popular template engines is Smarty. Search on google for it. There are plenty of others and even some modules that can be installed into PHP for faster performance. Yes, there are many. I typically use a very simple template engine that I crafted myself. Performance usually isn't a problem, and if it is you could always just make a minimal engine that will meet your needs (by sacrificing features for speed). YOu can easily seperate logic from presentation with PHP, but most people choose not to. For most simple projects out there, there's no reason to involve database abstraction and templating... Agreed. Well, there is at least *one* reason to involve templating and db abstraction in simple projects. By using good practices for small projects, there won't be so much temptation to slink out of them on larger projects! While sound design (abstraction, logic seperation, what not) may not yield as many advantages in small projects, it is absolutely commendable to apply best practice standards to all projects. Cheers, -- Mark Nenadov, Freelance Software Developer web: http://www.freelance-developer.com e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help Help
I am having trouble configuring IIS. I have a IIS 5.0 server with php installed on it by I can't get my php script to run from my pc. I can get it to run from the server and other pcs but not mine. It gives me a 404 error my regular web pages come up just fine. '.php' files will not load. Help please. Dan J. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Separating content from style
I agree that it is always good practice to use good design even for small projects, because they almost invariably turn into large projects if you don't. ;) This has been some great info. I appreciate it. Can someone explain what the purpose of a template engine is and possibly draw up a simple diagram of how one might work as it relates to DB-related projects? Thanks again for the great info. You guys rock! Thanks, Dave On Wed, 9 Oct 2002, Mark Nenadov wrote: John, On October 9, 2002 04:29 pm, 1LT John W. Holmes wrote: One of the most popular template engines is Smarty. Search on google for it. There are plenty of others and even some modules that can be installed into PHP for faster performance. Yes, there are many. I typically use a very simple template engine that I crafted myself. Performance usually isn't a problem, and if it is you could always just make a minimal engine that will meet your needs (by sacrificing features for speed). YOu can easily seperate logic from presentation with PHP, but most people choose not to. For most simple projects out there, there's no reason to involve database abstraction and templating... Agreed. Well, there is at least *one* reason to involve templating and db abstraction in simple projects. By using good practices for small projects, there won't be so much temptation to slink out of them on larger projects! While sound design (abstraction, logic seperation, what not) may not yield as many advantages in small projects, it is absolutely commendable to apply best practice standards to all projects. Cheers, -- ,-._.-._.-._.-._.-. `-. ,-' .--. | | | Cool nerds use ASCII | | | | art at the bottom of | | | | their emails. | | | || ,';..-. || ;';_' )] ||; `-| |`.`T-| `--._ \| | `-; | | |....-| /\/ |..| ,'`./ ,( | \_.-|_/,-/ ii | | `.' `-/ .-||| /`^-; |||| / / `.__/ | || / | || | || -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Separating content from style
Dave, This has been some great info. I appreciate it. Can someone explain what the purpose of a template engine is and possibly draw up a simple diagram of how one might work as it relates to DB-related projects? Obviously the main purpose of a template engine is to seperate code from HTML (or WML or whatever you are using for the UI). Personally, the most pressing reason I have used template engines has been to make it easy for web designers who can just take my templates (which contain only HTML) and can edit them without having to worry about seeing PHP code. A template engine essentially takes template files (files with HTML in them), replaces tags in them and then displays them. A usage of a very simple template engine works like this: a) you have a template file called users.tpl (containing the HTML for a user information screen) b) you have two tags in user.tpl, lets say %%user_name%% and %%password%% c) you have code in, lets say user.php, that looks like this: $tpl = new CoolTemplateEngine(); $tpl-open(users.tpl); $tpl-replace(user_name, Bob Jones); $tpl-replace(password, walk3r); $tpl-display(); Essentially that code opens the template engine, replaces tags with meaningful values and then displays it. Obviously most template engine uses are more complicated that this.. almost all will contain some sort of block functionality and the ability to loop and possibly have conditional statements. From what I hear SMARTY pretty much has a mini scripting language embedded into it! Essentially all template engines do these steps (though in slightly different ways): (1) open a template (2) replace tokens (aka tags) in the template with meaningful data (3) display the template with the replaced tokens Hope that helps... -- Mark Nenadov, Freelance Software Developer web: http://www.freelance-developer.com e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Multi-Dimensional Arrays
I am trying to create an array to hold shopping cart information. The array I am using is called cartArray. What I want to do is to define a sub-array of cartArray with the information from one product. Then the next time a product is added it appends then new information as a second sub-array to cartArray and so forth. Following is some code I have been using to test with and so far PHP will let me use .= to append but when I try to call it back with print_r or echo array[][] only the first entry is returned. Any ideas what I am doing wrong? $brand=Brand1; $itemnumber=456789; $itemname=Some Item Name; $itemqty=3; $cartArray[] .= array(0=array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; $brand=Brand2; $itemnumber=123456; $itemname=Another Item Name; $itemqty=9; array_push($cartArray, array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; echo $cartArray[0][0].BRBR; Thank you, Jonathan Duncan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Separating content from style
On 9 Oct 2002 at 17:48, Dave Smith wrote: I agree that it is always good practice to use good design even for small projects, because they almost invariably turn into large projects if you don't. ;) This has been some great info. I appreciate it. Can someone explain what the purpose of a template engine is and possibly draw up a simple diagram of how one might work as it relates to DB-related projects? The answer to this question goes beyond any language. I've done this in Perl and my apps can use either the Great Template::Toolkit or the esteemed HTML::Template. I have a Viewer class which receives the DATA (the DATA) and a request for a template handler (TT or HT in my cases but could be more) and the Viewer than manage the manipulation of the data with how the particular template system uses the data. You can see an example of the above here: http://www.smartarchitectures.com/projects/ The default view uses TT, you can click on Simple and you will get the original HT templates. You can click on ViewSkel so see the template and DATA used to create the view. I did that quite awhile ago. I've done a few apps with Smarty now. I think Smarty is pretty darn good. Got nearly everything I want. Why a templating system? Because I find it much easier to build, to debug and to evolve an application that has a clean structure. Never mind needing to update the whole design. All this talk of skins in most PHP stuff drives me nuts. They are not skins, they have no template system, it's a hodegepodge that will drive any efficient minded person insane :):) ... been doing a lot of work on other systems in PHP to get paid. I've also been writing some fresh apps using Smarty and it's a pleasure. Clients are amazed at how easily I can make changes ONCE (very important) once I've got the layout (the blueprint if you will) of my class structure. I use PEAR as well. The DB is good. Peter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Multi-Dimensional Arrays
Sounds like what your trying to do is: $cartArray[] = array(ItemNumber = $itemnumber, Brand = $brand, Quantity = $itemqty, ItemName = $itemname); This will give you: $cartArray[0][ItemNumber] = $itemnumber; $cartArray[0][Brand] = $brand; $cartArray[0][Quantity] = $itemqty; $cartArray[0][ItemName] = $itemname; Running the very top statement again will give you: $cartArray[1][ItemNumber] = $itemnumber; $cartArray[1][Brand] = $brand; $cartArray[1][Quantity] = $itemqty; $cartArray[1][ItemName] = $itemname; Note that $cartArray[] = $val is just a short hand way of doing array_push($cartArray, $val); Cheers, Owen Prime http://www.noggin.com.au Jonathan Duncan wrote: I am trying to create an array to hold shopping cart information. The array I am using is called cartArray. What I want to do is to define a sub-array of cartArray with the information from one product. Then the next time a product is added it appends then new information as a second sub-array to cartArray and so forth. Following is some code I have been using to test with and so far PHP will let me use .= to append but when I try to call it back with print_r or echo array[][] only the first entry is returned. Any ideas what I am doing wrong? $brand=Brand1; $itemnumber=456789; $itemname=Some Item Name; $itemqty=3; $cartArray[] .= array(0=array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; $brand=Brand2; $itemnumber=123456; $itemname=Another Item Name; $itemqty=9; array_push($cartArray, array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; echo $cartArray[0][0].BRBR; Thank you, Jonathan Duncan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Separating content from style
Here's a question relating to Smarty. I am under the impression that the purpose of a three-teir implementation is to reduce (ideally eliminate) any PHP code from the HTML templates, thus allowing specialization and easier maintainability. However, in some of the examples given in the Smarty Quickstart guide (http://www.phpinsider.com/php/code/Smarty/QUICKSTART), there appears to be much more Smarty 'code' than HTML. Does this not defeat the purpose? Does this not add unnecesary complexity? Weren't we trying to eliminate this by using Smarty? --Dave Peter J. Schoenster wrote: On 9 Oct 2002 at 17:48, Dave Smith wrote: I agree that it is always good practice to use good design even for small projects, because they almost invariably turn into large projects if you don't. ;) This has been some great info. I appreciate it. Can someone explain what the purpose of a template engine is and possibly draw up a simple diagram of how one might work as it relates to DB-related projects? The answer to this question goes beyond any language. I've done this in Perl and my apps can use either the Great Template::Toolkit or the esteemed HTML::Template. I have a Viewer class which receives the DATA (the DATA) and a request for a template handler (TT or HT in my cases but could be more) and the Viewer than manage the manipulation of the data with how the particular template system uses the data. You can see an example of the above here: http://www.smartarchitectures.com/projects/ The default view uses TT, you can click on Simple and you will get the original HT templates. You can click on ViewSkel so see the template and DATA used to create the view. I did that quite awhile ago. I've done a few apps with Smarty now. I think Smarty is pretty darn good. Got nearly everything I want. Why a templating system? Because I find it much easier to build, to debug and to evolve an application that has a clean structure. Never mind needing to update the whole design. All this talk of skins in most PHP stuff drives me nuts. They are not skins, they have no template system, it's a hodegepodge that will drive any efficient minded person insane :):) ... been doing a lot of work on other systems in PHP to get paid. I've also been writing some fresh apps using Smarty and it's a pleasure. Clients are amazed at how easily I can make changes ONCE (very important) once I've got the layout (the blueprint if you will) of my class structure. I use PEAR as well. The DB is good. Peter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL REGEXP functionality... any way to make this easier?
Right now, a sample query I might have would be... SELECT * FROM ospd WHERE word REGEXP '^([a]?[p]?[e]?)$|^[p]?[a]?[e]?$|^[a ]?[e]?[p]?$|^[p]?[e]?[a]?$|^[e]?[p]?[a]?$|^[e]?[a]?[p]?$'; where basically I need to query every combination of a, p and e. This is a pain, but for only three letter is not so bad. As you can see, this could become unruly with larger numbers of letters. Each instance of a letter can only occur once. However, a letter may be duplicated and used once for each instance. Hence the statement steps through... it could also be something like... SELECT * FROM ospd WHERE word REGEXP '^[a]?[a]?[e]?$|^[a]?[e]?[a]?$||^[e]?[a]?[a]?$'; more easily written because one letter is used twice and can occure once for each instance. Please let me know if you have any ideas. Jesse [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php