Re: [PHP-DB] Unsubscribe me please
Unsubscribe me too leckyt...@gmail.com On 19 September 2012 23:43, Graham H. mene...@gmail.com wrote: Hi, I tried unsubscribing from the list, but I was unsuccessful, I believe because when I subscribed I cleverly added +php to the end of my email address (for Gmail filtering). Could I be removed please? Thanks. -- Graham Holtslander Computer Systems Technologist www.graham.holtslander.com mene...@gmail.com
Re: [PHP-DB] MSsql madness
please remove me from this list On Fri, Jun 24, 2011 at 3:02 PM, Troy Oltmanns toltma...@gmail.com wrote: Hey php-dbers, I have a helper script that connects to an MSsql database to select retailer location information, which is then processed into mysql statements to be inserted into another remote database (this one MYsql). Currently it is ran manually from a windows system that was preconfigured (prior to my arrival). It's my task to get it integrated into a linux installation so that it can be set up under crontab to execute daily. My issue is that in testing (I am running MAMP on mac 10.6.7) the mssql functions are not available out of the box. Since I am not a formal programmer, this is compounded by the fact that the process to configure build and install is completely foreign to me. I followed some instruction ( http://www.tumblr.com/tagged/mssql+mamp+php+mac+osx) to download freetds and I tried to run the first command (./configure --prefix=/Applications/MAMP/Library --with-tdsver=8.0 --sysconfdir=/Applications/MAMP/conf/freetds) with my appropriate information, and I am given this error: configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. In doing more research, many say that gcc should be already installed on my mac, but it's not. Other posts say you can get it in xcode, but Apple now forces you to pay $100 to get apple dev tools... yeah right! I found GCC at *gcc*.gnu.org, but when trying to run (../gcc-4.6.0/configure) it runs into another issue checking for cl.exe... no configure: error: in `/Users/toltmanns/Downloads/gcc': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. Tell me, how in the world are you suppose to compile a c compiler when you dont have one yet? Any direction would be helpful. Are there alternative ways to interact with MSsql? Thanks, Troy Oltmanns
[PHP-DB] Re: [PHP-WIN] Select the specific user data from the database
You could also try the following approach: - on the table, have an INSERT trigger add the username to a column named CREATE_WHO (this can be extended to UPDATE operations too, but this probably isn't necessary in your example) - create a view based on select * from table where CREATE_WHO = SUBSTRING_INDEX(USER(),'@',1);. - DML statements are now applied against the view, and not against the underlying table. This depends on the user who is logged in to the DB though. Hope this helps, Paul On 6 September 2010 19:38, Richard Quadling rquadl...@gmail.com wrote: On 5 September 2010 12:21, nagendra prasad nagendra802...@gmail.com wrote: Hi Experts, I have a mysql database. What I want is that when a user login he can able to see his entries only, so that he can delete, add or edit his entries only. I have 2 different tables one for user details and another for actual entries. Please help me. Best, Guru. If userA's and userB' data are both in the same table, do or will you have issues with key fields? I don't know what the data is, but you would need to include some element of the user in every unique constraint. Depending upon the data, another option is to have a separate table or database per user. This allows for user permissions to be assigned to the table or database. I've used this mechanism when users data needs to be sync across multiple devices and the device initiating the sync was always the most uptodate. Cloning a table was far easier. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP Windows 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] PHP Objects and SQL Results
Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Thanks, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Objects and SQL Results
Thanks for the code Eric, it seems to loosely provide the functionality that I'm after. Just out of interest though, is there no other way to find the next result row in an object apart from dumping it into an array? Thanks, Paul Eric Lee wrote: On Sat, Feb 13, 2010 at 3:26 AM, Paul devine...@msn.com wrote: Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Paul Is this the one you want ? $sql = 'select id, name from test'; $result = mysql_query($sql); $rows = array(); $row = null; while ($row = mysql_fetch_object($result)) { $rows[] = $row; } reset($rows); for ($i = 0, $c = sizeof($rows) - 1; $i $c; $i++) { next($rows); if (current($rows)-name) { // something to do } prev($rows); echo current($rows)-id, ' ', current($rows)-name, \n; next($rows); } if (current($rows)) { echo current($rows)-id, ' ', current($rows)-name, \n; } Regards, Eric, Thanks, Paul -- 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] PHP5: Initial connection to the MySQL server is carried out using the apache webserver userid
Hi, When I attempt to connect to a MySQL database I have noticed that the initial connection is made using the wwwrun userid (this is the userid that my Apache2 webserver is running under.) This is the output I see from the Firefox View Frame Info Function Notice: Undefined index: db in /srv/www/htdocs/LMsummary.php5 on line 23 br Notice: Undefined index: user in /srv/www/htdocs/LMsummary.php5 on line 24 br Notice: Undefined index: pass in /srv/www/htdocs/LMsummary.php5 on line 25 br Notice: Undefined index: host in /srv/www/htdocs/LMsummary.php5 on line 26 br Warning: mysql_connect(): Access denied for user 'wwwrun'@'localhost' (using password: NO) in /srv/www/htdocs/LMsummary.php5 on line 28 brUnable to connect to MySQL server, check userid and password are correct. However when I examine the values passed to the PHP script used in the mysql_connect() function I find that they are correct and as they should be, and it appears that for some reason details of the wwwrun userid is being passed to the mysql database prior to the correct ones. Is this normal? I should state that subsequent to this error the PHP connection to the MySQL server proceeds normally and the database is read OK and the pages are correctly compiled. The phpinfo() function also shows that the indexes apparently contain the correct values. Thanks in advance for any help. Paul Will -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PDO::TIME_ZONE and or Initializing Query
It would be helpful if the time zone of a session could be specified at the time of the connection. This would avoid the overhead of a separate database query and round-trip to the database server when a single, non-default time zone is needed for the duration of the connection. Naturally there is the option of using GMT and dealing with the time zone offsets entirely in PHP or at some other layer. However, many large databases systems support connection-specific time zones and I've found them to be quite useful. It may also be useful as a way to set the time zone after the connection is made using setAttribute. Since several supported systems are not time-zone aware, such as Sqlite, the attribute would not always have an effect. Or it could be implemented as a server-specific attribute such as MYSQL_TIME_ZONE or PGSQL_TIME_ZONE. If a TIME_ZONE attribute seems inappropriate then another idea is to provide an optional, initialization query when creating the PDO object. For example, a SET TIME ZONE 'CST6CDT' query could be issued to set the time zone immediately after the connection is made. Such a mechanism may have other uses for queries that do not require processing the response. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] test
new user test -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] test
new user test -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] test
new user test -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Test
New user test -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unable to Send Mail
Please forgive me if this comes through twice. I am a new subscriber and the first send did not seem to work. We recently moved all our websites to a new server using php 4.3.10. We are having problem with ONE function. Any time a php script or form is supposed to send a response or email to us or a user, or the mail is not sent. We have tried various formail.php versions, sendmail.php and written our own most basic scripts. Our php scripted calender program will not send confirmation, notices or allow email questions to be sent to those that post events. All other functions work without problem. Feedback forms do not send when SUBMITed. We see them come in to the server but no mail is sent. Like I said, we have used a wide variety of formmail and sendmail and written our own barebones script but they will not work. What does not work on the new server with php 4.3.10 still works on the old server with an earliver php 3 version. Can anyout help with ideas what is wrong. I think it is in the set up of the php 4.3.10 but we can't find it if it is. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] first record not displayed
Hi, I have the feeling I'm missing something very obvious here, but it's driving me nuts! Using this select statement: $result = mysql_query(SELECT * FROM latlong ,$link); $nrows = mysql_num_rows($result); and either of these to display the results: for ($j=0; $rec=mysql_fetch_array($result); $j++){ print j=$j id={$rec[id]} seq={$rec[seq]}\n; } while($row = mysql_fetch_array($result)){ echo id={$row[id]} seq={$row[seq]} \n; } The very first record gets dropped/not displayed. The number of records returned ($nrows) matches what I get from MySQL and the first record gets displayed (using PHPMyAdmin). Even if I change the select to pull only certain records, the very first one does not get displayed. Can anyone shed any light on this for me? Thanks! Paul Paul H. Bern, Ph.D. Numeric Data Services Librarian The only thing worse than not 352 Bird Library getting what you wanted 222 Waverly Ave.is getting what you asked for. Syracuse, NY 13244 315-443-1352 http://library.syr.edu/information/mgi/nds -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] If (test against a regex)
Is there a way to test a variable against a regex similar to the way Perl uses the binding operator =~ ? e.g. if ($envLine =~ /^* information:/) Will match: Environment information: Plugin information: Etc information: Thanks in advance, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Security and MYSQL databases
Here's a few payment processors. Some of them are located in United States and others in United Kingdom. Haven't tried all of them personally, but many professionals have recommended them. PayPal is still the best way to go because of its low cost. VeriSign is probably the most secure of all but it's also one of the most expensive. Datacash has a very usefull test service for testing out your transactions. You can perform test transactions using so-called magic credit card munbers supplied by DataCash, which will accept or decline transactions without performing any actual financial transactions. This is fantastic for development purposes, because you don't want to use your own credit cards for testing. Hope they are of use Gateway Services: United States URLUnited Kingdom URL CyberCash http://www.cybercash.com/ Arcot http://www.arcot.com First Data http://www.firstdata.com/ WorldPay http://www.worldpay.com/ Cardservicehttp://www.cardservice.com/DataCash http://www.datacash.com/ International VeriSign http://www.verisign.com/ ICVerify http://www.icverify.com/ Payflow Pro products/payflow/pro CyberCash - Original Message - From: I. Gray [EMAIL PROTECTED] To: php-db@lists.php.net; Bastien Koert [EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 9:36 AM Subject: Re: [PHP-DB] Security and MYSQL databases Thanks, I kind of suspected this, but it's good to be told. I wouldn't want to like to think my CC details were held on some database somewhere where it can get hacked into. Apart from paypal are there any other 3rd party payment processors that anyone recommends? I think we're perhaps going a little off topic here, so sorry. Bastien Koert wrote: You should never [almost never ever] store cc details from your users. Integrate a 3rd party payment processor into your site and process the payments immediately. It will cut down on fraud and chargebacks by the users. Its also more secure since the cc details are not stored on your machine. What you get back is a payment confirmation number which you can store in your systemto reord that payment was approved...and if you don't get one, you know immediately its been disallowed so you can stop the process at that point. The issues against it are: 1. its not completely secure. You don't have direct control of the server and therefore can't assure yourself that the system is locked down tight and kept updated. 2. Your db may not be secure enough 3. Your code may allow for holes that allow hackers to gain access to the data. 4. The liability for your business, should your data become compromised. Don't say it can't happen. Ask Playboy.com. Hackers access 8million accounts and had all the details. If you can't use a 3rd party processor, then you still shouldn't store the data on the server, but send an encrypted email (using pgp) to yourself with the account / order details for processing. But I strongly recommend using a 3rd party processor. Bastien From: I. Gray [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Security and MYSQL databases Date: Tue, 14 Jun 2005 14:36:50 +0100 Hello. Simple question. An SSL server and a standard a shared MYSQL server that I have with my hosts. If I am to set up a shopping cart system, is this a secure way of handling credit card details. What is the best way of receiving the details? I assume an email is not a good way as these can be intercepted. Is MYSQL secure enough in this way? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: SQL or array ?
Okay, thanks all. I think what I'll do is save the data in a DB, and then read it in to an array when the script is first called. That way it doesn't need to perform the SQL query per mime_type hundreds of times, and can just key it from the array. How would I go about benchmarking the different options? What tools are there to do this? Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQL or array ?
I have a quick question about which would the best way to implement something in terms of performance. Using a database, or just creating a big array in memory? I have a PHP file manager script which creates an array of all files in a directory, and get's their mime types. It then prints these files to the browser with a little image or a word icon etc for word documents. So the data looks a bit like this: +--++---+--+ | id | mime_type | description | icon | +--++---+--+ |0 | text/html | HTML document | html.png | |1 | application/msword | Word document | word.png | +--++---+--+ But this means for every file it comes across it needs to do an SQL query to find the description and icon name. Which doesn't seem very efficient. Would it be better to just create a big array at the start of my script with all this data in? That would seem more efficient, and hence faster way of doing it? Any feedback appreciated. Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL or array ?
explain the phrase big array. I guess everything is relative! We're talking about 300-500 items here. Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] supporting multiple databases...
Hiya. I'm writing an application which needs to make SQL queries, and I'd like to give it support for multiple database servers, starting with MySQL and PostgreSQL. I see that other folks have done this with a variety of methods, and I can't see a clear winner. Option 1 - Drop in a set of db-related functions as part of the install procedure. I.e. a file db_func.php is copied from db_func.php-pg or db_func.php-my as part of the install procedure. The functions contained will return equivalent results. This has the advantage of leaving the installed application more streamlined, but it requires better coordination between functions and things that call them; your total number of db functions is multiplied by the number of databases supported. Option 2 - Select function behaviour based on a config variable. That is, the same database functions will run, but there can be if() or switch() statements to control how the db is dealt with. This keeps the function list tighter, but it seems to make for less elegant and probably less maintainable code. Option 3 - Write relatively generic database functions, but control the format of SELECTs and even the db connect functions called from config variables. This seems elegant on the surface, but make for highly obtuse code. Is there a preferred method of handling this issue, or does everybody just roll their own? -- Paul Chvostek [EMAIL PROTECTED] it.canadahttp://www.it.ca/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Assistance on Query
Hi People, I would like some assistance on the following scenario. I have to pull out all records for a particular userid (easy enough) and then only show those entries where the follwing occurs. These records from the table will contain either an entry in the services_type field or the non_services_type field. What I need to do is show only those where the number of consecutive records that contain an entry in the non_services_type field is greater than or equal to 3 so example:- record 1 contains an entry in non_services_type record 2 contains an entry in services_type record 3 contains an entry in non_services_type record 4 contains an entry in non_services_type record 5 contains an entry in non_services_type record 6 contains an entry in services_type so I would need to display records 3,4,5 only Can anyone assist me with this? Cheers, Shannon When you do your while ($row = mysql_fetch_assoc($result)) { ... } you will need to keep a list of consecutive records. Try this: ?php $i = 0; $j = 0; while ($row = mysql_fetch_assoc($result)) { $current_string = ( !empty($row['non_services_type']) ) ? 'non_services_type' : 'services_type' ; if ($previous_string == $current_string) { $i++; if ($i = 3) { $records[$j] = $row; $j++; } } else { $i = 0; $previous_string = $current_string; } } ? Then simply echo $records. This may have some bugs to iron out, but this is a way to get the job done, please reply if you have found a better way. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: php-db Digest 16 Jan 2005 13:41:28 -0000 Issue 2777
From: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: php-db Digest 16 Jan 2005 13:41:28 - Issue 2777 Date: 16 Jan 2005 13:41:28 - php-db Digest 16 Jan 2005 13:41:28 - Issue 2777 Topics (messages 38151 through 38154): Re: Integrating Interbase.so and PHP 38151 by: Doug Thompson Re: MySQL db sync 38152 by: Bastien Koert Adding Up MySQL Results 38153 by: Nathan Mealey Assistance on Query 38154 by: Shannon Doyle Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-db@lists.php.net -- php-db_38151.ezm php-db_38152.ezm php-db_38153.ezm php-db_38154.ezm -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL denying access to...everything
Also, take care with the new password hashing: http://dev.mysql.com/doc/mysql/en/Password_hashing.html Paul On Wed, 18 Aug 2004 00:56:08 -0700, Peter Ellis [EMAIL PROTECTED] wrote: This is a MySQL error on the server side - you need to make sure that whatever user you're signing into MySQL with has access to modify the database/table you're using. I believe the GRANT keyword in MySQL is what you need -- look at the MySQL reference manual: http://dev.mysql.com/doc/ Good luck! -- Peter Ellis - [EMAIL PROTECTED] Web Design and Development Consultant naturalaxis | http://www.naturalaxis.com/ On Tue, 2004-08-17 at 23:03 -0400, [EMAIL PROTECTED] wrote: I finally got my PHP5 installation to support MySQL and now this. When I try to edit anything on mysqlgui.exe, it just gives me this error: error in database function: access denied for user @localhost... I don't know if this has to do with my php installation or what. If not, flame me for all I care. I'm too sick of all this mess to care. ...somebody help... -- 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] Re: Date Conversion
You might want to look into date conversion on the MySQL side: http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html Look for DATE_FORMAT(date,format) Paul On Wed, 18 Aug 2004 10:16:59 +0200, Torsten Roehr [EMAIL PROTECTED] wrote: Ng Hwee Hwee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, can someone kindly point me to a resource that converts all kinds of possible date inputs into MySQL format of -MM-DD? example of formats to be converted includes: d/m/yy d/m/ d/mm/yy d/mm/yyy dd/mm/yy dd/mm/yyy d/mmm/yy d/mmm/ dd/mmm/yy dd/mmm/ yy - 2 digit representation of year - ful numeric representation of year m - numeric representation of month, without leading zero mm- numeric representation of month, with leading zero mmm - short textual representation of month d - day of month without leading zero dd - day of month with leadin zero thanx! hwee This question belongs more to the general list, but anyway: You can use strtotime() to convert various formats to a timestamp. Then use date() to convert it back to your preferred date format: $timestamp = strtotime($inputDate); $isoDate = date('Y-m-d', $timestamp); http://de2.php.net/strtotime http://de2.php.net/manual/en/function.date.php Regards, Torsten Roehr -- 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] Connect to a ms access on a remote drive
I am aware that theres a problem with connecting to an MS ACCESS DB on a remote drive. Anyoone how to do it correctly ? Please? :( -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] One or Many Databases?
Hello everyone, I'm developing a community system, that has things like members, roles, events, etc. Currently everything is in multiple tables of a single MySQL database. It looks something like this... --- Communities - community_id PK, other_info Members - member_id PK, other info Roles - member_id FK, community_id FK Events - event_id PK, community_id FK --- Etc. There are about 25 tables total. It's been recommended to me that putting each community in it's own databases would be better. Something like this: --- Communities - community_id - Community_id_database Members - member_id PK, other info Roles - member_id FK Events - event_id PK --- So Now I'm trying to figure out if it really would be better or not, and that's what I'm asking for your help with. Here are some of the pros and cons, as I see them: PROS: --- Less chance of database corruption bringing down all communities Possibility of more security Possibility of more customization CONS: --- More difficult to administer Difficult to upgrade the system More difficult to inter-relate the communities/members More server load (??? - Using PEAR, I think each separate database would be a separate connection) Would the answers to this question be any different if I were using PostgreSQL, MSSQL or DB2? Thank you in advance for any advice you can offer. Sincerely, Paul Burney http://paulburney.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tree structure - how to show only current branch ??
Ya it has - that is a great script! -Original Message- From: Galbreath, Mark A [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 7:15 AM To: '-{ Rene Brehmer }-'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Tree structure - how to show only current branch ?? Already been done: http://www.destroydrop.com/javascripts/tree/ Mark -Original Message- From: -{ Rene Brehmer }- [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tree structure - how to show only current branch ?? Ok, Tom Reed got my thinker running big time ... and I've been trying to build an expandable and modifiable tree structure where it only displays the branch leading to the current folder... Showing the entire tree is easy, but how do I change the code to only display the branch we need??? ... I've never coded visual trees before, so this is new for me ... Found several samples with google where the code relies on the structure being fixed in the DB. What I want to create is the possibility to mode folders around within the tree ... literally moving branches from one place to another, while retaining their content. DB structure is simply this (I want to get rid of the level field if it's at all possible to count the levels with recursive functions, but for now it stays). folderID int(10) UNSIGNED auto-increment parentID int(10) UNSIGNED level tinyint(3) UNSIGNED name varchar(255) (I'm fully aware that int may be overkill, but this is for testing purposes...) test data: http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60folderID%60+ASCfolderID http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60parentID%60+ASCparentID http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60level%60+ASClevel http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60name%60+ASCname 1 0 0 parent 1 2 0 0 parent 2 3 0 0 parent 3 4 0 0 parent 4 5 0 0 parent 5 6 1 1 child of 1 7 3 1 child of 3 8 1 1 child 2 of 1 9 6 2 sub-child 1 10 6 2 sub-child 2 11 10 4 sub-sub 1 12 10 4 sub-sub 2 13 11 5 sub-sub-sub 1 Current code looks like this, the 2 subfunctions prints the branches, the main function below prints the root structure...: function count_children($parentID) { // count number of children in folder $count = mysql_query(SELECT COUNT(*) AS num_children FROM folders WHERE `parentID`='$parentID'); $numrows = mysql_fetch_array($count); return $numrows['num_children']; } function print_children($parentID) { // print the branch of sub-folders $children = mysql_query(SELECT folderID,level,name FROM folders WHERE `parentID`='$parentID'); while($child = mysql_fetch_array($children)) { $folderID = $child['folderID']; $name = $child['name']; $level = $child['level']; for ($i = 0; $i $level; $i++) { echo('middot'); } echo(middot; a href=\test1.php?folderID=$folderID\$name/abr\n); // let's find children... recursive call !! if (count_children($folderID) 0) { print_children($folderID); } } } // get root parents -- main tree function $parents = mysql_query(SELECT folderID,name FROM folders WHERE `parentID`='0'); while($folder = mysql_fetch_array($parents)) { $folderID = $folder['folderID']; $name = $folder['name']; echo(middot; a href=\test1.php?folderID=$folderID\$name/abr\n); // let's find children... if (count_children($folderID) 0) { print_children($folderID); } } The output of all this looks like this: . http://localhost/tests/tree%20structure/test1.php?folderID=1parent 1 .. http://localhost/tests/tree%20structure/test1.php?folderID=6child of 1 ... http://localhost/tests/tree%20structure/test1.php?folderID=9sub-child 1 ... http://localhost/tests/tree%20structure/test1.php?folderID=10sub-child 2 . http://localhost/tests/tree%20structure/test1.php?folderID=11sub-sub 1 .. http://localhost/tests/tree%20structure/test1.php?folderID=13sub-sub-s ub 1 . http://localhost/tests/tree%20structure/test1.php?folderID=12sub-sub 2 .. http://localhost/tests/tree%20structure/test1.php?folderID=8child 2 of 1 . http://localhost/tests/tree%20structure/test1.php?folderID=2parent 2 . http://localhost/tests/tree%20structure/test1.php?folderID=3parent 3 ..
RE: [PHP-DB] Automatically Refreshing png-Image'd Web Page
I might be reading this wrong, but I do not think you should put your meta refresh request in the png creation script. It should be in the html body script. Index.php Meta-refresh to call itself in 30 secs Call to img src=php_radio_image_creation_script.php php_radio_image_creation_script.php header(Content-type: image/png) Echo image content Hopefully this sudo code is enough to get what I am trying to say. You might have some caching issues, but that is another issue. - Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 11:01 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Automatically Refreshing png-Image'd Web Page Howdy Listers, The Background: I am making dynamic, color-coded, png images of the floor plan of a building and displaying them in a browser. Numerous radioactivity sensors throughout the building send their readings to a MySQL dB, and the web page queries the dB, and depending on the readings, the areas specific to the sensors will appear green for normal, yellow for high but acceptable, and red for critical. All this works OK. The Problem: Neither the HTML nor JavaScript code I usually use for automatically refreshing a page has any effect if the header(Content-type: image/png) necessary for displaying the png image is included. If I comment out the header() line, the page refreshes, but the image data comes through as hieroglyphics. Obviously, I need to refresh the page to get the latest data, and to create and display the corresponding image. The Question: Is there any way to automatically refresh a web page displaying a png image? Thanks in advance for any thoughts/insights into how I can solve this problem. dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] ?DHTML Layers with PHP?
This JS script is awesome. I work with Oracle Portal and a guy modified it to read portal hierarchies so I know it can read dynamic data with modification. http://www.destroydrop.com/javascripts/tree/ I believe you just have to be able to create the parent child relationships and display them in a js include like this: script type=text/javascript src=dynamic_page.php /script With dynamic_page.php containing links like: !-- d = new dTree('d'); d.add(44273,-1,'Corporate Documents'); d.add(44273,1,'Corporate Documents','http://www.someserver.com/portal/page?_pageid=73,44273','Fol der Name',''); document.write(d); -- I am not sure of a ready made php script that can do what you want, but I know it can be done. HTH - Paul -Original Message- From: Galbreath, Mark A [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 11:04 AM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] ?DHTML Layers with PHP? I've been sitting here all morning wracking my brains for a way to code a hierarchical menu tree with JavaScript from database data retrieved by PHP, so that the child menus appear on a mouse click. Can PHP do this without JS? The only JS examples I can find use static menu trees, not dynamic data. tia, Mark -- 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] How to redirect after a valid login
on 2004/03/15 15:39, Larry Sandwick at [EMAIL PROTECTED] made the following allegation: Here is the error I get when I use the include below: include MainMenu.php; Fatal error: Cannot redeclare class db in /tmp/disk/home/webmaster/Files/WWW/pearDB/DB.php on line 211 As someone else mentioned, inside the MainMenu.php file, use include_once instead of just include. That is probably your problem. I'll add the following additional comment for people searching for solutions in the archive: There is complication, however, if you are trying to use a local version of the DB or PEAR class (Maybe all PEAR classes in general). If you are doing that, you'll need to make sure that your local directories are at the beginning of the include_path. For example, let's say I do something like this: include_once './new-version/DB.php'; Within the DB.php associated files in the DB directory, there are calls to 'include_once DB.php'. Those includes will use the includes path, which by default is something like '/usr/lib/php/', not the place you included your file from. As far as PHP is concerned, those are different files. Thus, PHP first loads your DB.php and then the system version, resulting in the error you mention above. To get around that, I do something like this: $file_system_location = dirname(__FILE__); $current_includes_path = ini_get('include_path'); $new_include_path = $file_system_location . '/includes:' . $current_includes_path; ini_set('include_path',$new_include_path); Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to redirect after a valid login
That means you send some output before the headers were sent. That is a no no. For instance, this will not work: ?php Echo hello world; header(Location:http://www.yahoo.com/;); ? But this will ?php header(Location:http://www.yahoo.com/;); Echo hello world; ? - Paul -Original Message- From: Larry Sandwick [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 2:25 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] How to redirect after a valid login What is considered to be the headers() information When I use the header() functions, I get an error stating that I have already sent the headers information? // Larry -Original Message- From: Larry E. Ullman [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 3:04 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] How to redirect after a valid login Is there a way that after a execution of a Login script and validation of login from a MySql database to automatically redirected to run another script ? Use PHP's header() function. See the manual for syntax. Larry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Connect to MySQL Database Using PHP
I currently connect to my database (MySQL) through PHP with the following lines: $db = mysql_connect( 'host', 'userName', 'password'); mysql_select_db( database_name, $db); The host, userName, and password are all hard coded into the PHP document. I would prefer not to do this. How can I connect to the database without having my sensitive information hard coded into the PHP? Thanks, Paul _ Find and compare great deals on Broadband access at the MSN High-Speed Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connect to MySQL Database Using PHP
Thanks, I will try both suggestions. Much appreciated! Paul From: Mathias Hunskår Furevik [EMAIL PROTECTED] To: Paul Higgins [EMAIL PROTECTED] Subject: Re: [PHP-DB] Connect to MySQL Database Using PHP Date: Sat, 28 Feb 2004 21:51:30 +0100 You can include a file with: ?php $host = host; $Username = username; ... And then use: require(include.php); in alle php documents, and then use $host etc in the Connect-function. - Mathias Furevik På Sat, 28 Feb 2004 14:43:23 -0500, skrev Paul Higgins [EMAIL PROTECTED]: I currently connect to my database (MySQL) through PHP with the following lines: $db = mysql_connect( 'host', 'userName', 'password'); mysql_select_db( database_name, $db); The host, userName, and password are all hard coded into the PHP document. I would prefer not to do this. How can I connect to the database without having my sensitive information hard coded into the PHP? Thanks, Paul _ Find and compare great deals on Broadband access at the MSN High-Speed Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/ -- Sender med M2, Operas revolusjonerende e-postprogram: http://www.opera.com/ _ Find and compare great deals on Broadband access at the MSN High-Speed Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] What's wrong with this query?
You haven't done that a thousand times - the syntax is wrong :). You are using a combo of INSERT and UPDATE syntax there. Try INSERT INTO log (term, returns, time, date, ip) VALUES ('$search', '$arrayword',CURTIME(), CURDATE(), '$ip'); Cheers, Paul -Original Message- From: Axel IS Main [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 7:06 PM To: PHP-DB Subject: [PHP-DB] What's wrong with this query? I've just tried to do something I've done a thousand times. It does not work. I've checked all of the syntax, made sure the field and variable names are correct. No matter what I do it just doesn't work. The table remains empty. Here's the query: $logit = mysql_query(INSERT INTO log SET term='$search', returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'); Now that doesn't look too difficult does it? Well, apparently it's impossible! I'm really hoping someone out there can see something that I missed. Nick -- 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] Paging large recordsets
In no way I am trying start some long thread here. But I have always heard it was bad to store that much data in a session array? I could just be really off here and not understanding what I have read. I know PHP stores the sessions as text files. The only reason I can come up with why one should not store large amounts of data would be disk write/read speed per user. Can someone clarify this for me? - Paul -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 12:34 PM To: Karen Resplendo Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Paging large recordsets Most of the PHP solutions I have seeen require the use of session variables. You could create an array containing only the unique identifiers of all the records, and then store it into a session variable. You would then use another session variable to retain the page size, and then include the page numbers in the Next, Prev, First, Last and Absolutr page links. Printing is probably best done with dynamically generated PDF instead of HTML. -- bob On Fri, 13 Feb 2004, Karen Resplendo wrote: I guess the time has come that my boss wants Next, Previous, First, Last paging for our data displays of large recordsets or datasets. Any good solutons out there already? I have pieces of a few examples. Also, how to deal with printing? I would assume that the ideal page size is not the ideal printed page size. oi vay! TIA - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online -- 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] Paging large recordsets
One way that I have found - but never used is... http://sqlrelay.sourceforge.net/ It can cache result sets in a file for later use. You can then use It does a whole bunch of other stuff too. I really need to install this and start working with it. - Paul -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 1:59 PM To: Paul Miller Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Paging large recordsets If you are not opearating in a stateless environment, then you could use a cursor. The web is a stateless environment, and therefore the record set needs to be cached either to disk or memeory. The other alternative is to rerun the query for each page request. Using disk space to store query results for the purpose of paging over the web is commonly done by search engines, and even some database engines use disk space for cursor implementation. I agree that using session variables for this purpose is not ideal, but what's the alternative in PHP? Storing only the identifiers instead of all the data significantly lessons the impact. I agree, it should be avoided if possible. -- bob On Fri, 13 Feb 2004, Paul Miller wrote: In no way I am trying start some long thread here. But I have always heard it was bad to store that much data in a session array? I could just be really off here and not understanding what I have read. I know PHP stores the sessions as text files. The only reason I can come up with why one should not store large amounts of data would be disk write/read speed per user. Can someone clarify this for me? - Paul -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 12:34 PM To: Karen Resplendo Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Paging large recordsets Most of the PHP solutions I have seeen require the use of session variables. You could create an array containing only the unique identifiers of all the records, and then store it into a session variable. You would then use another session variable to retain the page size, and then include the page numbers in the Next, Prev, First, Last and Absolutr page links. Printing is probably best done with dynamically generated PDF instead of HTML. -- bob On Fri, 13 Feb 2004, Karen Resplendo wrote: I guess the time has come that my boss wants Next, Previous, First, Last paging for our data displays of large recordsets or datasets. Any good solutons out there already? I have pieces of a few examples. Also, how to deal with printing? I would assume that the ideal page size is not the ideal printed page size. oi vay! TIA - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] compiling oracle support
I am using OCI-8 with Oracle 9i just fine. - Paul -Original Message- From: Adam Williams [mailto:[EMAIL PROTECTED] Sent: Thursday, February 12, 2004 9:13 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] compiling oracle support How do I compile PHP on Unix to have oracle 9 support. Looking at ./configure --help and PHP's website, I see no option for oracle 9 support. I see --with-oci8 but that appears to only work for Oracle 8. Any help? Thanks! -- 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] Rules in a database
I guess I did not pay attention that day in class, but that is cool. - Paul -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED] Sent: Friday, February 06, 2004 9:14 AM To: DB list PHP; John Subject: Re: [PHP-DB] Rules in a database A bit of algebra first: any expression formed of atomic expressions, AND, OR and parentheses can be reduced to a canonical form, by using the De Morgan laws: a AND ( b OR c ) is equiv. to a AND b OR a AND c So a rule can eventually be reduced to AND groups, joined by OR: a(1) AND... AND a(n) OR ... OR z(1) AND ... AND z(p) Each AND group contains 1 or more rules. Therefore, to model input rules: - store atomic rules in a table - store AND rule groups in a table (1-n relation to the atomic table) - store full rules in a table (1-n relation to the AND table) Now you can model output rules likewise, and finally create a table of associations between input and output rules Problem is: once you've flattened your rules to the canonical form, they can become illegible. So perhaps a hierarchical data model (XML) would be more appropriate, for your rules would remain human-legible (and thererfore human-maintainable) HTH Ignatius _ - Original Message - From: John [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 06, 2004 15:35 Subject: [PHP-DB] Rules in a database I work in tax and thus have to read legislation - some complex - and I wanted to store some of the logic in a database so that if I know certain conditions were true I could look up what results this might have. Thus I am thinking of having two tables - one of phrases and the other of how these phrases are linked together as rules. A rule structure could be: IF A THEN B IF A OR A1 OR A2 THEN B IF A THEN B AND C I was wondering how to do this. For instance, each rule could be one record in the table. The rules table has fields, IF and THEN. The ID field is the rule ID. Assume the phrases are numbered. One IF record could say: +/12/41/31/+/90/ meaning if phrases 12, 41 or 31 are true and phrase +90 is true. Then if I have a real situation where condition 12 is true, for instance, I can find it and access it using sub string functions. Does this scheme seem OK? Has anyone done anything like this before? Regards, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP Command Line
php script.php %1 %2 %3 %4 And it is referenced as $argv[arg number] ... I think. To be sure, here is the link to that info: http://www.php.net/manual/en/features.commandline.php - Paul -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 4:34 PM To: PHP-DB Subject: [PHP-DB] PHP Command Line Anyone know how to pass a query string to a php script when you call it on the command line? Ryan -- 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] Inserting querydata as default value in form
Need some quotes input name=link TYPE=TEXT cols=40 value=\.$query_data[4].\ Output will look like input name=link TYPE=TEXT cols=40 value=Look Here Instead of input name=link TYPE=TEXT cols=40 value=Look Here\ Which it probably looks like now. - Paul -Original Message- From: Georg Herland [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 12:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Inserting querydata as default value in form Hi! I hav made a simle page to insert update and delete data in MYSQL. I try to put existing data into a standard form field to make editing easyer: input name=link TYPE=TEXT cols=40 value=$query_data[4] Problem is when the text data contains a space ie Look here. Then only the first word show. To display both words i have to update the data to Look_here witch isn't really looking good. A good suggestion, anyone? TIA Georg :-) -- 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] Wonder Program Question
Hi All, Got a question for everyone. Does anyone know of a Red Hat (Fedora would be even better) package that does the following: - Load Balancing - Proxying - Host Name Redirects - Server Heartbeat monitoring I know IP Tables can do it with some help from some other programs, but I am looking for one simple clean program that works a lot like my router or expensive routers I have used in the past. Some Foundry routers do this already and if I cannot do it server side I am going to consider that option. I am just wondering if any one knows of anything. Thanks, Paul Here is an example of what I want to setup. === All domains will have the same IP address. I want all traffic that comes in over port 80 on that IP address to be handled by my routing server. The server will send windows traffic to the windows machine and Linux traffic to one of the Linux machines based on availability and load. I want the routing server to determine what traffic goes where based on the host name (www.domain1.com or www.domain2.com). Below is a quick sketch. www.domain1.com - Linux Server (12) Domain1 will go to Linux Server1 and Linux Server2 in my backend network. It will be the load balanced server. www.domain2.com - Windows Server1 Domain2 will go to my Windows Server. The host name will tell the routing server to send the request to the Windows server. The Windows server will determine which virtual site to serve based on the proxied host name (Domain2) and then return the correct info. www.domain3.com - Windows Server1 Domain3 will also go to my Windows Server. The host name will tell the routing server to send the request to the Windows server. The Windows server will determine which virtual site to serve based on the proxied host name (Domain3) and then return the correct info. - www.domain1.com www.domain2.com www.domain3.com AB B || | - | | - My Firewall --| | | - | Linux Routing, Load- | | balancing and Proxy Server | | which accepts all port 80 | | traffic | - | | --- A A B B | | | | Linux Linux WindowsWindows Server1Server2 Server1Server1 - Thanks again if you have gotten this far, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Can anyone see what's wrong with this code?
You probably need to specify the path in the filesize call also. It looks like you are just pushing the filename. Like $filepath = /home/www/nortonway/photos/$filename; $fd = fopen($filepath, rb); $filedata = fread ($fd, filesize($filepath)); $zipfile - add_file($filedata, $filename); fclose ($fd); HTH - Paul -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 12:52 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Can anyone see what's wrong with this code? HI there Everyone, Finally found the list address again, my computer crashed and I lost everything, sigh. Anyway, i'm zipping a file and it's zipping the filename ok but not the file and I have a feeling it's something wrong with the below, as I get an error on the filesize parameter saying no such file, even though I know it is there. For this example, think of $filename as having mypic.jpg stored in it (Which it does, checked and it echoed the name), so I specified the server path and that got rid of that error, but the filesize one is just frustrating me, is it something simple i'm missing? I've looked into the PHP manual and seems it should be working. $fd = fopen(/home/www/nortonway/photos/$filename, rb); $filedata = fread ($fd, filesize($filename)); $zipfile - add_file($filedata, $filename); fclose ($fd); Any help would be extremely appreciated. Regards Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php-db globals turned off
I love this one... extract($_REQUEST); but it undermines the whole reason PHP moved to the new default parameter specification. Be careful with you coding. I use it, and it makes things much like the pre 4.3.2 release without changing the ini files. You just have to specify the default $_server and file upload params. The other option is change the php.ini file for that dir or globally. - Paul -Original Message- From: Mignon Hunter [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 12:56 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] php-db globals turned off How do most of you handle variables in next page after passing. For instance. What I have right now (very ugly) is: $email = $_POST['emal']; $first = $_POST['first']; $lastl = $_POST['last']; Then I work with $email, $first etc... I will have to do this for many, many variables which doesnt seem very efficient. I tried: foreach ($_POST as $key = $value) $key = $value; but that didnt work...but I can print them out. but even if this did work - this wouldnt handle the 2 sets of arrays I have. Does anybody have any snippets for this ... ??? Thanks Mignon Hunter Webmaster Toshiba International Corporation (713) 466-0277 x 3461 (800) 466-0277 x 3461 -- 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] php-db globals turned off
Also, many legacy applications use the non $_POST variable definitions. A problem that I ran into. - Paul -Original Message- From: Mignon Hunter [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 1:47 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] php-db globals turned off So it will be easier to use in my script on this page, where I'm creating several query strings with the data. Mignon Hunter Webmaster Toshiba International Corporation (713) 466-0277 x 3461 (800) 466-0277 x 3461 John W. Holmes [EMAIL PROTECTED] 01/28/04 01:15PM Mignon Hunter wrote: How do most of you handle variables in next page after passing. For instance. What I have right now (very ugly) is: $email = $_POST['emal']; $first = $_POST['first']; $lastl = $_POST['last']; Why are you recreating variables? You already have a variable $_POST['email'], so why do you feel the need to make $email? Now you have two variables to keep track of. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php-db globals turned off
I am not 100% sure what you are doing here, so I am responding with this... if (is_array($_POST['prod']) { // Value is an Array $prod = $_POST['prod']; }else{ // Value is not an array, but the value // is added to the first element. $prod[] = $_POST['prod']; } With extract, if $_POST['prod'] is an array, then prod will be an array also. - Paul -Original Message- From: Mignon Hunter [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 2:09 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP-DB] php-db globals turned off How would you extract variables from arrays? before I was doing $prod[] = $_POST['prod']; $choice[] = $_POST['choice']; then I could iterate through $prod[], $choice[] Mignon Hunter Webmaster Toshiba International Corporation (713) 466-0277 x 3461 (800) 466-0277 x 3461 Paul Miller [EMAIL PROTECTED] 01/27/04 01:06PM I love this one... extract($_REQUEST); but it undermines the whole reason PHP moved to the new default parameter specification. Be careful with you coding. I use it, and it makes things much like the pre 4.3.2 release without changing the ini files. You just have to specify the default $_server and file upload params. The other option is change the php.ini file for that dir or globally. - Paul -Original Message- From: Mignon Hunter [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 12:56 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] php-db globals turned off How do most of you handle variables in next page after passing. For instance. What I have right now (very ugly) is: $email = $_POST['emal']; $first = $_POST['first']; $lastl = $_POST['last']; Then I work with $email, $first etc... I will have to do this for many, many variables which doesnt seem very efficient. I tried: foreach ($_POST as $key = $value) $key = $value; but that didnt work...but I can print them out. but even if this did work - this wouldnt handle the 2 sets of arrays I have. Does anybody have any snippets for this ... ??? Thanks Mignon Hunter Webmaster Toshiba International Corporation (713) 466-0277 x 3461 (800) 466-0277 x 3461 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Oracle and upper case field name
the way I do it is with http://www.ytztech.com product SQL_AL.PHP which has a switch that will say all values are upper or lower. You can also create a simple wrapper function that will do the lower conversion. - Paul -Original Message- From: William Cheung [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 2:27 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle and upper case field name Hi, When Oracle returns the result set, the field names are all in upper case. However, I have an application that needs to work on both MSSQL and Oracle. I don't want to keep 2 copies. One has upper case field names and the other lower case. How could I make PHP or ADODB to work with lower case field names even the result set is upper case? William Cheung mailto:[EMAIL PROTECTED] B.Sc, MCSE, MCDBA Databyte Corp. http://www.databyte.com/ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.567 / Virus Database: 358 - Release Date: 1/24/2004
RE: [PHP-DB] php-db globals turned off
As mentioned in my first email, PHP and myself think turning the global var reg off is a good thing, especially for inexperienced coders and var definition. $email = $_POST['email'] makes a difference is you are dealing with an application that was built during the 90% of PHP's lifetime where reg global vars was turned on and you want to use that application with your server where with 4.3.2 - it is turned off. Basically $_POST['email'] is already referred to as $email in thousands of lines of code and instead of trying to convert them (legacy application), you just use the extract function. Hope that is a bit clearer. - Paul -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 2:21 PM To: [EMAIL PROTECTED] Cc: 'Mignon Hunter'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] php-db globals turned off Paul Miller wrote: Also, many legacy applications use the non $_POST variable definitions. A problem that I ran into. So how is saying $email = $_POST['email'] going to help you in that case?? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Results with ledger stripes?
Hi, You can use the modulus operator to create alternate colour rows. A bit simpler in code ;) See below - echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; // Define count variable which is tested in loop $count = 1; while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { // If $count divides evenly by 2, white, if not then #efefef $color = ($count % 2)? #ff : #e4e4e4; echo tr bgcolor=$colortd$mongorow[0]/tdtd$mongorow[1]/td/tr\n; $count++; } echo /table; --- // Done :) -Original Message- From: Ricardo Lopes [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 7:29 PM To: [EMAIL PROTECTED] Cc: PHP DB Subject: Re: [PHP-DB] Results with ledger stripes? I dont see what is your problem, your code do almost anything. Is you pretend to generate the output in html as you show in the example, you just have to add the color property in the td or tr tag, take care with the in the code. ex: $dummy_var = 0; $dummy_array = array(#dd, #ff); while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo tr bgcolor= .$dummy_array[$dummy_var].td$mongorow[0]/tdtd$mongorow[1]/td /tr \n; $dummy_var++; } And thats is it. You could use css or other things, thats up to you. Hope thats solved. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 26, 2004 1:42 AM Subject: [PHP-DB] Results with ledger stripes? Hello all, I'm in the midst of creating an internet speed test system thingamabob for my website. It's basically finished...but ugly as sin. What I'd like to do is have the results (an average of each domain tested) listed in a nice pretty table with alternating background colors, kinda like a ledger. How on earth do I do this? Here's what I've got thus far: ?php echo Average speeds of each domain tested:br; $mongo = @mysql_query (SELECT substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC); echo tabletrtdDomain/tdtdAverage Speed/td/tr\n; while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo trtd$mongorow[0]/tdtd$mongorow[1]/td/tr\n;} echo /table; ? And I'd like it to spit out something along these lines: table tr bgcolor=#ddtddomain1.com/tdtd666.6 kbps/td/tr tr bgcolor=#fftddomain2.com/tdtd3000.0 kbps/td/tr repeat until done /table The gizmo is up and running at http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have a gander. Thanks a bunch, Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Stroring files as BLOBs in MySQL?
One thing that is not a huge issue, just something to be aware of is the default 2mb limit in the php.ini file. It is easily changed if you want to upload bigger files. - Paul -Original Message- From: John [mailto:[EMAIL PROTECTED] Sent: Friday, January 23, 2004 10:04 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Stroring files as BLOBs in MySQL? Whats the problems with it?? I now have an 150MB table with MIDI files and title and authors. could i run into problems bu doing this?? -- ** Free Nokia Ringtones US http://www.ring-tones.us ** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Images stored in a db - how to get them?
While I totally agree with Ryan, there are instances where I have found that people do not follow best practices, namely Oracle (Oracle File Storage) and many MySQL/PHP programs out there (OPT and Help Center Live). So here is some code addressing both. You would probably need an interpreter file. Something like image.php and call images like image.php?ID=house. Then in your code, you grab the blob or file info and print it out after you set the headers like this: = THE DB OPTION (local file system storage): = ?php $sql = select image_blob_column, mime_type from images where image_ext_id = '$ID'; $results = sql_query($sql, $db_id); if ($row_file = sql_fetch_array($results)){ // Set the headers Header(Content-Type: .$row_file[mime_type]); // Gif or Jpeg Header(Content-Disposition: inline); // Tells the browser to display it // in the browser if it is opened up by itself Header(Content-Length: .count($row_file[image_blob_column])); echo $row_file[image_blob_column]; } ? = THE FILE OPTION (local file system storage): = ?php $sql = select file_path, mime_type from images where image_ext_id = '$ID'; $results = sql_query($sql, $db_id); if ($row_file = sql_fetch_array($results)){ // Set the headers Header(Content-Type: .$row_file[mime_type]); // Gif or Jpeg Header(Content-Disposition: inline); // Tells the browser to display it // in the browser if it is opened up by itself Header(Content-Length: .filesize($row_file[file_path])); $fp=fopen($row_file[file_path], rb); fpassthru($fp); } ? The GD library is for creating new images using specified parameters or editing an image. HTH - Paul -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 3:28 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Images stored in a db - how to get them? about once a quarter this question comes up and the answer is always the same. Don't store them in the database, just store filenames and store the files in the filesystem. That way you just generate a link and treat it like any other image. Then when you query the database you would create img tags with src property set to the image. You probably don't want to store FULL path info, just enough to find the image. Ryan -Original Message- From: John T. Beresford [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 2:23 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Images stored in a db - how to get them? Hello All, I am interested in storing images in a table. My question is - What is the proper way of retrieving the images and displaying them on a web page? Will I need to go through the GD library and create an image from the information stored in the table? While PHP is not new to me, images in db's is. Specifically, when info is returned, it's usually in the form of: $var=$row['FieldName']; What would I then do with the 'BLOB' information? Is that where the GD image tools come in play? Any URL's or small hints to point in the right direction would be very much appreciated. Thanks, John -- === John T. Beresford Apple Certified Technical Coordinator http://www.deewi.com/ 405.760.0794 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Database Abstraction Layer?
There are a couple of products out there that I am about to start testing, starting first with: - SQL Relay http://sqlrelay.sourceforge.net/ This product uses its on C interfaces to interact with DBs and different programming languages. It addresses a bunch of items in the PHP DB calls. Connection pooling and load balancing. - Propel http://propel.phpdb.org/ Extensive templates create the SQL definition files you need to setup your database and the classes you need to work with your data model in your PHP scripts. The classes for your object model are generated from a simple XML schema and any customizations are written in plain PHP. This will effectively that add SQL and DB dependence out of your mix. This is PHP5 also. HTH - Paul -Original Message- From: Muhammed Mamedov [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 2:31 AM To: phpdb Subject: [PHP-DB] Database Abstraction Layer? Hello everybody, What do you think is the best method to abstract php code from a specific database?. Make PHP code 100% database independent?.. Waitin' for your comments. Muhammed Mamedov -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Database Abstraction Layer?
Oh ya, one more thing, I am going to integrate SQL Relay with the PHP abstraction layer: http://sourceforge.net/projects/sqlalphp to give the functions a more PHP feel to them. Plus, I will be able to retain DB specific calls if I want with this layer. I have used this layer with a great deal of success in the past. But it was never the DB calls that got me, it was the actually SQL. So I am building a swappable SQL library. The Propel solution would effectively negate me having to do that. - Paul -Original Message- From: Muhammed Mamedov [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 3:41 AM To: phpdb Subject: Re: [PHP-DB] Database Abstraction Layer? Thanks Ricardo for your comments. What do you think guys: ADODB or PEAR::DB ? - Original Message - From: Ricardo Lopes [EMAIL PROTECTED] To: Muhammed Mamedov [EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 11:21 AM Subject: Re: [PHP-DB] Database Abstraction Layer? You have ADODB and PEAR DB that both work as abstraction layer. I have used ADODB and seems to me that is very good, yet i have not tested PEAR DB... To make php code 100% database independent is not very easy, depends of what are you going to do with your code. Use the ADODB or PEAR functions every time possible, and avoid the using of sql statements in your code because you have to carefull design then to be database independent but that can be a very difficult task. - Original Message - From: Muhammed Mamedov [EMAIL PROTECTED] To: phpdb [EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 8:31 AM Subject: [PHP-DB] Database Abstraction Layer? Hello everybody, What do you think is the best method to abstract php code from a specific database?. Make PHP code 100% database independent?.. Waitin' for your comments. Muhammed Mamedov -- 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] Database Abstraction Layer?
PEAR is great from what I hear. The issue you are going to run into with DB independence is not the function calls which could be handled with something as simple as sqlalphp. It is the SQL calls themselves. The two options I have found is a SQL library with unembeded SQL or the Propel solution. Either way adds a significant time to coding and product release initially. - Paul -Original Message- From: Muhammed Mamedov [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 10:07 AM To: [EMAIL PROTECTED]; phpdb Subject: Re: [PHP-DB] Database Abstraction Layer? Hmm.. Thank you for you sql picks:) But what do you guys think aabout Pear :: DB? Is it as effective as these Paul's picks? Thank you. Muhammed Mamedov - Original Message - From: Paul Miller [EMAIL PROTECTED] To: phpdb [EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 5:44 PM Subject: RE: [PHP-DB] Database Abstraction Layer? There are a couple of products out there that I am about to start testing, starting first with: - SQL Relay http://sqlrelay.sourceforge.net/ This product uses its on C interfaces to interact with DBs and different programming languages. It addresses a bunch of items in the PHP DB calls. Connection pooling and load balancing. - Propel http://propel.phpdb.org/ Extensive templates create the SQL definition files you need to setup your database and the classes you need to work with your data model in your PHP scripts. The classes for your object model are generated from a simple XML schema and any customizations are written in plain PHP. This will effectively that add SQL and DB dependence out of your mix. This is PHP5 also. HTH - Paul -Original Message- From: Muhammed Mamedov [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 2:31 AM To: phpdb Subject: [PHP-DB] Database Abstraction Layer? Hello everybody, What do you think is the best method to abstract php code from a specific database?. Make PHP code 100% database independent?.. Waitin' for your comments. Muhammed Mamedov -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Update problems
You might want to use single quotes FirstName='$fname' $sqlupdate=UPDATE UserInfo SET ZNum='112763', FirstName='$fname', LastName='Short', TA='00', Building='1197', Room='112', Div='FWO', Grp='IIM' WHERE ZNum='112763'; - Paul -Original Message- From: Peter Lovatt [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 5:17 PM To: Kermit Short; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Update problems you need quotes around the name FirstName=$fname otherwise it takes the value of $fname to be aa field name HTH Peter -Original Message- From: Kermit Short [mailto:[EMAIL PROTECTED] Sent: 20 January 2004 22:28 To: [EMAIL PROTECTED] Subject: [PHP-DB] Update problems I'm trying to update a record in a MSSQL database. When I execute the following code on an IIS5 webserver, I get an error message that says: PHP Warning: odbc_do(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Tom'., SQL state S0022 in SQLExecDirect in E:\web\phptest\dbtest.php on line 31 This is after I've submitted the name Tom in the form. Does anyone have any ideas?! Thanks very much in advance! -Kermit ?php $fname=$_POST['first']; if (!(is_null($fname))) { if (!($odbccon = odbc_connect(**, **, **))) { die(pCould not Connect./p); } else { echopConnected to Database./p; $sqlupdate=UPDATE UserInfo SET ZNum='112763', FirstName=$fname, LastName='Short', TA='00', Building='1197', Room='112', Div='FWO', Grp='IIM' WHERE ZNum='112763'; $sqlupdresults=odbc_do($odbccon, $sqlupdate); $query=SELECT * FROM UserInfo WHERE ZNum=112763; $qresults=odbc_do($odbccon, $query); odbc_result_all($qresults, border=1); odbc_close($odbccon); echo pConnection Closed./p; } } else { ? form action=?php echo $_SERVER['PHP_SELF'] ? method=post name=test First Name: input type=text name=first /br / input type=submit name=submit / /form ?php } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Architecture Question - Opinion
All, I am considering moving to a true 3-tier structure where the web server does not have direct access to the database server - many times a government requirement. I want to keep the PHP front end and use an application server (middle tier) to handle all the DB calls and sessions. I could use Java or something for the middle layer, but I do not really want to. I would like to implement a PHP application server sitting on top of SQL Relay for pooling and DB abstraction to reduce the need to have more expertise necessary for implementation. Interoperability is important, but not 100% necessary. With all that being said, what do you think is the best method of communication between PHP and the application server. Just to throw it out there, I have thought about SOAP and XML-RPC. I like SOAP better because it can decrease payload a great deal by not having to use the whole struct method and it is more complex. But the XML-RPC functions are written in C and the SOAP are in PHP. PHP 5 has better object orientation and new XML libs so the SOAP functions should run much faster, but still not native. What are your thoughts? - Paul
RE: [PHP-DB] Re: Architecture Question - Opinion
That is the major issue at hand, the slow Live DB calls. Is there any way around it while maintaining the constraints listed below using another method of standard communication. Is the slow going to be unacceptable? I used SOAP to call an off site document server and that was slow. I do not think that is a good comparison because my two servers would be on the same gigabit network. I am mostly worried about the web server, app server and DB server all being on different machines and the SOAP layer adding an unacceptable amount of lag in the already heavy backend. callSOAP client call---SOAP server translation-DB call--Data call-SOAP client acceptance---SOAP server transmission-DB response-Base - Paul = I believe people are working on a SOAP extension to PHP in C, but I could be mistaken. I like SOAP myself, it means easy interoperability with any language with a SOAP implementation. The downside is slow processing. Live DB calls on the webserver will be fairly slow. -- paperCrane Justin Patrin -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 12:19 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Architecture Question - Opinion Paul Miller wrote: All, I am considering moving to a true 3-tier structure where the web server does not have direct access to the database server - many times a government requirement. I want to keep the PHP front end and use an application server (middle tier) to handle all the DB calls and sessions. I could use Java or something for the middle layer, but I do not really want to. I would like to implement a PHP application server sitting on top of SQL Relay for pooling and DB abstraction to reduce the need to have more expertise necessary for implementation. Interoperability is important, but not 100% necessary. With all that being said, what do you think is the best method of communication between PHP and the application server. Just to throw it out there, I have thought about SOAP and XML-RPC. I like SOAP better because it can decrease payload a great deal by not having to use the whole struct method and it is more complex. But the XML-RPC functions are written in C and the SOAP are in PHP. PHP 5 has better object orientation and new XML libs so the SOAP functions should run much faster, but still not native. What are your thoughts? - Paul -- 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] NEXTVAL Question
Does anyone know how to make this work??? $sql = select TEAM_SEQ.NEXTVAL as \nextval\ from sys.dual; I get the following error in PHP: ociexecute(): OCIStmtExecute: ORA-00903: invalid table name But when I use my SQL tool to hit the DB will all the same parameters, it works just fine. I have also tried: $sql = select TEAM_SEQ.NEXTVAL from sys.dual; $sql = select TEAM_SEQ.NEXTVAL from dual; all with the same results. I am running Red Hat AS, PHP 4.3, OCI8 Functions and Oracle 9i. - Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Splitting a string by a ,
if the emails are in a CSV file, you can also use fgetcsv ?php $handle = fopen (test.csv,r); while ($data = fgetcsv ($handle, 1000, ,)) { $num = count ($data); for ($c=0; $c $num; $c++) { print $data[$c] . br\n; } } fclose ($handle); ? - Paul -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 1:23 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Splitting a string by a , Hi there everyone, I'm trying to split a string into an Array by a , but I kepe getting errors. Looking at the PHP manual, I thought it would be this way: $keywords = preg_split(,, $email); But it keeps saying that the , isn't an ending delimiter? Any help would be appreciated, i'm trying to split email addresses from an input box seperated by a , Thanks for any help. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Oracle/PHP Issue
Nope, that was not it? Still giving me the *** ORA-12545: Connect failed because target host or object does not exist *** error. Hm - Paul -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 4:23 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Oracle/PHP Issue I'm using the descriptor type of connection and it looks a bit different than yours. Try changing your CONNECT_DATA setion to: (CONNECT_DATA = (SID = BDB1) (GLOBAL_NAME = BDB1.world)) Paul Miller wrote: Hello, I am having a strange issue with Oracle and PHP. I am running PHP Version 4.3.4 on Red Hat AS 2.3 and trying to connect to Oracle 9i also on Red Hat AS 2.3. I compiled PHP successfully with OCI and oracle. My script uses the ocilogon($user, $password, $db); or ora_logon($user.'@'.$db, $password); depending on what interface I want to use in my abstraction layer. Note: All oracle failures (*** some error ***) are when I use the ora_logon, ocilogon, or the ocinlogon. Info about what works: - PHP can at lease partially talk to the remote Oracle DB. - If I give a bad username or password, PHP returns *** Oracle: Connection Failed: ORA-01017: invalid username/password; logon denied.*** So I know PHP is able to validate the username against the remote Oracle database. - If I give an unspecified TNS name, BDB1_broken, instead of BDB1 which is in the tnsnames.ora file, I get the following Oracle message though PHP: *** Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name ***. So I know that the TNS name is being verified against the remote database. - When I try to logon to the remote DB with SQLPlus using the same tnsnames.ora file used by PHP, I can logon just fine. Also, a plsql stored procedure running off a DAD on the server works. THE PROBLEM: When I use the correct username, password and ORACLE_SID, I get the following error: *** Oracle: Connection Failed: ORA-12545: Connect failed because target host or object does not exist *** I have: - Tried specifying the DB connection in the PHP code $DATABASE = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = BDB1.world) ) ); - Tried using the IP address 192.168.2.2 and the host name both in the PHP and the tnsnames file. - Added apache and nobody to the oracle and the dbs groups. - Setting different environment vars in the PHP code putenv(ORACLE_HOME=/opt/ora9/product/9201); putenv(ORACLE_SID=BDB1) - Recompiling PHP - Using BDB1 and BDB1.PROD_DATABASE.MY_DOMAIN.COM in the putenv and the database name in the connection function. - Checked the Apache config ##ORACLE ENVIRONMENT ORACLE_HOME=/opt/ora9/product/9201 ORACLE_BASE=/opt/ora9/ export ORACLE_HOME ORACLE_BASE ORACLE_TERM=vt100 LD_LIBRARY_PATH=$ORACLE_HOME/lib PATH=$ORACLE_HOME/bin:$PATH export PATH LD_LIBRARY_PATH ORACLE_DOC=$ORACLE_BASE/doc ORACLE_SID=BDB1 TNS_ADMIN=/opt/ora9/product/9201/network/admin export ORACLE_DOC ORACLE_SID TNS_ADMIN Does anyone have any thoughts Thanks for any help, Paul ___ Paul Miller System-Wise pmillerATsystemDASHwiseDOTcom AT = @ DASH = - DOT = . -- 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] Oracle/PHP Issue
Hello, I am having a strange issue with Oracle and PHP. I am running PHP Version 4.3.4 on Red Hat AS 2.3 and trying to connect to Oracle 9i also on Red Hat AS 2.3. I compiled PHP successfully with OCI and oracle. My script uses the ocilogon($user, $password, $db); or ora_logon($user.'@'.$db, $password); depending on what interface I want to use in my abstraction layer. Note: All oracle failures (*** some error ***) are when I use the ora_logon, ocilogon, or the ocinlogon. Info about what works: - PHP can at lease partially talk to the remote Oracle DB. - If I give a bad username or password, PHP returns *** Oracle: Connection Failed: ORA-01017: invalid username/password; logon denied.*** So I know PHP is able to validate the username against the remote Oracle database. - If I give an unspecified TNS name, BDB1_broken, instead of BDB1 which is in the tnsnames.ora file, I get the following Oracle message though PHP: *** Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name ***. So I know that the TNS name is being verified against the remote database. - When I try to logon to the remote DB with SQLPlus using the same tnsnames.ora file used by PHP, I can logon just fine. Also, a plsql stored procedure running off a DAD on the server works. THE PROBLEM: When I use the correct username, password and ORACLE_SID, I get the following error: *** Oracle: Connection Failed: ORA-12545: Connect failed because target host or object does not exist *** I have: - Tried specifying the DB connection in the PHP code $DATABASE = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = BDB1.world) ) ); - Tried using the IP address 192.168.2.2 and the host name both in the PHP and the tnsnames file. - Added apache and nobody to the oracle and the dbs groups. - Setting different environment vars in the PHP code putenv(ORACLE_HOME=/opt/ora9/product/9201); putenv(ORACLE_SID=BDB1) - Recompiling PHP - Using BDB1 and BDB1.PROD_DATABASE.MY_DOMAIN.COM in the putenv and the database name in the connection function. - Checked the Apache config ##ORACLE ENVIRONMENT ORACLE_HOME=/opt/ora9/product/9201 ORACLE_BASE=/opt/ora9/ export ORACLE_HOME ORACLE_BASE ORACLE_TERM=vt100 LD_LIBRARY_PATH=$ORACLE_HOME/lib PATH=$ORACLE_HOME/bin:$PATH export PATH LD_LIBRARY_PATH ORACLE_DOC=$ORACLE_BASE/doc ORACLE_SID=BDB1 TNS_ADMIN=/opt/ora9/product/9201/network/admin export ORACLE_DOC ORACLE_SID TNS_ADMIN Does anyone have any thoughts Thanks for any help, Paul ___ Paul Miller System-Wise pmillerATsystemDASHwiseDOTcom AT = @ DASH = - DOT = .
[PHP-DB] RE: Subject: Hitcounter works on production server but not on localhost
hey niel. thanks man... thats wierd, why does it need to be full? how would i have been able to figure that out? appreciate it.. -Original Message- From: Neil Smth [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 12:53 PM To: Cc: [EMAIL PROTECTED] Subject: Re: Subject: Hitcounter works on production server but not on localhost Its not a permissions thing. You need to ensure that you provide PHP with a full path to the hit counter file : countrerlog.txt is a relative path. c:\\Inetpub\\wwwroot\\WCBE\\countrterlog.txt is a full path. You need to do the same with the relative path to FX_DataCounter/wcbecounter.txt as well Cheers - Neil. At 13:25 20/11/2003 +, you wrote: From: Paul Ihrig [EMAIL PROTECTED] Date: Wed, 19 Nov 2003 07:16:11 -0500 Subject: works on production server but not on localhost hey guys.. just getting back in to using a little php. have 2 simple hit counters that work fine on the production server. but on my localhost it throughs several errors. looks like a permissions thing? i am not sure if there is a setting in my php.ini file that needs to be tweaked. kind of blind to the errors. looks like a permissions thing? hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12 hit counter2: 1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] works on production server but not on localhost
hey guys.. just getting back in to using a little php. have 2 simple hit counters that work fine on the production server. but on my localhost it throughs several errors. looks like a permissions thing? i am not sure if there is a setting in my php.ini file that needs to be tweaked. kind of blind to the errors. looks like a permissions thing? hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12 hit counter2: 1 Warning: fopen(FX_DataCounter/wcbecounter.txt, r+) - Permission denied in C:\Inetpub\wwwroot\WCBE\nav.php on line 19 Warning: fgets(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 20 Warning: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: fseek(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 23 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 24 Warning: fputs(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 25 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 26 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 27 any help would be great. thanks -paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] works on production server but not on localhost
ok... im on xp running iis win i tried to figure out how to change permissions on files did a few example but it never seemed to work. is there a free chmod tool? or a simple way to do it in windows? again, i am sure i sound noob, and am... thanks for the response. -paul -Original Message- From: mustafa ocak [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] works on production server but not on localhost You are probably right, it looks like a permission problem. What is the OS (win, Linux) of your machine? It's not about PHP.INI, If your operating system is Windows give write permission to the directory these text files reside. You can do it by using Internet Services Manager If it is a unix box (linux included) you can use chmod a+rw filename or chmod 771 filename to give write permission on these files to everybody. Maybe you have to give write permission to the directory too, I'm not sure about it. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:16 PM Subject: [PHP-DB] works on production server but not on localhost hey guys.. just getting back in to using a little php. have 2 simple hit counters that work fine on the production server. but on my localhost it throughs several errors. looks like a permissions thing? i am not sure if there is a setting in my php.ini file that needs to be tweaked. kind of blind to the errors. looks like a permissions thing? hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12 hit counter2: 1 Warning: fopen(FX_DataCounter/wcbecounter.txt, r+) - Permission denied in C:\Inetpub\wwwroot\WCBE\nav.php on line 19 Warning: fgets(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 20 Warning: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: fseek(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 23 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 24 Warning: fputs(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 25 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 26 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 27 any help would be great. thanks -paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] works on production server but not on localhost
already tried that read write execute scripts. no go -Original Message- From: mustafa ocak [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:54 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] works on production server but not on localhost Settings - Control Panel - Administrative Tools -Internet Services Manager Click the Default Web Site on the list, directories will be shown Right click the directory the files reside and Select Properties You can give write permission to the directory here. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:44 PM Subject: RE: [PHP-DB] works on production server but not on localhost ok... im on xp running iis win i tried to figure out how to change permissions on files did a few example but it never seemed to work. is there a free chmod tool? or a simple way to do it in windows? again, i am sure i sound noob, and am... thanks for the response. -paul -Original Message- From: mustafa ocak [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] works on production server but not on localhost You are probably right, it looks like a permission problem. What is the OS (win, Linux) of your machine? It's not about PHP.INI, If your operating system is Windows give write permission to the directory these text files reside. You can do it by using Internet Services Manager If it is a unix box (linux included) you can use chmod a+rw filename or chmod 771 filename to give write permission on these files to everybody. Maybe you have to give write permission to the directory too, I'm not sure about it. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:16 PM Subject: [PHP-DB] works on production server but not on localhost hey guys.. just getting back in to using a little php. have 2 simple hit counters that work fine on the production server. but on my localhost it throughs several errors. looks like a permissions thing? i am not sure if there is a setting in my php.ini file that needs to be tweaked. kind of blind to the errors. looks like a permissions thing? hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12 hit counter2: 1 Warning: fopen(FX_DataCounter/wcbecounter.txt, r+) - Permission denied in C:\Inetpub\wwwroot\WCBE\nav.php on line 19 Warning: fgets(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 20 Warning: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: fseek(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 23 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 24 Warning: fputs(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 25 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 26 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 27 any help would be great. thanks -paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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] works on production server but not on localhost
i don't have a security tab under properties when just browsing the directory. i only get a Directory Security tab when i am in the Internet Information Services there i have Anonymous access checked User name IUSR_BAlgh pass * Allow IIS to control password checked also Integrated Windows authentication checked. seems funky... i appreciate the help guys. -paul -Original Message- From: J.Veenhuijsen [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 8:27 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] works on production server but not on localhost Try setting security settings on directory itself eg full control for IUSR_.. to do this right click on directory -propertys- security add a user IUSR_... and give full access Works fine for me Jochem Paul Ihrig wrote: already tried that read write execute scripts. no go -Original Message- From: mustafa ocak [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:54 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] works on production server but not on localhost Settings - Control Panel - Administrative Tools -Internet Services Manager Click the Default Web Site on the list, directories will be shown Right click the directory the files reside and Select Properties You can give write permission to the directory here. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:44 PM Subject: RE: [PHP-DB] works on production server but not on localhost ok... im on xp running iis win i tried to figure out how to change permissions on files did a few example but it never seemed to work. is there a free chmod tool? or a simple way to do it in windows? again, i am sure i sound noob, and am... thanks for the response. -paul -Original Message- From: mustafa ocak [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] works on production server but not on localhost You are probably right, it looks like a permission problem. What is the OS (win, Linux) of your machine? It's not about PHP.INI, If your operating system is Windows give write permission to the directory these text files reside. You can do it by using Internet Services Manager If it is a unix box (linux included) you can use chmod a+rw filename or chmod 771 filename to give write permission on these files to everybody. Maybe you have to give write permission to the directory too, I'm not sure about it. HTH Mustafa - Original Message - From: Paul Ihrig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:16 PM Subject: [PHP-DB] works on production server but not on localhost hey guys.. just getting back in to using a little php. have 2 simple hit counters that work fine on the production server. but on my localhost it throughs several errors. looks like a permissions thing? i am not sure if there is a setting in my php.ini file that needs to be tweaked. kind of blind to the errors. looks like a permissions thing? hit counter: Warning: fopen(counterlog.txt, w) - Permission denied in C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12 hit counter2: 1 Warning: fopen(FX_DataCounter/wcbecounter.txt, r+) - Permission denied in C:\Inetpub\wwwroot\WCBE\nav.php on line 19 Warning: fgets(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 20 Warning: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\WCBE\nav.php:19) in C:\Inetpub\wwwroot\WCBE\nav.php on line 21 Warning: fseek(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 23 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 24 Warning: fputs(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 25 Warning: flock(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 26 Warning: fclose(): supplied argument is not a valid File-Handle resource in C:\Inetpub\wwwroot\WCBE\nav.php on line 27 any help would be great. thanks -paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http
RE: [PHP-DB] works on production server but not on localhost
it's ntfs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] works on production server but not on localhost :: fix
how weird is this just had to uncheck allow anonymous access. and keep checked Integrated Windows authentication just seems a bit silly... every thing works fine now. thanks for the help! will have better questions for you all in a day or so... -paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problems building PHP with Informix support
Hi Daryl, Have a look through the attached files. I use these to build PHP, Apache Informix(SE 7.25.UC6, CSDK 2.81.UC1) on a Redhat 8.0 machine. I don't use RPM but this may give you some clues on how to compile it all as I know this setup works. Compiling with Informix can be an absolute ^%$$! ;o) Regards, - Paul - - Original Message - From: Daryl Biberdorf [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 01, 2003 8:54 PM Subject: [PHP-DB] Problems building PHP with Informix support I'm trying to get PHP 4.2.2 built with Informix support, using a source RPM (SRPM) under Red Hat Linux 8.0. I have installed the database (SE; 7.25) along with the Client SDK (2.81). I have unpacked the source RPM and have added the option to the php.spec file to specify --with-informix. When I do the rpmbuild -bb php.spec command, I get the following command and error at the end of the output: /bin/sh /usr/src/redhat/BUILD/php-4.2.2/build-cgi/libtool --silent --mode=link gcc -I. -I/usr/src/redhat/BUILD/php-4.2.2/ -I/usr/src/redhat/BUILD/php-4.2.2/build-cgi/main -I/usr/src/redhat/BUILD/php-4.2.2 -I/usr/src/redhat/BUILD/php-4.2.2/build-cgi/Zend -I/usr/include/libxml2 -I/usr/include/freetype2/freetype -I/usr/include/imap -I/opt/informix/incl/esql -I/usr/include/mysql -I/usr/local/include -I/usr/include/pspell -I/usr/include/ucd-snmp -I/usr/src/redhat/BUILD/php-4.2.2/main -I/usr/src/redhat/BUILD/php-4.2.2/Z end -I/usr/src/redhat/BUILD/php-4.2.2/TSRM -DUCD_COMPATIBLE -I/usr/src/redhat/BUILD/php-4.2.2/build-cgi/TSRM -O2 -march=i386 -mcpu=i686 -fPIC -L/usr/kerberos/lib -o php -export-dynamic stub.lo libphp4.la /usr/bin/ld: cannot find -lifsql collect2: ld returned 1 exit status make[1]: *** [php] Error 1 make[1]: Leaving directory `/usr/src/redhat/BUILD/php-4.2.2/build-cgi' make: *** [all-recursive] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.43938 (%build) I have defined both INFORMIXDIR and LD_LIBRARY_PATH: [SPECS]# env | grep INFORMIXDIR INFORMIXDIR=/opt/informix [SPECS]# env | grep LD_LIBR LD_LIBRARY_PATH=/opt/informix/lib:/opt/informix/lib/esql I have added the /opt/informix/lib and /opt/informix/lib/esql directories to /etc/ld.so.conf and run ldconfig: [SPECS]# cat /etc/ld.so.conf /usr/kerberos/lib /usr/X11R6/lib /usr/lib/qt-3.0.5/lib /usr/lib/mysql /usr/lib/sane /opt/informix/lib /opt/informix/lib/esql [SPECS]# ldconfig -p | grep informix libtxa.so (libc6) = /opt/informix/lib/esql/libtxa.so libtsql.so (libc6) = /opt/informix/lib/esql/libtsql.so libtos.so (libc6) = /opt/informix/lib/esql/libtos.so libthxa.so (libc6) = /opt/informix/lib/esql/libthxa.so libthsql.so (libc6) = /opt/informix/lib/esql/libthsql.so libthos.so (libc6) = /opt/informix/lib/esql/libthos.so libthgen.so (libc6) = /opt/informix/lib/esql/libthgen.so libthasf.so (libc6) = /opt/informix/lib/libthasf.so libtgen.so (libc6) = /opt/informix/lib/esql/libtgen.so libtasf.so (libc6) = /opt/informix/lib/libtasf.so libnetstub.so (libc6) = /opt/informix/lib/libnetstub.so libixxa.so (libc6) = /opt/informix/lib/esql/libixxa.so libixsql.so (libc6) = /opt/informix/lib/esql/libixsql.so libixos.so (libc6) = /opt/informix/lib/esql/libixos.so libixglx.so (ELF) = /opt/informix/lib/esql/libixglx.so libixgls.so (ELF) = /opt/informix/lib/esql/libixgls.so libixgen.so (libc6) = /opt/informix/lib/esql/libixgen.so libixfgisql.so (libc6) = /opt/informix/lib/esql/libixfgisql.so libixasf.so (libc6) = /opt/informix/lib/libixasf.so libifxa.so (libc6) = /opt/informix/lib/esql/libifxa.so libifsql.so (libc6) = /opt/informix/lib/esql/libifsql.so libifos.so (libc6) = /opt/informix/lib/esql/libifos.so libifglx.so (ELF) = /opt/informix/lib/esql/libifglx.so libifgls.so (ELF) = /opt/informix/lib/esql/libifgls.so libifgen.so (libc6) = /opt/informix/lib/esql/libifgen.so libiffgisql.so (libc6) = /opt/informix/lib/esql/libiffgisql.so libifcss.so (libc6) = /opt/informix/lib/libifcss.so libifasf.so (libc6) = /opt/informix/lib/libifasf.so I'm stumped. Can anyone offer any solutions? Many thanks in advance. Daryl Biberdorf [EMAIL PROTECTED] -- 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] Using PHP to print using LP on Linux
Hi Guys, I suppose this isn't a database specific question, but it is the only PHP mailing list I am subscribed to. Trying to trigger a printer in the office hooked up to a Mandrake 8 box with PHP 4.3 to print a file remotely, using the 'lp' command. Uses a postscript template to create the text that needs printing. Opens and edits the postscript fine, the printer refuses to work using the last section of code however. Does anybody have experience using lp with PHP and Linux? Any help appreciated. Cheers. My Code - $filename = new_user_letter.ps; $fp = fopen($filename,r); $fdata = fread($fp, filesize($filename)); fclose($fp); //search and replace all keywords $fdata = ereg_replace(%%full_name%%,$fullname,$fdata); $fdata = ereg_replace(%%street_address%%,$streetaddress,$fdata); $fdata = ereg_replace(%%town%%,strtoupper($town),$fdata); $fdata = ereg_replace(%%state%%,strtoupper($state),$fdata); $fdata = ereg_replace(%%postcode%%,strtoupper($postcode),$fdata); $fdata = ereg_replace(%%date%%,$long_date,$fdata); $fdata = ereg_replace(%%username%%,$username,$fdata); $fdata = ereg_replace(%%email_address%%,$username . @nor.com.au,$fdata); $fdata = ereg_replace(%%password%%,$password,$fdata); $fdata = ereg_replace(%%primary_dns%%,202.147.135.10,$fdata); $fdata = ereg_replace(%%secondary_dns%%,202.147.135.20,$fdata); $fdata = ereg_replace(%%pop_location_and_ph_number%%,$location . - . $dial_in_number,$fdata); $fdata = ereg_replace(%%domain_name%%,nor.com.au,$fdata); $fdata = ereg_replace(%%pop3_server%%,mail.nor.com.au,$fdata); $fdata = ereg_replace(%%smtp_server%%,mail.nor.com.au,$fdata); $fdata = ereg_replace(%%news_server%%,news.nor.com.au,$fdata); // Open the lp command for writing and pass the postscript to it. // The loop is to allow multiple copies to be printed, for ($copy_loop=0;$copy_loop$num_copies;$copy_loop++){ $fp = popen(/usr/bin/lp -d bw_laser_raw,w); fputs($fp,$fdata,strlen($fdata)); pclose($fp); echo .; }
[PHP-DB] Problem with SQL Anywhere 5.5 and PHP ODBC
Hi everybody, i have a problem with php 4.0 an Sql Anywhere 5.5. The Webserver (Apache), the database and PHP are all installed on the same server( win 2000). PHP is using ODBC to connect to the database. This works if no other programm using the ODBC-connection ! If i start a programm that use the ODBC-connection BEFORE i access a website that use the PHP-ODBC-connection to the database and then try to load a website that use the PHP-ODBC-connection i get the following error : Warning: odbc_connect(): SQL error: [Sybase][ODBC Driver]Unable to connect to database server: database engine not running, SQL state 08001 in SQLConnect in c:\programme\apache group\apache\htdocs\umka.php on line 29 I have tried to use another OBDC datasource name but the error is the same !! Can anybody help me ? I no that this must run, because i have installed the configuration 2 years before ( wiht php3) ! Paul Ciba [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP APACHE Database
Hi everybody, i have a problem with php 4.0 an Sql Anywhere 5.5. The Webserver (Apache), the database and PHP are all installed on the same server( win 2000). PHP is using ODBC to connect to the database. This works if no other programm using the ODBC-connection ! If i start a programm that use the ODBC-connection BEFORE i access a website that use the PHP-ODBC-connection to the database and then try to load a website that use the PHP-ODBC-connection i get the following error : Warning: odbc_connect(): SQL error: [Sybase][ODBC Driver]Unable to connect to database server: database engine not running, SQL state 08001 in SQLConnect in c:\programme\apache group\apache\htdocs\umka.php on line 29 I have tried to use another OBDC datasource name but the error is the same !! Can anybody help me ? I no that this must run, because i have installed the configuration 2 years before ( wiht php3) ! Paul Ciba [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MSSQL connection seems abandoned
Using PHP 4.3.1 MSSQL 7.0 Executing a Stored Procedure through the function mssql_query that returns a message of: DELETE statement conflicted with COLUMN REFERENCE constraint... The statement has been terminated. causes the link to be unusable in executing function mssql_query again. Sql Server still shows the connection as sleeping awaiting command. Does anyone have ideas or a solution to this? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Category Listing
Hi, i'm working on the site that involves a lot ot categories and subs there of ... The way i have things now is that the structure goes one sub deep ... Ex: PHP - Database PHP - Books in the DB it looks like: id 1 name PHP parent 0 id 2 name Database parent 1 this way its easy to show dinamicaly where the user is (PHP: Database) by prividing index.php?dir=1sub=1. What i want to do, is go 3 or 4 subs deep. I just wanted to get an idea on the best posible way of doing this. Thanks Paul B. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] problems compiling with-informix
I run Informix (SE7.25.UC4 - UC5 had a major bug) on RH8.0. It wouldn't run on RH9.0 because of the glibc 2.3.x conflict. I beleive Informix only supports glibc 2.2.x. at the moment. If it's possible, use RH8.0 as I know it works. - Paul - - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 18, 2003 3:54 PM Subject: [PHP-DB] problems compiling with-informix hi, my name is matts. when trying to compile php (as cgi or module) i get the following: ./configure --with-informix=/opt/informix * make * ext/mysql/libmysql/my_tempnam.o(.text+0x40): In function `my_tempnam': /usr/src/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam' is dangerous, better use `mkstemp' /opt/informix/lib/esql/libifgls.so: undefined reference to `__ctype_b' /opt/informix/lib/esql/libifgls.so: undefined reference to `__ctype_toupper' /opt/informix/lib/esql/libifgls.so: undefined reference to `__ctype_tolower' collect2: ld returned 1 exit status make: *** [sapi/cgi/php] Error 1 i know that my_tempnam warnings are not important, but i cant figure out what is wrong with my libifgls.so I'm working in a Red Hat 9. I compiled php without informix support succefully several times. I have installed the Informix Client SDK 2.81 (I believe) I have all the environment variables ok (INFORMIXDIR, INFORMIXSERVER... ETC) I would apreciate any help thanks in advance. - This mail sent through IMP: http://mail.info.unlp.edu.ar/ -- 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] Database question
On Thu, Jul 03, 2003 at 07:00:17AM -0700, Hardik Doshi wrote: Currently i am connecting the underlying database server from every php page. To reduce the connection overhead i am thinking to store the PEAR DB object into the registry (session) at the time of user login. Here i am connecting the Database only one time and rest of the time i am using the object stored in the memory. Nice as it sounds, this won't work. I don't recall where it's documented, but at least with MySQL (and I'm assuming with the others as well), a database link identifier cannot be stored in a session variable and then re-used by another session. Check out http://www.php.net/features.persistent-connections for details. -- Paul Chvostek [EMAIL PROTECTED] it.canadahttp://www.it.ca/ Free PHP web hosting!http://www.it.ca/web/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Gnarley drop-down db problem
I have a user maintenance script. In the address maintenance page there is a drop down for the country entry. First, I retrieve the address info from a MySQL table. Globals are off, so I initialize the variables in the input with $country=$_GET['country']. In the country drop down I have option value=USA ?php if ($country == 'USA') { echo selected; } ?United States/option and so forth for each country. This works beautifully, except that changes are not saved from this and sent to the database. I have, in the validation script (an included script), an initialization of the variables as $country = $_POST['country'] for later use since it makes for shorter coding later in the routines. Can anybody help with ideas about how I can capture the change to the drop down country entry? Or, why is the original value passed instead of the new one? I suspect my need to initialize with the $_GET, but I can't figure out how to both get the value from the query string and then send the changed value in the drop down. TIA, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Gnarley drop-down db problem
Please disregard. I found an idiotic typo in my code ;-) Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Optimize following Mysql-Query
on 05/30/2003 7:49 AM, André Sannerholt at [EMAIL PROTECTED] appended the following bits to my mbox: I have the following Mysql-Query that returns correct information, but it just needs to much time (3-4 Minutes!!) Can you help me to optimize it? Since subselects are fairly new to MySQL and one of the big reasons the developers didn't want to implement them was the performance hit, I'd bet that is your problem. Looking at the query, you might be able to join the Personen table directly so you can use its fields in the WHERE clause. Something like: $query= SELECT * FROM Firmennamen INNER JOIN Master ON Firmennamen.ID=Master.FN INNER JOIN Personen ON Master.NN=Personen.ID WHERE Personen.NAME LIKE '%$name%'; Also make sure that you are indexing the fields that you are performing the joins on. HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] File input from form not detected
on 05/30/2003 9:16 AM, Dewi Wahyuni at [EMAIL PROTECTED] appended the following bits to my mbox: if($userfile) it fails. BUT $userfile_name is able to display the filename . With print_f($HTTP_POST_VARS) also the userfile was not displayed, only other input element which is Maximum file size is displayed Hi Dewi, I think you posted to the wrong list. You should probably be posting to PHP-GENERAL. Have you read through the manual page and all of the comments yet? http://www.php.net/manual/en/features.file-upload.php Some tips: - If you are using PHP 4.1 or above, you should probably be looking at the $_FILES array. - You must add an encoding type to the form - enctype=multipart/form-data HTH. Sincerely, Paul Burney http://paulburney.com/ ?php // the statement formerly known as prince if ($the_elevator == 'tries to bring you down') { go_crazy('punch a higher floor'); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] File input from form not detected
on 05/30/2003 9:16 AM, Dewi Wahyuni at [EMAIL PROTECTED] appended the following bits to my mbox: if($userfile) it fails. BUT $userfile_name is able to display the filename . I just tried the script on your site... It looks like you are trying to fopen the actual file name. You need to fopen the temp file name, i.e., $_FILES[userfile][tmp_name], usually something like /tmp/phpCcDfs. HTH. Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Optimize following Mysql-Query
Title: RE: [PHP-DB] Optimize following Mysql-Query Another large performance hit is the use of like with the wildcards. If you can avoid wildcard searches do. WHERE Personen.NAME IN ('$name'); or = $name Obviously this is only valid if the variable is going to match what is in the data exactly. - Paul -Original Message- From: Andr Sannerholt [mailto:[EMAIL PROTECTED]] Sent: Friday, May 30, 2003 6:49 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Optimize following Mysql-Query Hi Everyone, I have the following Mysql-Query that returns correct information, but it just needs to much time (3-4 Minutes!!) Can you help me to optimize it? $query= SELECT * FROM Firmennamen INNER JOIN Master ON Firmennamen.ID=Master.FN WHERE Master.FN IN (SELECT Master.FN FROM Master INNER JOIN Personen ON Master.NN=Personen.ID WHERE Personen.NAME LIKE '%$name%'); $result = mysql_query($abfrage2) or die(Anfrage results fehlgeschlagen); Regards Andre Sannerholt -- 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] Modify php.ini setting in code
on 05/27/2003 8:13 PM, Harlan Lax at [EMAIL PROTECTED] appended the following bits to my mbox: I am using a ISP that provides php and mysql but doesn't allow me to edit the php.ini. I cannot change the include path to point to a directory I have access to. Is there a way to set ini setting in a script ? See the ini_set function: http://us2.php.net/manual/en/function.ini-set.php Something like: ini_set('include_path', '/whatever/path/you/need/here:.'); One problem with relative paths is that if you want to include a file at several levels in the hierarchy, each include call needs to be different. If your web host allows you to use .htaccess files and gives you override permissions, you can put this in the .htaccess file at the top level of your server. php_value include_path '/whatever/path/you/need/here:.' Sincerely, Paul Burney -- I'm inhaling Caesar's last gasp... http://paul.burney.ws/thoughts/caesars_breath.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Session variables
on 4/6/03 10:39 PM, Alexa Kirk at [EMAIL PROTECTED] appended the following bits to my mbox: I am using session variables throughout an application, and every time I try to log in as someone else after the first time I've logged in, it uses the userid of the first person that logged in. I know the session has to be destroyed or something, so I wanted to make a logoff page, but it is not working. I'm getting an Internal Server Error. Here is my code for logoff.php: This is pretty off-topic for the PHP-DB list. It should be on PHP-General instead. If I recall correctly, the actual session files aren't deleted on the server when you call session_destroy(); They hang around until garbage collection kicks in. The user's cookie is also not deleted so they come back with the same session next time if the browser isn't quit first. One solution is to manually unset the session variables as well. I've done things like this: session_start(); session_unregister('this_password'); session_unregister('this_username'); session_unset(); session_destroy(); According to php.net, you should also do: $_SESSION = array(); Before the calls to unset and destroy. See the comments on this page for a bunch more information: http://www.php.net/manual/en/function.session-destroy.php HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle oci8
Hello, I'm sure this question has been asked, but i was wondering if anyone has successfully gotten oci8 working with php on windows? I've been trying for quite awhile with no success. thanks for any help, Paul _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] naming conventions
on 3/30/03 9:52 AM, Charles Kline at [EMAIL PROTECTED] appended the following bits to my mbox: i was just wondering if there are any naming conventions when creating database connections. most of my books use $sql = SQL STRING; and $sth = $db-query() or $result = $db-query() I have no idea what sth stands for in this case, but was curious how others name stuff. I usually just use $query or $q for query, $res or $r for result, $row or $s for the returned array, and $dbh for the database connection. I got the latter from the standard Perl database connection, dbh - Data Base Handle. If I recall correctly, the $sth also comes from the standard perl examples. The standard PHP example, from http://www.php.net/manual/en/ref.mysql.php , uses $link for the connection, $query for the query, and $line for the returned record array. A lot of database classes use $db as the new object. Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP for apache logging to mysql
on 3/28/03 7:30 AM, Ronan Chilvers at [EMAIL PROTECTED] appended the following bits to my mbox: Is this reasonably efficient on your production server ? Do you have any problems with it ? It's pretty efficient on my production server. Since I don't index the initial table, the inserts go quickly. One possible problem is that there is a MySQL process open for every apache child. We run a quad-xeon server with 1 GB of RAM so it's not an issue for us. Also, how are you dealing with growing table sizes ? Do you summarise out data to sub tables ? Or do you limit the date range and periodically dump stuff that is out of range ? Right now, I'm copying the data nightly from the live table to the archive one. MySQL tends to corrupt index files when you perform long queries (joins, grouping with conditions, etc) and other clients are trying to insert data at the same time. Without indices, the querying is pretty slow. We only keep the last month of logs in the database. The tables get huge with hundreds of thousands of records in them. We still do long term processing of standard log files with Webalizer. Part of the reason for using Perl / PHP, etc was to allow the log data to be filtered and sorted prior to inserting to the db. This would then allow automatic summarising so you could maintian host tables, request tables, etc and limit the size of the main transfer log tables. Those are good benefits. I'm sure it would be faster than working with the whole dataset. Regarding your previous post, I'd probably stick to Perl (apologies to some on this list). I know the recent CLI improvements are supposed to help a lot, but I still feel Perl plays better with the shell, especially with file IO. My approach to the queries thus far has been to keep different 'reports' (which essentially narrow down to individual SQL queries) in a db. A user picks a report, the SQL is selected and run and the data is then displayed (also playing with JPGraph to produce some nice charts). Cool. We'd love to see some of your results when they are usable. Sincerely, Paul Burney http://paulburney.com/ ?php // the statement formerly known as prince if ($the_elevator == 'tries to bring you down') { go_crazy('punch a higher floor'); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Generating view of tree?
on 3/26/03 9:18 PM, Leif K-Brooks at [EMAIL PROTECTED] appended the following bits to my mbox: I have a table with a tree. Thing is, I need to generate a view of it like: Category Sub-category Sub-sub-category Another sub-category Another category Sub-category Any way to do this, without using a huge number of queries? Using MySQL. This comes upon the list every few weeks. Check the archives for more information. Basically, in MySQL there is no way to do it without using a large number of queries if you have the traditional table layout with a record_id and a parent_id in each, so that the table relates to itself. The only suggestion I can really offer is to make sure you are indexing the parent_id as well as the record_id. In the php code, make it a little less nasty by using a function recursively, for example: ?php function list_sub_cats($p = 0) { $str = ''; $q = 'SELECT cat_id,cat_name FROM cats WHERE cat_parent=' . $p . ''; $r = mysql_query($q,$dbh); if (mysql_num_rows($r) 0) { $str .= 'ul'; while ($s = mysql_fetch_assoc($r)) { $str .= 'li' . $s['cat_name']; $str .= list_sub_cats($s['cat_id']); $str .= '/li'; } $str .= '/ul'; } return $str; } ? Calling list_sub_cats() above should return a nested unordered list in HTML of your categories (hasn't been tested, though). If you were using Oracle, you could use a CONNECT BY term in your query or write a stored procedure to give you back the tree. See this site for details: http://philip.greenspun.com/sql/trees.html If you aren't tied to that database structure, you could investigate the must faster de-normalized alternative nested set model that is often mentioned on this list: http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci537290,00.html http://www.dbmsmag.com/9605d06.html http://vyaskn.tripod.com/hierarchies_in_sql_server_databases.htm Hope that helps. Sincerely, Paul Burney http://paulburney.com/ Q: Tired of creating admin interfaces to your MySQL web applications? A: Use MySTRI instead. Version 3.1 now available. http://mystri.sourceforge.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP for apache logging to mysql
on 3/27/03 10:09 AM, Ronan Chilvers at [EMAIL PROTECTED] appended the following bits to my mbox: However I have a little problem which someone might have come across or be able to shed some light on. I want to pipe logs directly from apache into mysql. At the moment I can do this using a perl script that does this sort of thing:- Not sure if this helps you (or others on the list), but this is how I get logs into MySQL, via direct piping to the command line client, no php or perl involved: In MySQL, I have the following table setup: CREATE TABLE `access_log_archive` ( `id` int(11) NOT NULL auto_increment, `remote_ip` varchar(15) NOT NULL default '', `remote_host` varchar(255) NOT NULL default '', `remote_domain` varchar(10) NOT NULL default '', `remote_log_name` varchar(20) NOT NULL default '', `remote_user` varchar(20) NOT NULL default '', `server_name` varchar(255) NOT NULL default '', `request_uri` varchar(255) NOT NULL default '', `request_date` datetime NOT NULL default '-00-00 00:00:00', `request_status` int(11) NOT NULL default '0', `request_bytes_sent` int(11) NOT NULL default '0', `request_content_type` varchar(50) NOT NULL default '', `request_referer` varchar(255) NOT NULL default '', `request_user_agent` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), ) TYPE=MyISAM COMMENT='Apache Logging Table' In the httpd.conf file, I have the following log format line: LogFormat INSERT INTO access_log (remote_ip,remote_log_name,remote_user,server_name,request_uri,request_date, request_status,request_bytes_sent,request_content_type,request_referer,reque st_user_agent) VALUES ('%a','%l','%u','%v','%U%q','%{%Y%m%d%H%M%S}t',%s,'%B','%{Content-Type}o',' %{Referer}i','%{User-Agent}i'); mysql On my devel machine, I just use one log for all vhosts, so I have CustomLog |mysql -u apache -p{PASSWORD REMOVED} apache mysql CustomLog /private/var/log/httpd/access_log combined On a production server with separate logs, I have the CustomLog command in each vhost. You still need to log to a file as well, just in case the MySQL server isn't available. Apache doesn't like it when it can't write it's log files. Bad things might happen. Using the above, apache seamlessly logs the request data to the MySQL table. I'm currently working on a nice front end query tool. Any query help would be welcome. :-) This gives the top servers in order of hits: select count(*) as hits,server_name from access_log_archive group by server_name order by hits desc; Note: If your server is busy, you should query from another mirrored table that isn't being accessed all the time. If not, you get index corruption that shows up in things like this: ERROR 1030: Got error 127 from table handler You could also add indexes for that table to speed up queries and setup a script to automatically migrate from one table to the other, etc. Hope that helps. YMMV. TMTOWTDI. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql timestamps
how do i change the format of a MySQL timestamp (i.e hh:mm:ss DD/MM/ instead of MMDDhhmmss) retrieved from a mysql database with php? thanks in advance -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Gathering data from a database
on 3/22/03 8:26 PM, Mike Delorme at [EMAIL PROTECTED] appended the following bits to my mbox: $select = mysql_select_db ($database); Remove the quotes around this. Actually, there is no reason to do the variable assignment either. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: deleting records using a checkbox
on 3/20/03 1:45 AM, olinux at [EMAIL PROTECTED] appended the following bits to my mbox: [ and ] are illegal characters. #javascript I'm coming into this a bit late, so I'm not sure exactly what you wish to do. You can use JavaScript to refer to checkbox items in the format: document.forms[formindex].elements[elementindex].property In my MySTRI database table administration program, I have an x button that allows you to select all displayed rows to mark for deletion. The button looks like: input type=button title=Check/Uncheck All value= X onclick= for (var q = 0; q document.forms[1].length; q++) { document.forms[1].elements[q].checked = !document.forms[1].elements[q].checked; } The checkbox fields look like: input type=checkbox name=delete_rows[] value=25679 Not as easy as referring to the name element, but it works very well. Another idea is to use id elements for JavaScript / DOM interaction and reserve the name elements for php. That should work on any modern browser (sorry, no Netscape 4.x). HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_connect() problem
Hi, I am using Apache 2 in Linux 8 .Whenever in my php script I want to connect to mysql through mysql_connect() function a error occured. My script is like that $linlid=mysql_connect(localhost,user1,user1)or die(Connections failed); print Connected successfully; The script writes this. % Fatal error: Call to undefined function: mysql_connect() Please help me.I have installed Apache and php through RPM. Anybody can help me. Indrajit _ Get more buddies in your list. Win prizes http://messenger.msn.co.in/promo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Real Killer App!
on 3/15/03 7:55 PM, Nicholas Fitzgerald at [EMAIL PROTECTED] appended the following bits to my mbox: Spider still dies, but now it's finally given me an error: FATAL: erealloc(): unable to allocate 11 bytes. This is interesting, as I'm not using erealloc() anywhere in the script. When I went to php.net to check it out, all I got was a memory management page with this and some other memory type functions listed. Those are functions used by the actual PHP developers to communicate with the Zend engine (which itself communicates with the OS/CPU). You don't call those functions and can't affect them. This sounds like a very obscure bug with PHP on windows. I can't remember if you are running the latest version of PHP (4.3.1 or 4.3.2 RC 1). If not, please try it using that version of PHP to see if you can still reproduce the problem. If so, please file a bug report at http://bugs.php.net/ A quick search didn't pull up anything related to your issue. The only recent entry related to erealloc is for 4.2.3 on Windows: http://bugs.php.net/bug.php?id=20913 But it doesn't necessarily seem applicable. Unless you're running out of memory? Or maybe the server can't handle all the connections? If so, you could try sleeping for a second every 10 times through the loop, etc, to slow down the process and maybe keep it from dying. Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php if ($your_php_version 4.1.2) { upgrade_now(); // to avoid major security problems } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Real Killer App!
on 3/12/03 5:45 PM, Nicholas Fitzgerald at [EMAIL PROTECTED] appended the following bits to my mbox: is that entire prog as it now exists. Notice I have NOT configured it as yet to into the next level. I did this on purpose so I wouldn't have to kill it in the middle of operation and potencially scew stuff up. They way it is now, it looks at all the records in the database, updates them if necessary, then extracts all the links and puts them into the database for crawling on the next run through. Once I get this working I'll put a big loop in it so it keeps going until there's nothing left to look at. Meanwhile, if anyone sees anything in here that could be the cause of this problem please let me know! I don't think I've found the problem, but I thought I'd point out a couple things: // Open the database and start looking at URLs $sql = mysql_query(SELECT * FROM search); while($rslt = mysql_fetch_array($sql)){ $url = $rslt[url]; The above line gets all the data from the table and then starts looping through... // Put the stuff in the search database $puts = mysql_query(SELECT * FROM search WHERE url='$url'); $site = mysql_fetch_array($puts); $nurl = $site[url]; $ncrc = $site[checksum]; $ndate = $site[date]; if($ndate = $daycheck || $ncrc != $checksum){ That line does the same query again for this particular URL to set variables in the $site array, though you already have this info in the $rslt array. You could potentially save hundreds of queries there. // Get the page title $temp = stristr($read,title); snip $tchn = ($tend - $tpos); $title = strip_tags(substr($read, ($tpos+7),$tchn)); Aside: Interesting way of doing things. I usually just preg_match these things, but I like this too. // Kill any trailing slashes if(substr($link,(strlen($link)-1)) == /){ $link = substr($link,0,(strlen($link)-1)); } Why are you killing the trailing slashes? That's going to cause fopen double the work to get to the pages. That is, first it will request the page without the slash, then get a redirect response with the slash, and then request the page again. // Put the new URL in the search database $chk = mysql_query(SELECT * FROM search WHERE url = '$link'); $curec = mysql_fetch_array($chk); if(!$curec){ echo Adding: $link\n; $putup = mysql_query(INSERT INTO search SET url='$link'); } else{ continue; } You might want to give a different variable name to the new link, or encapsulate the above in a function, so your $link variables don't clobber each other. indicate where the chokepoint might be. It seems to be when the DB reaches a certain size, but 300 or so records should be a piece of cake for it. As far as the debug backtrace, there really isn't anything there that stands out. It's not an issue with a variable, something is going wrong in the execution either of php, or a sql query. I'm not finding any errors in the mysql error log, or anywhere else. What url is it dieing on? You could probably echo each $url to the terminal to watch it's progression and see where it is stopping. I've had problems with apache using custom php error docs where the error doc contained a php generated image that wasn't found. Each image that failed would generate another PHP error which cascaded until the server basically died. KIND OF BROADER ASIDE REGARDING SEARCH ENGINE PROBLEMS: I've also had recursion problems because php allows any characters to be appended after the request. For example, let's say you have an examples.php file and for some reason you have a relative link in examples.php to examples/somefile.html. If the examples directory doesn't exist, apache will serve examples.php to the user using the request of examples/somefile.html. A recursive search engine (that isn't too smart, i.e., infoseek and excite for colleges), will keep requesting things like: http://example.com/examples/examples/examples/examples/examples/examples/exa mples/examples/examples/examples/examples/examples/examples/examples/example s/examples/examples/examples/examples/examples/examples/examples/examples/ex amples/examples/examples/examples/examples/examples/examples/examples/exampl es/examples/examples/examples/examples/examples/examples/examples/examples/e xamples/examples/somefile.html As far as apache is concerned, it is fulfilling the request with the examples.php file and php just sees a really long query_string starting with /examples. I'm sure that isn't your problem, but I've been bit by it a few times. END OF ASIDE Hope some of that ramble helps. Please try to see if it is dieing on a particular URL so we can be of further assistance. Sincerely, Paul Burney http://paulburney.com/ Q: Tired of creating admin interfaces to your MySQL web applications? A: Use MySTRI instead. Version 3.1 now available. http://mystri.sourceforge.net
Re: [PHP-DB] receiving date elements from Access
on 3/9/03 4:42 PM, Jan Bro at [EMAIL PROTECTED] appended the following bits to my mbox: $datum_beginn=2002-12-12; $datensatz=odbc_exec($db_connection,select * from Termin where Datumsfeld'#$datum_beginn#'); I get an error message that data in criteria doesn't match. (free translation) The field Datumsfeld is a date field with the syntax DD.MM. (German way) Maybe you should try the date in the syntax the database uses, i.e., 12.12.2002? Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] explode string variable
on 3/8/03 10:40 AM, André Sannerholt at [EMAIL PROTECTED] appended the following bits to my mbox: Does anybody know how to stop an explosion of a string: Let me explain: I want the variable to be devided in only two other ones! If for example: $variable=Willy-Brandt-Platz-5 I want to have an array that looks like this: $variable_array[0] should be Willy $variable_array[1] should be Brandt-Platz Wrong list since doesn't involve databases. Should be on PHP-General. That said, use strtok: http://www.php.net/manual/en/function.strtok.php Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] file save part 2
on 3/8/03 6:13 PM, Ryan Holowaychuk at [EMAIL PROTECTED] appended the following bits to my mbox: I have tried a few things and I can get the file to have each line on its own line. FYI, this is probably on the wrong list since it isn't database related. You should post to PHP-GENERAL to get more responses. What do you mean by 'line'? Do you mean each piece of data, i.e., (no, name, grade)? If so, you need to implode using the the newline. If you are accepting multiple entries to the file, change the mode from w to a to append new data. $file_data = implode(\r\n, $_POST); If that doesn't help, send an example of what you want the data to look like. Sincerely, Paul Burney -- I'm inhaling Caesar's last gasp... http://paul.burney.ws/thoughts/caesars_breath.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating MySQL Entry Forms
on 3/1/03 2:00 PM, Jeremy N.E. Proffitt at [EMAIL PROTECTED] appended the following bits to my mbox: What's wrong with PhpMyAdmin? It has to be HTML based, it can't install on the server. Well, you can't administer MySQL with HTML pages. You need PHP pages that generate HTML pages. PHPMyAdmin is just a collection of PHP pages that talk to MySQL. It doesn't require any special installation. See: http://phpmyadmin.sf.net for more information. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function: mysql_pconnect()
on 3/1/03 12:16 AM, Cameron at [EMAIL PROTECTED] appended the following bits to my mbox: I'm new to this stuff, so you have to excuse me if I seem dense. I can't get MySQL base operation from PHP 4.22 under RedHat Linux 8.0. I get the following error when trying to use mysql_connect(). Call to undefined function: mysql_pconnect() You need to install the php-MySQL RPM file from the Red Hat CD. The default install doesn't give you MySQL support. HTH. Sincerely, Paul Burney -- I'm inhaling Caesar's last gasp... http://paul.burney.ws/thoughts/caesars_breath.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Screen size, browser on php
on 2/27/03 11:09 PM, Petre NICOARA at [EMAIL PROTECTED] appended the following bits to my mbox: I've found this stuff into a javascript, but I need to be able to retrieve it through php, only in one file. The javascript is doing this through 2 file, one get the info, and passes it to a form in the other. So, my dilemma is if Is there a way of getting from php the screen size? No. What you could do, however, is something like: - JavaScript code to get screen size - use document.write to generate the image tag with additional parameters for screen size, i.e.: img src=somescript.php?w=615h=420 - Have your php script output the correct Content-type header for the image and pass it through while logging the info you want. HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Making Join
on 2/28/03 3:15 PM, Daniel Harik at [EMAIL PROTECTED] appended the following bits to my mbox: Thank You for your reply, but the problem is that users may have many photos, and i need to get only one, i use folllowing sql: SELECT users.username, photos.file FROM users left join photos on users.id=photos.userid And i get: username file dan 9a2de085e456e78ed66f079572638ff3.jpg dan 852d28e6fa730f6d29d69aacd1059ae7.jpg dan 672df2f16e89e3dc92ff74e3a0fa4b4f.jpg dan 8bae6f20ed6e12ba1c86d04b8ebc9e1f.jpg dan 7de9d2db2b2096cfc3f072f8c15a9e50.jpg 404 f474a8ee5965f0a792e5b626fb30c2cd.jpg 404 3acd391cf7abafa032c5e3b21eb7b322.jpg 404 4e5df8cfa4bce5dd30c1166b8a86fa23.jpg Bedman NULL but i want only 3 users from this join, not 3x3=9 So you just want the users who have pictures, but not all the pictures for each? Something like: SELECT count(*) AS num_photos, username FROM photos LEFT JOIN users ON photos.userid=users.id GROUP BY userid You could add the file field in there as well, but it would only be returning one of the files (the first or last one for that user, but I don't know of a way for you to be specific). Hope that helps. Sincerely, Paul Burney http://paulburney.com/ Q: Tired of creating admin interfaces to your MySQL web applications? A: Use MySTRI instead. Version 3.1 now available. http://mystri.sourceforge.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php