Re: [PHP-DB] Logicproblem in WHERE statement
=An alternative approach:- I am building a user search engine. Now I do not know how to gett following: a mandatory field and a voluntary field For example I would like to get all female users and those who are from canada. The results should show all users who are female regardless of nationality But it should also show all users from canada. How would this look like? SELECT * FROM table WHERE sex=1 AND country='CA' This is wrong I know. But how does it work??? SELECT * FROM TABLE WHERE sex = 1 OR country = 'CA'; Will select all users who are female as well as all users from Canada. You may get duplicate records (for people who are female and from Canada) so you may want to use DISTINCT as well. =If all you want to do is to 'highlight' people from Canada, whilst having a query that gives a worldwide resultset, try: SELECT *, IF( country = 'CA', 'Canuck', 'Normal' ) AS highlight FROM table WHERE sex=1; =Regards, =dn -- 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] sorting on the first 8 digits....
John, Ok, I did something stupid and now I am paying the price... =boy am I glad that I'm not the only one in the world! How come the 'people' who extract these prices don't accept Mastercard? In an internal database that tracks the time and date something happens on our site, I mistakenly forgot to use leading zeros in the 24 hour column(s). So, anything that happens between 1-9 am are all short by one digit. Now, I need to create a report that shows these transactions in the order that they happened. The answer to this problem should be as simple as adding a zero to the end of all records that are short one digit. But, for reasons that I won't explain here, that isn't possible. So, my question is this, is there a way to do a database call that would select all the records but allow me to order them based on the first 8 digits only? If you would like an example, I need the following two numbers to come up in the order listed. 20011012182929 200411322 =you don't mention the column format, so from the example data I have assumed that it is integer rather than string (or MySQL timestamp). =as you observe, if the values are sequenced according to string rules, it all works for you (left to right, byte-by-byte comparison), accordingly anything you do to cast the values as strings will solve the problem - until you get across to the hours 'columns'. =so using only the first eight character positions of all the records: SELECT * FROM tblNm ORDER BY LEFT( colNm, 8 ) =this will separate the days neatly, but all of the records for a particular day will be in a non-predictable sequence. =you could get really clever and replace the LEFT() with an IF(): if colNm contains 16 digits then use the (string) value, as is; else if colNm contains 15 digits then use a concatenation of the first 8 character-positions, a zero, and the remaining 7 character positions; else (you have more data integrity problems than your credit limit allows) =the effect of this would be to (logically) restore the missing zeros and sequence the records by day, hour, minute, and second. =Of course, it would be better to do that as an UPDATE to correct your data, and then use the 'normal' SQL query, but you did say... =thanks for this morning's brain-teaser to get the old grey cells lined up... =ok? =dn -- 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 administration on Linux through NT
Hi, I have mySQL on LINUX Does anybody knows a windows software to manage mySQL through win2k (TCP/IP - Intranet) ? With mySQL on win2k, you can manage it using a windows interface. I'm looking for the same kind of interface to manage mySQL on a Linux platform from win2k. Thanks. Jerry -- 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] select into array
Hello everyone! I have the following table: |name |-- |n_id |n_name |ns_id --- I do a select: SELECT n_name from name and I want to put all selected n_name values into an array (say it names) How can this be done?? Thanx in advance.
Re: [PHP-DB] select into array
George, Whether you can select into an array directly depends on your database. In any case, PHP executes database queries and returns a handle or container which is accessed as an array. Here's the example from http://www.php.ca/manual/en/function.mysql-fetch-array.php ?php mysql_connect($host, $user, $password); mysql_select_db(database); $result = mysql_query(select user_id, fullname from table); while ($row = mysql_fetch_array($result)) { echo user_id: .$row[user_id].br\n; echo user_id: .$row[0].br\n; echo fullname: .$row[fullname].br\n; echo fullname: .$row[1].br\n; } mysql_free_result($result); ? If you want a tutorial on this, Julie Meloni has some really good examples at http://www.thickbook.com and there are others at DevShed and WebMonkey. Cheers - Miles At 02:42 PM 1/16/2002 +0200, George Lioumis wrote: Hello everyone! I have the following table: |name |-- |n_id |n_name |ns_id --- I do a select: SELECT n_name from name and I want to put all selected n_name values into an array (say it names) How can this be done?? Thanx in advance. -- 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] mySQL administration on Linux through NT
Jerry, For a command line interface, you can use either putty or TerraTermSSH. I prefer the former and it's available at http://www.chiark.greenend.org.uk/~sgtatham/putty/ . The latter is more Windows-ish. For a Windows-like interface, through a browser, there is phpMyAdmin, and others, but I've never used them. Those who have seeem to favour phpMyAdmin. Generally if my query isn't working in a script I need the mysql console to test it. Thus it's either login using putty, if the server's remote, or roll the chair across to the other desk. Hope this helps - Miles Thompson At 11:48 AM 1/16/2002 +, Jerry wrote: Hi, I have mySQL on LINUX Does anybody knows a windows software to manage mySQL through win2k (TCP/IP - Intranet) ? With mySQL on win2k, you can manage it using a windows interface. I'm looking for the same kind of interface to manage mySQL on a Linux platform from win2k. Thanks. Jerry -- 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]
RE: [PHP-DB] mySQL administration on Linux through NT
If you're running a web server on your Linux box then simply download, install and use phpMyAdmin. All your management is then down through web pages. I use it all the time. HP -Original Message- From: Jerry [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 16 January 2002 10:48 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] mySQL administration on Linux through NT Hi, I have mySQL on LINUX Does anybody knows a windows software to manage mySQL through win2k (TCP/IP - Intranet) ? With mySQL on win2k, you can manage it using a windows interface. I'm looking for the same kind of interface to manage mySQL on a Linux platform from win2k. Thanks. Jerry -- 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]
RE: [PHP-DB] How can recommend a book for SQL and DB design
I'm a recent student but I sold back my DB text in hopes I'd never have to know the stuff again (I guess that $20 wasn't worth it). The current book my old prof is using is: Introduction to Database Systems, 7th Edition by C.J. Date. but since I don't know if that's the one I used I don't know if it's any good. I do know that the class covered the normalizations and things like that. It might be a good place to start, but it seems like college textbooks are always at least twice the cost of normal books. I haven't tried the PHP O'Reilly book, so thanks for the warning! -Natalie -Original Message- From: DL Neil [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:34 PM To: Leotta, Natalie (NCI/IMS); 'Andy'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] How can recommend a book for SQL and DB design Andy (and Natalie), In fact the O'Reilly book on PHP is the exception that might well prove the rule - normally I think them v.good The reference work on MySQL is by Paul DuBois (who often stops by here - hi Paul) and published by New Riders. Unfortunately none of my favorite texts (of the moment) go into the background of db theory, eg normalisation. Perhaps one of the (recent) students on the list can help with that one... Regards, =dn - Original Message - From: Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] To: 'Andy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 15 January 2002 22:14 Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design Any O'Reilly book is always a good choice. O'Reilly is the publisher - they do the Nutshell books and a bunch of others. They are also the books with animals on them, if that helps :-) -Natalie -Original Message- From: Andy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation 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 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 can recommend a book for SQL and DB design
finished University nearly two years ago, but back then, this book was the one we used too - very in depth introduction to general database theory, well worth investing in if you need very well designed databases for large volume applications. all the best, Matt -Original Message- From: Leotta, Natalie (NCI/IMS) [mailto:[EMAIL PROTECTED]] Sent: 16 January 2002 14:17 To: 'DL Neil'; 'Andy'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design I'm a recent student but I sold back my DB text in hopes I'd never have to know the stuff again (I guess that $20 wasn't worth it). The current book my old prof is using is: Introduction to Database Systems, 7th Edition by C.J. Date. but since I don't know if that's the one I used I don't know if it's any good. I do know that the class covered the normalizations and things like that. It might be a good place to start, but it seems like college textbooks are always at least twice the cost of normal books. I haven't tried the PHP O'Reilly book, so thanks for the warning! -Natalie -Original Message- From: DL Neil [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:34 PM To: Leotta, Natalie (NCI/IMS); 'Andy'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] How can recommend a book for SQL and DB design Andy (and Natalie), In fact the O'Reilly book on PHP is the exception that might well prove the rule - normally I think them v.good The reference work on MySQL is by Paul DuBois (who often stops by here - hi Paul) and published by New Riders. Unfortunately none of my favorite texts (of the moment) go into the background of db theory, eg normalisation. Perhaps one of the (recent) students on the list can help with that one... Regards, =dn - Original Message - From: Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] To: 'Andy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 15 January 2002 22:14 Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design Any O'Reilly book is always a good choice. O'Reilly is the publisher - they do the Nutshell books and a bunch of others. They are also the books with animals on them, if that helps :-) -Natalie -Original Message- From: Andy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation 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 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]
RE: [PHP-DB] FreeBSD 4.2 and ODBC
Paul, Sure, email away. I'd hazard a guess that your syntax errors were due to not matching the threading of your OS. And I recommend the OpenLink Multi-Tier ODBC drivers, from your architecture needs. They are available for a free download at http://www.openlinksw.com/main/softdld.htm. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Paul G [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 6:08 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] FreeBSD 4.2 and ODBC Thanks Andrew, I will attempt this in the morning. Is it okay with you if I email you on the iODBC stuff? PHP was compiled like so: Configure command: ./configure '--with-apxs=/usr/local/apache/1.3/bin/apxs' '--with-config-file-path=/usr/local/lib' '--with-system-regex' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-ttf' '--with-ftp' '--with-gd=/usr/local' '--enable-memory-limit' '--enable-fast-install' 'with-iodbc=/usr/local/src/odbcsdk' php3.ini file path is set to: /usr/local/lib (iODBC resulted in syntax errors last time I tried. I am new to this I should emphasize!) Also, any ODBC driver you would recommend? -Paul - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Paul G [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 2:37 PM Subject: RE: [PHP-DB] FreeBSD 4.2 and ODBC Paul, You can simply download the binary at www.iodbc.org and configure --with-iodbc as per the HOWTO. If you tried this and then got undefined function then this means you didn't use the correct php binary or somesuch. Ensure that ODBC support is compiled in by examining the output of a phpinfo(); You will still need an ODBC driver, as iODBC is simple the Driver Manager (enabling use of a driver). To enable BSD to access an Excel spreadsheet will require the following configuration. BSD Client PHP --with-iodbc (using iODBC SDK, use non-threaded option if you get pthread errors) Client-side ODBC - OpenLink MT Client DSN (in odbc.ini) configured with: Host = windows box below ServerType = odbc Database = server-side DSN below (foo) Environment variables in your PHP script: putenv(ODBCINI=path/to/odbc.ini); putenv(LD_LIBRARY_PATH=path/to/odbcsdk/lib); (ODBCINSTINI is optional) Windows Server -- -- --- Server-side ODBC: OpenLink MT ODBC Agent (choose Access in the selection dropdowns) foo - DSN configured with the Microsoft driver for Excel that can open the spreadsheet All components are available as free downloads from OpenLink's website. Free support is available at http://www.openlinksw.com/support/suppindx.htm Hope this helps! Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Paul G [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] FreeBSD 4.2 and ODBC Hi All, I'm just new to this list and I'm hoping somebody might have information leading to a PHP that can access an MS Excel Spreadsheet. FreeBSD 4.2, PHP 3.0.18 (for gif GD), Apache1.3.12. I have had no luck getting any of the ODBC functions to work with this OS (odbc_connect, php compiled with and without --with-iodbc switch results in Fatal error: Call to unsupported or undefined function odbc_connect() ). I also had no luck compiling iODBC, which resulted in syntax errors and ultimately stoppage. Wondering if anybody has a gem out there. |:) Ever pull something like this off? Got any ideas? Thanks Alot! -Paul -- 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 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 can recommend a book for SQL and DB design
Matt, The forthcoming Wrox book Professional PHP4 covers database normalization, database design, etc., as well as specific PHP, and designs a sample application so you can put it into practice. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: matt stewart [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 9:42 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design finished University nearly two years ago, but back then, this book was the one we used too - very in depth introduction to general database theory, well worth investing in if you need very well designed databases for large volume applications. all the best, Matt -Original Message- From: Leotta, Natalie (NCI/IMS) [mailto:[EMAIL PROTECTED]] Sent: 16 January 2002 14:17 To: 'DL Neil'; 'Andy'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design I'm a recent student but I sold back my DB text in hopes I'd never have to know the stuff again (I guess that $20 wasn't worth it). The current book my old prof is using is: Introduction to Database Systems, 7th Edition by C.J. Date. but since I don't know if that's the one I used I don't know if it's any good. I do know that the class covered the normalizations and things like that. It might be a good place to start, but it seems like college textbooks are always at least twice the cost of normal books. I haven't tried the PHP O'Reilly book, so thanks for the warning! -Natalie -Original Message- From: DL Neil [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:34 PM To: Leotta, Natalie (NCI/IMS); 'Andy'; [EMAIL PROTECTED] Subject:Re: [PHP-DB] How can recommend a book for SQL and DB design Andy (and Natalie), In fact the O'Reilly book on PHP is the exception that might well prove the rule - normally I think them v.good The reference work on MySQL is by Paul DuBois (who often stops by here - hi Paul) and published by New Riders. Unfortunately none of my favorite texts (of the moment) go into the background of db theory, eg normalisation. Perhaps one of the (recent) students on the list can help with that one... Regards, =dn - Original Message - From: Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] To: 'Andy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 15 January 2002 22:14 Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design Any O'Reilly book is always a good choice. O'Reilly is the publisher - they do the Nutshell books and a bunch of others. They are also the books with animals on them, if that helps :-) -Natalie -Original Message- From: Andy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation 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 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 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] Authentication
I have a successful website with authenticatin and logons. There are sections that I allow anyone to get to, but the others have to be authenticated. This site is not using frames at all. its a page by page, with the unit that does the authentication and sessions being included in each page. I've taken these same units to another site. I altered the pieces neccesary to hit the new sites database and users. This site is using frames. the outer frames are not using the authentication or sessions. However, internal pages do. As I enter a section that needs a logon, it prompts me. Then it goes to the correct page. But the next page it goes too, it wants to get a logon again. These pages are in a row, and they all use the same sessions stuff that the other site uses. I know that they all have to include the same units, so once it needs to logon, it'll prompt that, but it should pass this session info from here to there, and not have to logon again. Its driving me nuts. The only thing I can think of thats different is the frames. I even took the same code from the other site ( the one that does work without frames), and plugged it in. So the session logon was for the other site and other db. It'd prompt me each time too. I am not sure what to do now... help please. When I first set up PHP my sessions did not work. What I eventually found was something to do with my php.ini file on how it deals with sessions (ie. where they save them, etc) This is some stuff from my php.ini file which i found useful (and made it work, I think) register_globals = true session.save_path = /tmp session.use_trans_sid = 1 session.auto_start = 1 Some of it might not be the solution but I think the session.save_path directive is what makes it work. For better definition of what these things do, look in the php manual (Chapter 3. Configuration). Hope this helps, Adam. -- 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: [PHP] mysql_insert_id?
Dl Neil wrote: 2 because the (function argument) controlling feature is the connection, it is not possible for another concurrent user to 'steal' your ID or influence the ID returned to you - it's all yours! Ok, assume you are correct, but what if you are using persistent connections (ie pconnet)? -- 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] Re: Moving from MySQL to MSSQL Server 2000
There are few things you should consider; perhaps you already have. You may not be replacing the OS of your Web server but you will be adding a new OS for the database since MS SQL only runs on Windows. So now your site will have a Solaris / Apache piece and Windows cluster running MS SQL. I have run configurations like this and they do work however if your fundamental goal is better reliability I suggest to be careful about MS SQL. My experience (not wanting to start any flame wars here) has been that MS SQL is not as reliable as some of the bigger names such as Informix / IBM and Oracle. All of those also run on Solaris which means you could still only have one OS. That may or may not be an advantage to you. The other issue to be very careful about regarding MS SQL is it is not supported on Solaris. So if you have an issue where the database appears to be functioning normally yet your Apache Web server cannot retrieve data from the DB Microsoft will have nothing to do with helping you fix this. It is an unsupported configuration; the connectivity products you will use, whatever they are, will not come from Microsoft nor will any help. But to answer your specific questions: ODBC, JDBC are not the only ways to move data from the database to Apache but they are the most popular ways because they're easy to use and they do work very well. Also check out freeTDS (tabular data stream) and a product called OpenLink, there are others try Web search from your favorite search engine. A few months ago we did a benchmark and we found JDBC to be faster than the Microsoft client or ODBC. In our case we believe this was because of the way that JDBC returned results in larger chunks which matched our needs for that App. Your mileage may vary; these things depend on your application and a particular versions of the software and combinations of the software using. Nothing beats having the time to try a couple different combinations and see which works best for your situation. I don't think there any particularly special points you need to consider because you're using MS SQL but as I've said each application can be different and have its own unique needs. Good Luck, Frank Well, My Site runs now on Solaris. Both the front end (Web Server / php code / Apache) and the Database (Backend server). We had some problems with Mysql and we don't find it 100% reliable for such a busy site. We also want to use a db cluster for high availability (we are talking about $200,000 of hardware and software for the change). The code will still run on Apache / PHP / Solaris so there is no change in that. Only the access to the Database will change. Does this help? berber -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 12, 2002 10:28 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Moving from MySQL to MSSQL Server 2000 Hello, Boaz Yahav wrote: Hi I'm planning to move my site (Very successful / high traffic Auctions site) from MySQL to MSSQL Server 2000. I was wondering if anyone has done this move and if there are any pit falls to notice. 1. Is ODBC the only way to work from a Solaris / Apache / PHP 4 machine to a Win2K / SQL Server 2000? 2. What could be the performance cost (if any). 3. Are there any special points that need to be taken into consideration on either side? If you have these doubts I wonder if you are really sure if moving from OS and databases is the right thing to do. Maybe if you tell what is you motivation for the move we can address your real problems more objectively. Changing OS, Web Server and database server all at the same time sounds like an operation of great risk. If your motivation really justifies all the changes, maybe changing one thing at a time would be of less risk. Don't forget the Hotmail platform change fiasco. Regards, Manuel Lemos -- 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] MSSQL - PHP4 on Win 2K - will not run a query.
Hello all, I'm having a problem getting PHP to run a query against a MSSQL 7 database. I have installed PHP, the MSSQL client tools and the php_mssql.dll all according to the documentation. PHP will connect to the database just fine. But if I send the query to execute it will never return, no error, no results; the browser will eventually time out. The query will run from fine from the client tools on the server. Here is the simple code on trying to get to run: ? /*All variables have been set already*/ echo h3Begin/h3; $linkID = mssql_connect($hostname,$username,$password) or DIE(DATABASE FAILED TO RESPOND.); echo h3Connected/h3; mssql_select_db($dbName) or DIE(Table unavailable); echo h3DB Set/h3; flush(); sleep(20); /* Sleep for debug - to allow me to see php loggin in db */ die(); / I can get to here - no problems - sp_who inside the MSSQL db shows I'm connected successfully and am using the DB I've requested. If I remove the above 'die' or move it to just after the mssql_query statement below this page will never return. / $query = SELECT getdate(); $result = mssql_query($query, $linkID); echo h3Query Submitted/h3; /* code to retrieve and display results goes here */ ? So can anyone give me some hints? Is there a special place to look for error messages? The database server doesn't think any error or query has happened and apparently the Web server is waiting for the database server to reply. Thanks in advance, Frank[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] Count
How do you add a count feature to a link. I can get stuff from the db but want to know how many times it's been read or click on?
Re: [PHP-DB] Re: [PHP] mysql_insert_id?
Hi Martin, 2 because the (function argument) controlling feature is the connection, it is not possible for another concurrent user to 'steal' your ID or influence the ID returned to you - it's all yours! Ok, assume you are correct, but what if you are using persistent connections (ie pconnet)? =According to the manual (Chapter 22. Persistent Database Connections) there is no difference in functionality between persistent and non-persistent connections (only a (possible) difference in efficiency/response time). Thus use of persistence does not buy you into other issues. =If I leave it there, you're going to come back with another question, aren't you!? =This is my understanding. A connection is set up to enable communication between the PHP script and the RDBMS. The connection is exclusive to the script and only lasts the life of the script. Now let's look at the word script. Each user/browser is processed within the (Apache) web server as a separate child process. If the process calls for PHP processing, then what happens in one process within the web server is kept quite separate from what's happening in another process. This applies even if they both use PHP, and even if they are both running the same PHP script, and even against the same MySQL db/tbl, ie because of the way Apache works, there is no 'sharing' of connections/cleverness in a bid for extra 'efficiency'. =Thus there is no way for my (connection) use of the db to interfere with your (separate connection) use of the same, in terms of AUTO_INCREMENT, INSERT IDs, and suchlike. =I'd really like to hear from someone who can talk more authoritatively on the subject though! =Regards, =dn -- 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: [PHP] mysql_insert_id?
Hi Jimmy, 2 because the (function argument) controlling feature is the connection, it is not possible for another concurrent user to 'steal' your ID or influence the ID returned to you - it's all Ok, assume you are correct, but what if you are using persistent connections (ie pconnet)? don't worry, persistent connection is per-child-process basis, so concurrent users will use different connection to DB. the only problem i can think of might occur with pconnect is, last_insert_id() will return you the last inserted ID from previous 'session', not current 'session'. to prevent this, you should call last_insert_id() only when your INSERT query executed succesfully. =Of course a right-living boy like me, cannot conceive of why one would look up LAST_INSERT other than immediately after the INSERT/UPDATE command... =However this is an interesting thought and you are right. There are differences between the MySQL LAST_INSERT_ID and the PHP MySQL_ =The MySQL manual (6.3.6.2 Miscellaneous Functions) talks about Returns the last automatically generated value that was inserted into an AUTO_INCREMENT column...The last ID that was generated is maintained in the server on a per-connection basis., and a number of other if-s, but-s, and maybe-s that will get everyone going. =(However I believe it also answer's Martin's question!) =What I have noted is that the PHP manual (http://www.php.net/manual/en/function.mysql-insert-id.php) works slightly differently (and possibly more simply), as well as emphasising the immediately after relationship between this call and the preceding INSERT. An interesting point here and that is that it takes care of Jimmy's concern: what happens if the INSERT query was successful. =I think I prefer the PHP approach - and it is probably more efficient/quicker (from PHP) too. =Further thoughts? =dn -- 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: [PHP] mysql_insert_id?
Hi Jimmy, the only problem i can think of might occur with pconnect is, last_insert_id() will return you the last inserted ID from previous 'session', not current 'session'. to prevent this, you should call last_insert_id() only when your INSERT query executed succesfully. =Of course a right-living boy like me, cannot conceive of why one would look up LAST_INSERT other than immediately after the INSERT/UPDATE command... calling last_insert_id() after INSERT is the number one rule of course :) What i mean was, what if the INSERT query fail, but the script still execute the last_insert_id() function? Most probably the returned value would be wrong, because it will return the last_insert_id of previous INSERT query (from previous 'session') =right living was a (poor) joke following your previous post's .SIG file aphorism...not a criticism. Now that you have mentioned the possibility, I can imagine the odd (very odd) use for collecting an ID from a preceding interraction (with the database). =session is not the correct word/its use is potentially confusing (perhaps that's why it's in quotes?) - persistence refers to the continuing connection between PHP and MySQL. =What I have noted is that the PHP manual (http://www.php.net/manual/en/function.mysql-insert-id.php) works slightly differently (and possibly more simply), as well as emphasising the immediately after relationship between this call and the preceding INSERT. I might be wrong, but i think PHP's mysql_insert_id() must be using MySQL's API function call. Meaning, it will return whatever value MySQL return. Or in other word, mysql_insert_id() and last_insert_id() will return the same result. I have look thru the manual link above, and i think the phrase immediately after in the manual is more to advise the user to do mysql_insert_id() immediately after the INSERT query, because last_insert_id value might get overwritten by the newest one. the immediately after phares in the manual doesn't mean that PHP's mysql_insert_id() function is somehow tied to the previous/last INSERT query, so that if the INSERT fails then mysql_insert_id() will intelegently return the correct value. just my 1 cent =Agreed it would seem perfectly logical that the PHP function simply calls the MySQL source function. However it is also possible that in order to save time the LAST_ID information is built into the resultset coming back from the INSERT - thus when mysql_insert_id() is called PHP would not need to go back to MySQL/last_insert_id(). On the other hand, the apparent differences between the two manuals may simply be in the expression of two authors... I don't know [but would welcome competent advice!] =the immediate advice is transparently logical best practice. =I'm not sure that I've understood your last point. The comparison/difference, as I read/understood it, is that if the INSERT works then both functions will operate correctly. However if the INSERT fails, then MySQL's last_insert_id() will return the ID of the last record successfully inserted during the connection (whenever that was) - without necessarily any recognition of an immediately preceding failure. Whereas PHP's mysql_insert_id() is keyed to the resource identifier and returns zero if the **latest** INSERT failed for some reason (and the rationale for my earlier comments/comparison). =My thinking is that the PHP rationale makes the most/safest sense to me, and if I'm 'in' PHP it seems best to stick with that 'mode' than to go 'out' to MySQL to find the 'same' answer. =Intriguing stuff, =dn -- 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] Count
Afterthought -- you could make this self-maintaining by doing a select for $PHP_SELF and inserting the record if mysql_num_rows() returned 0. Downside is that it would add greatly to the overhead. Miles At 04:42 PM 1/16/2002 -0400, Miles Thompson wrote: Barry, Before leaping to the wrong conclusion, what exactly do you want to count? You can derive the number of times a page has been fetched from your web logs. Alternately, you could add a table to your database, and at the top of the page the link points to, after you've established your database connection, etc.: $sql_count = update page_count set views = views + 1 where page = '$PHP_SELF' ; mysql_query( $sql_count ); You'll have to add a record for each page to the database, and by now you know how to create tables etc. Justwatch out for reserved words and function names; when I first typed the query I used count in place of page_count. Views and page probably aren't such a hot choices either. Fetching the counts for the pages involves nothing more than issuing select * from page_count and you'll have a per page count of all the clicks to each page. Miles At 08:07 AM 1/17/2002 +1300, Barry Rumsey wrote: How do you add a count feature to a link. I can get stuff from the db but want to know how many times it's been read or click on? -- 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] Unique Results?
Hi there everyone, (Sorry if you got this twice, I don't think my mail server posted it earlier). I use the following code to populate a dropdown box from a MySQL database: $db = mysql_connect(localhost,^^^,^^^); mysql_select_db(mydb,$db); $result = mysql_query(select country from search); if ($result) { echo SELECT NAME='country'; while ($myrow = mysql_fetch_array($result)) { echo OPTION VALUE=\.$myrow[country].\. $myrow[country]. /OPTION ; } echo /SELECT; } However, this database has multiple country names the same (Aswell as unique ones) how can I display just ONE of each entry? IE: say there are 5 africa, 3 britain etc . I only want the list to show 1 of each and not 5 and 3 and so on - how is this possible? Please help :-) And thank you to everyone who helped me with an earlier enquiry, it's very appreciated :-) Chris Payne www.planetoxygene.com
Re: [PHP-DB] Unique Results?
$result = mysql_query(select distinct country from search); Janet - Original Message - From: Chris Payne [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 1:29 PM Subject: [PHP-DB] Unique Results? Hi there everyone, (Sorry if you got this twice, I don't think my mail server posted it earlier). I use the following code to populate a dropdown box from a MySQL database: $db = mysql_connect(localhost,^^^,^^^); mysql_select_db(mydb,$db); $result = mysql_query(select country from search); if ($result) { echo SELECT NAME='country'; while ($myrow = mysql_fetch_array($result)) { echo OPTION VALUE=\.$myrow[country].\. $myrow[country]. /OPTION ; } echo /SELECT; } However, this database has multiple country names the same (Aswell as unique ones) how can I display just ONE of each entry? IE: say there are 5 africa, 3 britain etc . I only want the list to show 1 of each and not 5 and 3 and so on - how is this possible? Please help :-) And thank you to everyone who helped me with an earlier enquiry, it's very appreciated :-) Chris Payne www.planetoxygene.com -- 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: Logicproblem in WHERE statement
Andy == relevance ?? ... or define a calculated field for these relevance... and order the results by this value... SELECT (sex = 1 AND country = 'CA') AS relevance, sex, country FROM table WHERE sex = 1 ORDER BY 1 DESC ... note the relevance includes all the fields... and the where just the mandatory conditions... the order must be DESC, because the relevance is 1 if the two conditions are match... and 0 if not you can define a more sophisticated relevance function... for example, if you want to search three different terms... example terms... sex = 1 age = 30 country = 'CA' [in MySQL]... you can define relevace as... (sex = 1) + (age = 30) + (country = 'CA') relevance will be... 3if the three conditions are match 2if just two conditions are match 1if just one condition is match 0if non is match if you are trying to define an any word query... you can show just the rows (where relevance 0)... if you are trying to define an all words query... you can show the rows where relevance == 3... or re-define the query and include all the columns in the where clause !! 8-) jaime -- 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] Logicproblem in WHERE statement
Jason SELECT * FROM TABLE WHERE sex = 1 OR country = 'CA'; Will select all users who are female as well as all users from Canada. You may get duplicate records (for people who are female and from Canada) so you may want to use DISTINCT as well. ok... you are right... but this error (duplicated rows) just can be possible if you are selecting several tables, the data rows are not unique, or you are making some kind of join 8-) jaime -- 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: [PHP] mysql_insert_id?
Jimmy, However it is also possible that in order to save time the LAST_ID information is built into the resultset coming back from the INSERT - thus when mysql_insert_id() is called PHP would not need to go back to MySQL/last_insert_id(). yes, what you said could be true also. Well, there's only one way to be sure how mysql_insert_id() works...read the source code of PHP :) but unfortunately I dont have the source code, and even if I do, I won't read it, because I am lousy at reading someone's code...:) =or run a script to perform an INSERT, then pause, eg go to a form, and whilst nothing's happening take the MySQL server offline, then restart the script by returning from the form, and execute the call... =I can't do this because my portable runs everything on one box (dev and prod and...). nice discussion, Neil :) =thinking that stretches the mind! =dn -- 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] Combining INSERT...SELECT and INSERT INTO
if you are using mysql then no i don't think you can do that, since it doesn't support nested queries - postgres or some other db may well support it tho but like miles said - give it a go :) (maybe on a test database/table just in case) hth -b // -Original Message- // From: Markus Lervik [mailto:[EMAIL PROTECTED]] // Sent: Monday, 14 January 2002 6:54 PM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Combining INSERT...SELECT and INSERT INTO // // // Hello! // // It's me again, with the magazine database : ) // // Is there any way to combine INSERT...SELECT and INSERT INTO so // one could insert a new row with a few values inserted by // hand and others // from another table? something like // // INSERT INTO mag_table (mag_id,issn,year,info,volume,numbers,remarks) // VALUES ( (SELECT id FROM mag_names WHERE mag_names.name=Asdf), // 1234-5678,2001,foobar,1-4,1-52,foobar); // // I'm trying to construct myself a nice clever INSERT statement to my // web-frontend. Haven't got it to work, though. Is this even possible? // The other option would be to use three(?) mysql_query calls // from my PHP-code, // but I'd like to keep it as simple as possible. // // Cheers, // Markus // // -- // Markus Lervik // Linux-administrator with a kungfoo grip // Vaasa City Library - Regional Library // [EMAIL PROTECTED] // +358-6-325 3589 / +358-40-832 6709 // // -- // 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]
RE: [PHP-DB] What is REG_BADRPT, and why do I get it?
on a guess - echo the value of $search_name in between each call to see what happens to it as it goes through - you may find that something is going haywire in there somewhere (or that it's blank) -b // -Original Message- // From: Markus Lervik [mailto:[EMAIL PROTECTED]] // Sent: Monday, 14 January 2002 9:42 PM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] What is REG_BADRPT, and why do I get it? // // // // Hello! // // I have quite a weird problem. When I use ereg or ereg_replace // I get a REG_BADRPT warning, like so : // // Warning: REG_BADRPT in /var/www/html/mag/search.php on line 35 // Warning: REG_BADRPT in /var/www/html/mag/search.php on line 36 // // The offending lines are // // if(ereg(*,$search_name)) { ereg_replace(*,%,$search_name); } // if(ereg(?,$search_name)) { ereg_replace(?,_,$search_name); } // // but just two lines above them I have // // if(ereg(*,$search_id)) { ereg_replace(*,%,$search_id); } // if(ereg(?,$search_id)) { ereg_replace(?,_,$search_id); } // // and two similar lines of code below them, yet PHP doesn't complain // about them. Anyone have any ideas as to what's causing the warning? // // // Cheers, // Markus // // -- // Markus Lervik // Linux-administrator with a kungfoo grip // Vaasa City Library - Regional Library // [EMAIL PROTECTED] // +358-6-325 3589 / +358-40-832 6709 // // -- // 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] PHP-informix-Apache undefined symbol
Hi , I compile PHP --with-informix=yes and everithing went ok , until I restarted apache I got the following error. Cannot Load /etc/httpd/modules/libphp4.so into server /opt/informix/lib/esql/libifgen.so undifines symbol: stat Please Help ! What I'm I doing wrong? Many Thanks in advance -- 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] Problem with mail function
also - rather than change the ini file, you can just put ?php set_time_limit(43200); ? which gives the script 12 hours to run (or however you think you need) i have a simple script for mailing out bulk mail done in php - it has successfully worked on 700 emails so far - so it works :) -b // -Original Message- // From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] // Sent: Tuesday, 15 January 2002 1:52 AM // To: Faye Keesic // Cc: [EMAIL PROTECTED] // Subject: Re: [PHP-DB] Problem with mail function // // // Is it the ole 30-second timeout thang? Changeable in php.ini? // // On Mon, 14 Jan 2002, Faye Keesic wrote: // // Hi there... // // I have a problem mailing out approx. 180 emails (no // attachments) using the // mail() php function. I loop through the email table once, // sending the email // to everyone in the list. // // The problem is that my page seems to time out when I send // the emails, and it // refreshes itself. So if I don't manually stop the browser // after say, 10 // seconds, the recipients in the email table get the email // more than one time. // // Maybe I shouldn't be trying to send that many emails at a // time. I am on // apache using mysql and php... // -- // Faye Keesic // Computer Programmer Analyst/Web Page Design // // // -- // 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 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] A weird images database/web page problem
Let's tackle the first one first - On Tuesday 15 January 2002 10:20 pm, Steven Cayford banged out on the keys: On 2002.01.15 23:30:25 -0600 chip wrote: won't work) ? $new_pic=$pic+12; Is $pic already set by the HTTP_GET_VARS here? I don't know. How do I set this? I was reading the online manual about http_get_vars and it didn't help, and doesn't have any examples. -- Chip $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $sql=select * from ab limit $new_pic,12; Assuming that $pic is 0, then $new_pic is 12, so you're selecting with LIMIT 12, 12. You probably want to use $pic here, right? $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\../thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } Note that if the select statement gives you other than 6 or 12 images (which it probably will on the last page), that /tr will never get echoed. } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; ? To find out if $new_pic pointed to a valid image you would probably need to do a select count(*) from ab to get the total number of records. If $new_pic is less than the count, then show the link. -- Chip W www.wiegand.org Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. -- 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] -- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. -- 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] Optimizing mail()
hey olinux - i did something like this with a mailing list thing i have for a website (insertfashionhere.com - about to be relaunched) and all i did was ordered the emails to be sent by their server - as you have said. mine were in a database, so in my select i did something liek SELECT email, name, SUBSTRING_INDEX(email, '@', 1) as domain FROM mailing ORDER BY domain or something, which would return something like +-+---++ | email | name | domain | +-+---++ | [EMAIL PROTECTED] | beau | @curtin.edu.au | | [EMAIL PROTECTED] | jim | @curtin.edu.au | | [EMAIL PROTECTED] | john | @curtin.edu.au | | [EMAIL PROTECTED] | kiko | @yahoo.com | +-+---++ and it seemed to mail faster than if it was in random order. hope that helps -b // -Original Message- // From: olinux [mailto:[EMAIL PROTECTED]] // Sent: Tuesday, 15 January 2002 10:57 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Optimizing mail() // // // Just came across this post and wondered if anyone has // done this - if so can you share some code? // // The idea is to order emails by the mailservers // // Would you just order the emails by domain name? [that // would group all aol.com, msn.com, yahoo.com emails] // // http://www.faqts.com/knowledge_base/view.phtml/aid/300/fid/21 // // Thanks, // olinux // // __ // Do You Yahoo!? // Send FREE video emails in Yahoo! Mail! // http://promo.yahoo.com/videomail/ // // -- // 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] Searching a variable
Hi there everyone, Thanks for all the help recently everyone, it's very appreciated. I just have one last question if that's ok :-) I have a string taken from a form, now this string could contain 1 word or it would contain 10, what I need to know is how do I search a DB for each word in the string? I have a simple search engine which works great for works next to each other in the DB but I need it to search each entry for ALL words entered, whether they are next to each other in the DB or 3 words apart, how can I do this? Thanks for all your help. Regards Chris Payne www.planetoxygene.com
RE: [PHP-DB] Searching a variable
i don't doubt that there are probably better ways of going about this chris, but you can do something like; ?php $words = explode( , $searchText); $query = SELECT * FROM table WHERE ; foreach ($words as $word) { $query .= field LIKE '%word%' AND ; } $query .= field!='' ORDER BY something; $results = mysql_query($query); ? as for ranking the results - i have heard people mentioning the fulltext index in mysql, and there's some cool calculations floating around in the archives somewhere, but they escape me at the moment and i haven't got around to implementing a decent search engine yet :) // -Original Message- // From: Chris Payne [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 17 January 2002 10:34 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Searching a variable // // // Hi there everyone, // // Thanks for all the help recently everyone, it's very // appreciated. I just have one last question if that's ok :-) // // I have a string taken from a form, now this string could // contain 1 word or it would contain 10, what I need to know // is how do I search a DB for each word in the string? I have // a simple search engine which works great for works next to // each other in the DB but I need it to search each entry for // ALL words entered, whether they are next to each other in // the DB or 3 words apart, how can I do this? // // Thanks for all your help. // // Regards // // Chris Payne // www.planetoxygene.com // -- 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] Re: Redirecting to a new page
And while 'gurix' is correct, the function you're probably looking for is 'header()', as in header(Location: admin.php); Cheers Pete Php wrote: hea a better way is to include your admin pages. if ($myrow[Admin] == Y){ include(admin.php); }else{ include(user.php) ; } so you can also include at the top of this example a general header with menu's etc. gurix Matt Stewart [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... yeah, i know this, but i'm just trying to get this to work before i add some security in there - passing sessions through etc to ensure they're logged in as admin etc. it doesn't really have to be that secure for what i want anyway, but probably a good job you pointed that out ;) -Original Message- From: Fred [mailto:[EMAIL PROTECTED]] Sent: 04 January 2002 21:18 To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Redirecting to a new page Please note, that this is a very insecure way of determining which page a person gets to view. All they would have to do is enter the admin.php url in the browser and they get admin access even if they are not admins. Fred Matt Stewart [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Can't find the right instructions on php.net, basically, i want a page where someone logs in, and then according to the database entry for them, either they are an admin user or a normal user, and it should then send them to a page depending on which they are. I've accessed the db ok, and checked which they are, then i've used if ($myrow[Admin] == Y){ print Location:admin.php; }else{ print Location:user.php; ) this doesn't sem to work - just gives a blank screen with the standard html headers and footers, rather than the desired location page. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.312 / Virus Database: 173 - Release Date: 31/12/01 -- 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.312 / Virus Database: 173 - Release Date: 31/12/01 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.312 / Virus Database: 173 - Release Date: 31/12/01 -- 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] Logicproblem in WHERE statement
On Thursday 17 January 2002 06:27, Jaime A. Chavarriaga L. wrote: Jason SELECT * FROM TABLE WHERE sex = 1 OR country = 'CA'; Will select all users who are female as well as all users from Canada. You may get duplicate records (for people who are female and from Canada) so you may want to use DISTINCT as well. ok... you are right... but this error (duplicated rows) just can be possible if you are selecting several tables, the data rows are not unique, or you are making some kind of join Ah yes, I forgot we're only using a single table here sheepish grin -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* The heart has its reasons which reason knows nothing of. -- Blaise Pascal */ -- 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] PHP-informix-Apache undefined symbol
Fernando, First of all, where is libphp4.so located? You may have to copy it into that directory. On my system it's in /path/to/apache/libexec. Try that and see if apache will start. If the libphp4.so error is gone, but the other remains, try this. In your /etc directory is a file named ld.so.conf, which contains the paths to the locations of various dynamic shared objects(DSOs). For example mine contains /usr/lib /use/i486-linux-libc5/lib /usr/X11R6/lib -- down to here all this stuff was installed when Linux was installed /usr/local/pgsql/lib /drv2/bin/mysql/lib/mysql The last two I added after installing PostgreSQL and MySQL. So if I cd to /drv2/bin/mysql/lib/mysql and execute ls, I'll see a number of files, each with an .so extension, or .so as part of the file name. Some are symlinks. Add the location of the DSO for informix to this file, then run the command ldconfig. You should then be able to start Apache and everything should work OK. One more thing, did you follow the INSTALL instructions on copying and renaming php.ini-dist? If not, do so and restart Apache. Hope this helps. There is also a PHP-INSTALL list where you will be better off if the above doesn't bring results. Regards - Miles Thompson At 01:14 AM 1/16/2002 -0300, Fernando Carter wrote: Hi , I compile PHP --with-informix=yes and everithing went ok , until I restarted apache I got the following error. Cannot Load /etc/httpd/modules/libphp4.so into server /opt/informix/lib/esql/libifgen.so undifines symbol: stat Please Help ! What I'm I doing wrong? Many Thanks in advance -- 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]
Re: [PHP-DB] A weird images database/web page problem
On 2002.01.16 19:59:37 -0600 chip wrote: Let's tackle the first one first - OK. On Tuesday 15 January 2002 10:20 pm, Steven Cayford banged out on the keys: On 2002.01.15 23:30:25 -0600 chip wrote: won't work) ? $new_pic=$pic+12; Is $pic already set by the HTTP_GET_VARS here? I don't know. How do I set this? I was reading the online manual about http_get_vars and it didn't help, and doesn't have any examples. I was assuming that the $pic variable was set by the HTTP get request since your link below is in the form: a href=\index.php?pic=$new_pic\. When the target script starts after being called like that the value in the global variable $HTTP_GET_VARS['pic'] will hold whatever $new_pic was set to in the reference. Assuming you have register_globals on, then the global variable $pic will also be set to the same value. Otherwise $pic will be uninitialized and should evaluate to 0. -- Chip $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $sql=select * from ab limit $new_pic,12; Assuming that $pic is 0, then $new_pic is 12, so you're selecting with LIMIT 12, 12. You probably want to use $pic here, right? $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\../thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } Note that if the select statement gives you other than 6 or 12 images (which it probably will on the last page), that /tr will never get echoed. } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; ? To find out if $new_pic pointed to a valid image you would probably need to do a select count(*) from ab to get the total number of records. If $new_pic is less than the count, then show the link. -- Chip W www.wiegand.org Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. -- 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] -- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. -- 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: Session and authentication questions in frames
I realized that I was not doing a page_close(); In the other site, there is a footer that all pages use, that automatically does this for me. I just forgot it. It had nothing to do with frames. Just a dumb thing that I forgot. Tjaybelt [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a successful website with authenticatin and logons. There are sections that I allow anyone to get to, but the others have to be authenticated. This site is not using frames at all. its a page by page, with the unit that does the authentication and sessions being included in each page. I've taken these same units to another site. I altered the pieces neccesary to hit the new sites database and users. This site is using frames. the outer frames are not using the authentication or sessions. However, internal pages do. As I enter a section that needs a logon, it prompts me. Then it goes to the correct page. But the next page it goes too, it wants to get a logon again. These pages are in a row, and they all use the same sessions stuff that the other site uses. I know that they all have to include the same units, so once it needs to logon, it'll prompt that, but it should pass this session info from here to there, and not have to logon again. Its driving me nuts. The only thing I can think of thats different is the frames. I even took the same code from the other site ( the one that does work without frames), and plugged it in. So the session logon was for the other site and other db. It'd prompt me each time too. I am not sure what to do now... help please. -- 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] A weird images database/web page problem
On Wednesday 16 January 2002 08:57 pm, Steven Cayford banged out on the keys: On 2002.01.16 19:59:37 -0600 chip wrote: Let's tackle the first one first - OK. On Tuesday 15 January 2002 10:20 pm, Steven Cayford banged out on the keys: On 2002.01.15 23:30:25 -0600 chip wrote: won't work) $new_pic=$pic+12; Is $pic already set by the HTTP_GET_VARS here? I don't know. How do I set this? I was reading the online manual about http_get_vars and it didn't help, and doesn't have any examples. I was assuming that the $pic variable was set by the HTTP get request since your link below is in the form: a href=\index.php?pic=$new_pic\. When the target script starts after being called like that the value in the global variable $HTTP_GET_VARS['pic'] will hold whatever $new_pic was set to in the reference. Assuming you have register_globals on, Yes it is on. then the global variable $pic will also be set to the same value. Makes sense Otherwise $pic will be uninitialized and should evaluate to 0. So, I guess I have to set the variable to 0 first when the first page is loaded, then add 24 (or 12 or whatever) to for the link to the next page. So, with that in mind I added this $pic=0; before $new_pic=$pic+12; but that just caused it to reload the same images each time next was pushed. So, now that I appear to be a total dummy, and the manual doesn't provide any examples, and the two books I have don't seem to be able to help also, would you mind helping me a bit more? I'm I going about this next page stuff all wrong, is there a better way to do it? -- Chip (nothing new below here, just history) $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $sql=select * from ab limit $new_pic,12; Assuming that $pic is 0, then $new_pic is 12, so you're selecting with LIMIT 12, 12. You probably want to use $pic here, right? $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\../thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } Note that if the select statement gives you other than 6 or 12 images (which it probably will on the last page), that /tr will never get echoed. } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; ? To find out if $new_pic pointed to a valid image you would probably need to do a select count(*) from ab to get the total number of records. If $new_pic is less than the count, then show the link. -- Chip W -- 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] phplib authentication questions
I use phplib's session management and authentication. Adding my own info into it where necessary. So, it does ask to login when appropriate. However, every once in a while, I get errors in insert. Its an error in the table with a duplicate entry. Its trying to insert a record that is already there with a primary key. I could remove the key, but i think that it should stay there as is, and I should figure out why, from page to page, I will get the same data trying to be inserted. I am wondering if anyone else is having these issues with the session stuff. thanks. -- 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]