Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1
Hi Chris, Thanks for your response. Is there any way to find out which files are in 32 bit or 64 bit? Regards, Niranjan --- On Thu, 3/5/09, chris smith dmag...@gmail.com wrote: From: chris smith dmag...@gmail.com Subject: Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1 To: niranjan_...@yahoo.com Cc: php-db@lists.php.net Date: Thursday, March 5, 2009, 2:17 PM Do you mean i am using 32bit PHP libraries? If so could you please let me know where to download 64bit PHP libraries. I tried over the net but i couldn't get it. No, I meant this: ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class: ELFCLASS64 ld: fatal: file ext/libxml/.libs/libxml.o: wrong ELF class: ELFCLASS32 You can't (as far as I know) have some libraries that are 64 bit and others that are 32. It's either all 64, or all 32. Your operating system should install one type or the other. -- Postgresql php tutorials http://www.designmagick.com/
Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1
Hi Chris, Thanks for your response. Do you mean i am using 32bit PHP libraries? If so could you please let me know where to download 64bit PHP libraries. I tried over the net but i couldn't get it. Regards, Niranjan --- On Thu, 3/5/09, Chris dmag...@gmail.com wrote: From: Chris dmag...@gmail.com Subject: Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1 To: niranjan_...@yahoo.com Cc: php-db@lists.php.net Date: Thursday, March 5, 2009, 3:01 AM niranjan k wrote: Hi Chris, Thanks for the response. 1. I ran php configuration as below. $./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/apps/mysql/mysql It went fine. Chris Are you sure? Yes it went fine. 2. While running make, i got following relink error. ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class: ELFCLASS64 Chris Look at the path of the file it picked up - it found one in a completely different location. The path it has taken /usr/local/mysql/... There is a soft link to /usr/local/mysql which points to /apps/mysql/mysql and we're supposed to guess that? ;) I guess you can't build 64 bit binaries with 32 bit libraries. The php-install list may have better suggestions but as far as I know you either have to use 64 bit (including libraries) or 32 bit - you can't mix match. -- Postgresql php tutorials http://www.designmagick.com/
[PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1
Hi, I installed 64 bit MySQL-5.3.1 and i am in the process of installing php-5.2.8. While configuring php with mysql, getting following issues. Issue: 1. I ran php configuration as below. $./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/apps/mysql/mysql It went fine. 2. While running make, i got following relink error. ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class: ELFCLASS64 ld: fatal: File processing errors. No output written to .libs/libphp5.so collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `libphp5.la' I tried exporting CFLAGS as export CFLAGS=$CFLAGS -m64 so that gcc will use 64 bit. But i got following error at the time of make. ld: fatal: file ext/libxml/.libs/libxml.o: wrong ELF class: ELFCLASS32 ld: fatal: File processing errors. No output written to .libs/libphp5.so collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `libphp5.la' I am not able to proceed with the installation of PHP due to above errors. I would appreciate if any one can help me in resolving the issue. Please let me know if you need more details in solving the issue. Regards, Niranjan
Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1
Hi Chris, Thanks for the response. 1. I ran php configuration as below. $./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/apps/mysql/mysql It went fine. Chris Are you sure? Yes it went fine. 2. While running make, i got following relink error. ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class: ELFCLASS64 Chris Look at the path of the file it picked up - it found one in a completely different location.The path it has taken /usr/local/mysql/... There is a soft link to /usr/local/mysql which points to /apps/mysql/mysql Regards, Niranjan --- On Wed, 3/4/09, chris smith dmag...@gmail.com wrote: From: chris smith dmag...@gmail.com Subject: Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1 To: niranjan_...@yahoo.com Cc: php-db@lists.php.net Date: Wednesday, March 4, 2009, 12:16 PM 1. I ran php configuration as below. $./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/apps/mysql/mysql It went fine. Are you sure? 2. While running make, i got following relink error. ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class: ELFCLASS64 Look at the path of the file it picked up - it found one in a completely different location. -- Postgresql php tutorials http://www.designmagick.com/
Re: [PHP-DB] basic form entry
mysql_query (INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES ('$first_name','$last','$phone,'$mobile','$email','$web') ); echo('$username','$last') This doesn't work. You need to make a variable for the executed query, like, $query = mysql_query(.); After that, you get $query. But this is not the data you want. You can `echo` $query if you want to. What you get there is called resource id. So, you need to extract the data using mysql_fetch_something. Look up mysql_fetch_array or mysql_fetch_assoc for that infomation. You might wanna recheck mysql_query to know what you are really doing. On 10/7/07, sm [EMAIL PROTECTED] wrote: I have been racking my brains trying to figure out what I am doing wrong. i have created a basic form that calls requests user information...the form then runs insert.php. No errors are returned, however, my database does not update. Any suggestions? thanks The field names in the table are correct (case). SUBMIT.HTML: form action=insert.php method=post First Name: input type=text name=firstbr Last Name: input type=text name=lastbr Phone: input type=text name=phonebr Mobile: input type=text name=mobilebr E-mail: input type=text name=emailbr Web: input type=text name=webbr input type=Submit value=click para enviar /form INSERT.PHP ? php echohello $username = guest; $psswd = password; $db = contacts; $host = localhost; $first_name = $_POST['first']; $last = $_POST['last']; $phone = $_POST['phone']; $mobile = $_POST['mobile']; $email = $_POST['email']; $web = $_POST['web']; mysql_connect($host,$username,$psswd) or die (errror in access db); mysql_select_db($db); mysql_query (INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES ('$first_name','$last','$phone,'$mobile','$email','$web') ); echo('$username','$last') echo mysql_error(mysql_connect($host,$username,$psswd)); ? -- 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] Prevention for multiple submissions from the same form
Hi, I have a form with a button, which adds user inputted data into database. I've been looking for a way to prevent users from pressing the same button twice mistakingly. I've learned that this is possible to make and send a unique id in hidden input, and check if the id is used before database query is issued. (PHP Cookbook [O'reilly]). But, is there a way to make this happen without using database? It would cool if I could only use HTML/JavaScript/CSS. Tek. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Prevention for multiple submissions from the same form
Thank you for answering my question. Can anybody explain a simple JavaScript only solution? I haven't used JavaScript except for some copy-and-paste jobs. Tek -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Preparing SQL insert statements from CSV files
Hi, I have to parse csv files and put them into database. I was able to parse the files by fgetcsv() and made an HTML table. But, when it comes to parse more closely and make INSERT INTO statement, then I'm having problems with, probably for-loop. For example, how do you do this task with the simple csv file shown at https://admin.easymail.rmplc.co.uk/admin_help/csv.htm . T -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP4 and Constructor
Hi, I would like to use constructor in PHP4, but how do you make a constructor? In PHP5, I do like class ClassName { function __construct() { } } But PHP4 doesn't have such a thing as __construct()... Reading the official manual didn't make me understood. Does this mean the very first `function` in class is always the constructor for the Class? Tek -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP4 and Constructor
Thanks guys! I got the same name trick for PHP 4 class constructor. All the best, T -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Looking for a small open-source PHP-DB app that utilize OOP.
Thanks all. Looks like some tutorials and the survey system look a very good start to me. Especially the code of UCCASS looks very readable. Thanks a bunch.
[PHP-DB] Looking for a small open-source PHP-DB app that utilize OOP.
Hi, For a study purpose, I'm looking for a small open source program that works in PHP-MySQL. In particular, I would like to see some examples with PHP 5 and Object-Oriented Programming (such as class, objects, and so on). I'm looking for a small program, possibly like blog, wiki, forum and so on. I've downloaded several programs, but most of them don't use classes/objects. I'm using PHP without OOP, but recently set out to learn OOP. Any suggestions would be appreciated. Tek
[PHP-DB] strange mysqli error
Good afternoon. I'm getting a weird mysqli error in my object destructor. Here's an example: ?php $db = new mysqli('localhost', USERNAME, PASSWORD, DATABASE); class Test { function __construct() { global $db; $db-query(SELECT 'test'); print_r($db-error); } function __destruct() { global $db; $db-query(SELECT 'test'); // line 20 print_r($db-error); // line 21 } } $test = new Test(); ? A. On my dev machine (Mac OS X + PHP 5.1.4 + MySQL 5.0.19) I get the following errors EVERY time: Warning: mysqli::query() [function.mysqli-query]: Couldn't fetch mysqli in /Users/richard/Projects/data/private/mgftest.php on line 20 Warning: Test::__destruct() [function.Test---destruct]: Couldn't fetch mysqli in /Users/richard/Projects/data/private/mgftest.php on line 21 B. On my production server (FreeBSD + PHP 5.1.2 + MySQL 5.0.19) I SOMETIMES get the following error: (If I refresh the page repeatedly, sometimes there's an error, sometimes not.) Warning: mysqli::query() [function.query]: Couldn't fetch mysqli in / usr/local/www/data/private/mgftest.php on line 20 C. On a commercial web host (PHP 5.0.4 + MySQL 5.0.22) I NEVER get any errors. There's nothing else in my error logs, $db-errno is 0, and $db-error is empty. Interestingly, I never get any errors from the constructor. Any ideas? Richard --- Richard K. Miller www.richardkmiller.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] database connectivity problem
Thanks Martin... You were right... I had to make Apache run as sybase (gasp!) for it to work really funky but it works... -Original Message- From: Martin Norland [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 01, 2005 3:53 PM To: 'php-db@lists.php.net' Cc: 'php-db@lists.php.net' Subject: Re: [PHP-DB] database connectivity problem Adams, Jonathan K. [C] wrote: Here is the error: Warning: sybase_connect() [function.sybase-connect]: Sybase: Unable to allocate connection record My configuration - The database is Sybase ASE 12.0 running on Solaris 8 The webserver is Apache 1.3.33 with PHP 5 running Solaris 9 The sybase libraries are shared via NFS, which is how I built the apache Well, that error certainly doesn't look like it can't see the libraries - it looks more like it can't write somewhere. Are you sure there is sufficient memory for the script [perhaps increase memory_limit in php.ini], and that wherever php might need to store the connection record externally (if applicable) is writable? Unfortunately - you may not be alone: http://bugs.php.net/bug.php?id=30721 http://bugs.php.net/bug.php?id=17489 Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- 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: Double Inserts
Hi Shri, [EMAIL PROTECTED] (PHPDiscuss - PHP Newsgroups and mailing lists) writes: Hi, I am new to the mailing list and to PHP / MySQL. I am facing an unususal problem. I am trying to insert some data into MySQL DB through via Web. The code is executed OK - no errors but the same record gets inserted TWICE. I have checked the code and simplified it as much as possible and tried test scripts with same results. I have also tried statements to echo messages to ensure the code is not executed twice. It happens with IE as wells as Mozilla so I don't think it is a browser issue. The only clue is that it does not seem to happen on a slower machine (Laptop). The configurations, versions etc are identical - Apache 2.0.49, MySQL 4.1.6-gamma-nt, PHP 5.0.2 Has anyone faced this and found a solution? Please help. Shri I had a similar problem. It was unrelated to PHP or MySQL. Are you using javascript as part of the page? In particular, attaching an event handler to onSubmit event? I had an onSubmit event handler that called this.submit() as part of the routine. I didn't realize that caused the submit to happen twice. The double insert has vanished since. See if your page is getting posted twice for whatever reason. -Peter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php database connectivity issues
Here is the error: Warning: sybase_connect() [function.sybase-connect]: Sybase: Unable to allocate connection record My configuration - The database is Sybase ASE 12.0 running on Solaris 8 The webserver is Apache 1.3.33 with PHP 5 running Solaris 9 The sybase libraries are shared via NFS, which is how I built the apache Inside the httpd.conf file I have set several SetEnv tabs to set OCS, ASE, FTS, SYBASE to their proper paths... php_info() confirms this is working I can run isql from this box and connect to the desired database manually... if I set the environment I have seen this errror posted in alot of places, but I do not see anything approaching a solution Could it be because I am sharing the sybase libraries via NFS? I have seen this problem posted from people who have the sybase client installed on their webserver too though... any help would be appreciated because I have pretty much hit a wall here... and I am sure that there must be a way to make this work short of installing apache/php on the same box as the database, which is absolutely not an option... Thanks --J ___ Jon Adams -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] database connectivity problem
Here is the error: Warning: sybase_connect() [function.sybase-connect]: Sybase: Unable to allocate connection record My configuration - The database is Sybase ASE 12.0 running on Solaris 8 The webserver is Apache 1.3.33 with PHP 5 running Solaris 9 The sybase libraries are shared via NFS, which is how I built the apache Inside the httpd.conf file I have set several SetEnv tabs to set OCS, ASE, FTS, SYBASE to their proper paths... php_info() confirms this is working I can run isql from this box and connect to the desired database manually... if I set the environment I have seen this errror posted in alot of places, but I do not see anything approaching a solution Could it be because I am sharing the sybase libraries via NFS? I have seen this problem posted from people who have the sybase client installed on their webserver too though... any help would be appreciated because I have pretty much hit a wall here... and I am sure that there must be a way to make this work short of installing apache/php on the same box as the database, which is absolutely not an option... Thanks --J ___ Jon Adams Unix Web Engr. NGA Gateway Services [EMAIL PROTECTED] [EMAIL PROTECTED] Tel: 202-284-4543 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP + SSL + LDAP + IPLANET
Greetings, (That Iplanet word must have peaked your interest...riight...) OS: Solaris 9 CC: GCC 3.2.2 APP: Sun ONE Web Server 6.2SP2 LDAP: Sun ONE Directory Server 5.2 (configured for SSL and confirmed with non-php apps) Configured PHP 4.3.8/or 5.1 with openssl, openldap, libxml, zlib using GCC 3.2.2 (all latest stable versions). Created and installed the certificates. Verified using openssl programs and ldapsearch utils. I have a *few* questions a) Internet research to get ldaps working with PHP tells me that I have to setup a HOME environment variable for the Web Server User and dump a .ldaprc file in there, in addition to specifying option in the ldap.conf file. I did that in the magnus.conf file using init-cgi directive. The Env Variable is visible to all the cgi programs. HOWEVER, the phpinfo() command does not pick up that (and all of my other user Environment variables such as ORACLE_HOME etc) and hence does not see that file. phpinfo() keeps reporting that the user is root (I don't want that!). The Web Server runs as a non-root user. What gives ? I read some docs but they are not clear on how to pass these env variables.. Q: How can I make vendor/custom environment variables available for PHP running in IPLANET server ? b) I added the following lines to my /usr/local/openldap/etc/openldap/ldap.conf file # Instruct client to NOT request a server's cert. TLS_REQCERT never # Define location of CA Cert TLS_CACERT /usr/local/ssl/certs/AD_CA_CERT.pem TLS_CACERTDIR /usr/local/ssl/certs #--end-- The ldapsearch util works good and makes SSL connection to the ldap server (using ldapsearch -H ldaps://server.tigr.org) To test PHP's ability, I am using the connect_AD function from the PHP man page (replicated below) function connect_AD() { $ldap_server = ldaps://adserver.ad.com ; $ldap_user = CN=web service account,OU=Service Accounts,DC=ad,DC=com ; $ldap_pass = password ; $ad = ldap_connect($ldap_server) ; ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3) ; $bound = ldap_bind($ad, $ldap_user, $ldap_pass); return $ad ; } BUT the above function does not work. It just hangs at the ldap_connect stage. No output on snoop also (tcpdump for solaris). However, when I tried to specifiy ldap_connect (server, 636), it get's past that point but hangs at ldap_bind. I have a feeling that PHP under IPLANET is just not able to pick up the installed certificates. May be connected to the fact that I can't get it retrieve my environment variables specified in the server ... ? Any pointers ? please ? I will summarize once i find a solution. many many tia rajeev
RE: [PHP-DB] PHP + SSL + LDAP + IPLANET
OK - just got a bit crazier! That function works when running on the command line. As the root user, as the webserver user and ANY user who can run the php command (truss on php shows that it IS reading the ldap.conf file from /usr/local/openldap/etc) But why does it not work from the Web Server ?! rajeev -Original Message- From: Karamchedu, Rajeev K. [mailto:[EMAIL PROTECTED] Sent: Sun 9/19/2004 6:26 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP + SSL + LDAP + IPLANET Greetings, (That Iplanet word must have peaked your interest...riight...) OS: Solaris 9 CC: GCC 3.2.2 APP: Sun ONE Web Server 6.2SP2 LDAP: Sun ONE Directory Server 5.2 (configured for SSL and confirmed with non-php apps) Configured PHP 4.3.8/or 5.1 with openssl, openldap, libxml, zlib using GCC 3.2.2 (all latest stable versions). Created and installed the certificates. Verified using openssl programs and ldapsearch utils. I have a *few* questions a) Internet research to get ldaps working with PHP tells me that I have to setup a HOME environment variable for the Web Server User and dump a .ldaprc file in there, in addition to specifying option in the ldap.conf file. I did that in the magnus.conf file using init-cgi directive. The Env Variable is visible to all the cgi programs. HOWEVER, the phpinfo() command does not pick up that (and all of my other user Environment variables such as ORACLE_HOME etc) and hence does not see that file. phpinfo() keeps reporting that the user is root (I don't want that!). The Web Server runs as a non-root user. What gives ? I read some docs but they are not clear on how to pass these env variables.. Q: How can I make vendor/custom environment variables available for PHP running in IPLANET server ? b) I added the following lines to my /usr/local/openldap/etc/openldap/ldap.conf file # Instruct client to NOT request a server's cert. TLS_REQCERT never # Define location of CA Cert TLS_CACERT /usr/local/ssl/certs/AD_CA_CERT.pem TLS_CACERTDIR /usr/local/ssl/certs #--end-- The ldapsearch util works good and makes SSL connection to the ldap server (using ldapsearch -H ldaps://server.tigr.org) To test PHP's ability, I am using the connect_AD function from the PHP man page (replicated below) function connect_AD() { $ldap_server = ldaps://adserver.ad.com ; $ldap_user = CN=web service account,OU=Service Accounts,DC=ad,DC=com ; $ldap_pass = password ; $ad = ldap_connect($ldap_server) ; ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3) ; $bound = ldap_bind($ad, $ldap_user, $ldap_pass); return $ad ; } BUT the above function does not work. It just hangs at the ldap_connect stage. No output on snoop also (tcpdump for solaris). However, when I tried to specifiy ldap_connect (server, 636), it get's past that point but hangs at ldap_bind. I have a feeling that PHP under IPLANET is just not able to pick up the installed certificates. May be connected to the fact that I can't get it retrieve my environment variables specified in the server ... ? Any pointers ? please ? I will summarize once i find a solution. many many tia rajeev
[PHP-DB] Accessing MS SQL from Linux
My domain is hosting through a hosting company on Linux with PHP 4.3.4. Hosting company is not open to re-compile PHP for using FreeTDS or any other application. If I can not use FreeTDS, what other options do I have? a) Can Pear be used? It is 4.3.4. I tried ?php required_once(DB.php) ? but got error. b) Can ADODB be used without re-compiling PHP? Any other option? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] transaction locking
Thanks Miles and John for you answers... Yes I am using MySQL. I think I can work it to use the dB to generate these. I ran into The problem originally because this dB was taking up where a different Tool was ending and I needed to start with a specific number scheme. Here Is a though... If I have a field in MySQL that had numbers already populated Along with an auto incremental column... Can I remove this auto column and Change the properties of the already populated column to auto generate? Will It accept the numbers already there or will I have to start from scratch? In other words I know that in the dB if you setup a new table and set a column\ To auto increment, it starts a the number 1. Can this be set to a higher number Say 5454 ?? TIA Aleks -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 8:24 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] transaction locking Aleks, Many programmers learned the hard way that the scheme you are proposing did not work when they went from a single user to a networked environment. You've not said what database you are using. If MySQL you can let it's autoincrement increase your key automatically, perhaps feed it back as confirmation of completion. Using this you will not get duplicates as the insert is unique per connection. Check the MySQL docs for the last insert id. Try this - it works and takes a load off your code. Alternately, if you want to use your own scheme, establish a lookup table with two fields: keyvalue and tablename. Write a function that with the table name as a parameter, locks the table, retrieves the keyvalue, adds one to it, updates and exits. You will have to test for locks, you may end up with gaps in your key numbers. If possible, let the database do the work for you. Regards - Miles Thompson At 06:11 AM 12/5/2003 -0700, Aleks Kalynovych wrote: Good morning all, I have a couple forms that generate a unique ID based on taking the highest number in the ID column adding 1 to its value. The problem is that I don’t save that number until the form is submitted. If 2 or more persons fill out the form at the same time they all get the same ID number. I hope that there are some suggestions on how to accomplish this with a better method TIA for your help Aleks -- 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] in-line function?
Donny Lee wrote: Ohhh.. sorry for that. it's quite simple, i'm wondering if we can have something like those in-line functions in C++: class someCLASS { var $varLength; // other stuff inline function length() { return $this-varLength; } } i expect it will make PHP script speed up a bit, coding easier, etc... but not sure it will do or not. :) What would be the difference (besides putting the word inline in front of the function)? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Auto inc in MySQL
Stan Lemon wrote: Also, I believe in addition to AUTO_INCREMENT it has to be UNIQUE as well. Please correct me if I am wrong. No, just INDEX. UNIQUE will work fine, but I reccomend making it PRIMARY. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] hmmm
Becoming Digital wrote: We have found the only case when banning someone from the list for foul language would be completely undesirable. Making it so he really can't unsubscribe, on the other hand, would be very desirable. Are you listening, admins? :-) -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Altering a column in an existing table
Rick Dahl wrote: I have a column (ID) that is currently not auto_incremental. I need to change it so that it is auto_incremental. There are already records in this column. also, I need to change the field type from int(4) to int(8). Rick 1) This has nothing to do with PHP. 2) This will most likely require an ALTER query. 3) Read your DB's manual. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] T_String?
The little detail is the lack of quotes around your query. Jorge L. wrote: I am getting the following error: Parse error: parse error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\view.php on line 4 On line: $result = mysql_query(select * from guestbook) or die (mysql_error()); And I have no idea where the T_STRING is coming from. I know this is probably some little detail that I am over looking, but I would appreciate any help. _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] strip
Don't. addslashes() instead. Chris Mach wrote: does anyone know how to strip a ' from a string? It's causing errors for my sql statements -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] query string
To answer your question, you should urlencode() the team name. However, I would store the user in a cookie or session, and fetch the team name on each page load. Otherwise, they can easily change which team they're using. Ian Fingold wrote: Sorry I don't think I explained very well... heres my situation... I have a mysql database set up... I have a user table with 2 fields...team_name and fant_week. What I want to do is, depending on who is logged in, I want my link to change the value of 'team' to the logged in members team name, like wise for the week. For example.. if gorno is logged in and his team is called fun team the link will reflect his team and look like this... fant_stnd3.php?week=1team=fun team or if say... billbo is logged in and his team is called silly team the link will look like this fant_stnd3.php?week=1team=silly team but again, my problem is that it's cutting off the team value when there is a space in the string.. G|rhan Vzen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, 2003-06-01 at 22:26, Ian Fingold wrote: I'm trying to build a query string for one of my links.. for example... fant_stnd3.php?week=1team=fun%20team I need to be able to grab the values of 'week' and 'team' from an array, I can do that no problem, but when the code runs it cuts off the value if there is a space in the string. so instead of putting fun team in the query string it cuts it off and just puts.. fun So my question, is there a function or any way to prevent this from happening? thanks. Hi Ian, I have no idea what you are trying to do.. Well if you are getting those values from a URL, $week and $team variables in your php script should have the values in them.. In later versions of PHP, they will be _POST['week'] and _POST['team'] or _GET['week'] or _GET['team'] depending on which method is used.. You don't need to parse the URL and run them through an array.. :) Gurhan -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] HELP HELP HELP SELECT not work
My psychic powers are a bit out of tune, but I think the problem is on line 35 of your code. [EMAIL PROTECTED] wrote: My PHP scripts don't execute the SELECT queries after execute the first. My web execute PHP scripts for work with MYSQL, all on Apache webserver. PHP version: 4.1.2 MySQL version: 3.22.32 The queries executed directly in MYSQL works. Where is the problem? These scripts run well for more times before this problem. Antonio Gabrielli -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Can't Insert more than 1 record
I haven't used my psychic powers for a while, but I think the problem is on line 35. Keven Jones wrote: Hello All, I am having a problem inserting records into my Database. I am passing fields from a FORM to my php program that adds 1 record to my DB. It will create the first attempt just fine, however any attempt after the 1st fails. I have to delete the existing row in order to add a new record. Anyone know what I am doing incorrectl? KJ _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sharing variable values among PHP files
Please, please, PLEASE don't give advice! If you don't know the answer, DON'T COMMENT! The method you posted is for register_gkobals on, which it won'tr always (and shouldn't be)! Ronan Chilvers wrote: Coments inline... snip On 01 Apr,2003 at 10:04 Mustafa Ocak wrote: You can store the value in a session variable session_start(); if (isset($_HTTP_SESSION_VARS['your_variable_name'])) { /snip Rather than using isset() you may need to use session_is_registered(). This is specifically for checking the existence of a session variable. I would do something like ?php // need this on all pages where you want to work with // the session var session_start(); // Check for the existence of the session var and create // it if it doesn't exist if (!session_is_registered(ses_username)) { session_register(ses_username); } // Are we getting a form var thru ? if so pop it into the session var if (isset($frm_username)) { $ses_username = $frm_username; } // then in your scripts you can do do_my_amazing_function($ses_username); ? As long as you have session_start() at the beginning of each script, $ses_username is now available across scripts. snip $value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value }else{ $_HTTP_SESSION_VARS['your_variable_name']=new value; } /snip Hope that helps. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP-DB] Sharing variable values among PHP files
The method posted, using isset(). Leston Drake wrote: For us novices, can you please share how you would do this with register_globals off? At 01:07 AM 4/1/2003, you wrote: The method you posted is for register_gkobals on, which it won'tr always (and shouldn't be)! Ronan Chilvers wrote: Coments inline... snip On 01 Apr,2003 at 10:04 Mustafa Ocak wrote: You can store the value in a session variable session_start(); if (isset($_HTTP_SESSION_VARS['your_variable_name'])) { /snip Rather than using isset() you may need to use session_is_registered(). This is specifically for checking the existence of a session variable. I would do something like ?php // need this on all pages where you want to work with // the session var session_start(); // Check for the existence of the session var and create // it if it doesn't exist if (!session_is_registered(ses_username)) { session_register(ses_username); } // Are we getting a form var thru ? if so pop it into the session var if (isset($frm_username)) { $ses_username = $frm_username; } // then in your scripts you can do do_my_amazing_function($ses_username); ? As long as you have session_start() at the beginning of each script, $ses_username is now available across scripts. snip $value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value }else{ $_HTTP_SESSION_VARS['your_variable_name']=new value; } /snip Hope that helps. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Catch Errors
www.php.net/mysql-error shaun wrote: Hi, Is it possible to catch the type of error message returned form a mysql_query(); funtion for example if ($error == //duplicate row for table) { echo This row already exists in the table; } -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Generating view of tree?
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. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] need to pass info in URL
Is there a way to pass a value from on html page to another on a different server through a URL and have that value input into a form. The value trying to be passed is a record id from a database. In Kindness Stephen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Passing value in URL to Form
I have managed to pass information through a URL and extract it and insert it into a form on a php document. Can this be done for an html document? Passing the value through the URL to an html page with form and then through a URL again into a php doc. I tried the same method I used in the php doc in the html doc but it didn't work. Any ideas? In kindness, Stephen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] I'm almost there! Just a little more help
Below is all of my code. The first is my html page that calls my php page. I do not know php well enough to edit the code to make this work. I need the image to go to a folder called logos on my C drive. The actual path is: C:\Program Files\Apache Group\Apache2\htdocs\logos Could someone please make the changes to my code so that it will work! Thank you Thank you!!! HTML Page*** html form action=fileupload2.php method=post enctype=multipart/form-data submit this file: input type=file name=userfilebr rename to: input type=text name=newnamebr input type=submitbr /form /html **PHP Page * ? if(!empty($userfile)) { $abpath = logos/ . $newname; echo FileUpload2.php; echo $username; echo $newname; echo $abpath; //copy the file // copy($userfile, $abpath); //destroy the uploaded file // unlink($userfile); // write javascript to store the newname // echo script language='javascript'\n; // echo newname = ' . $newname . ';\n; // echo /script\n; } ? If someone could fix this I would greatly greatly apreciate it! In Kindness Stephen K Knight -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Need help with php and apache
I am currently running on a Windows Box the OS is ME I have installed apache 2.0.44 and I have downloaded the newest PHP download for windows. I have read the configuration manual repeatedly for getting the php into the apache httpd.conf doc file. but I still cannot get php to be recognized. Can anyone help me with this? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] I need some help with php code please
I am trying to upload an image to my webserver. This is the PHP page that is called from my html page. I am trying to upload the image to my folder called logos the direct link would be: C:\Program Files\Apache Group\Apache2\htdocs\logos I am not sure what I am doing wrong in the code below. Can someone please look and help me so that I can upload the image to that folder. Thank you! In Kindness Stephen K Knight ? if(!empty($userfile)) { $abpath = /logos/ . $newname; echo FileUpload2.php; echo $username; echo $newname; echo $abpath; //copy the file // copy($userfile, $abpath); //destroy the uploaded file // unlink($userfile); // write javascript to store the newname // echo script language='javascript'\n; // echo newname = ' . $newname . ';\n; // echo /script\n; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating MySQL Entry Forms
What's wrong with PhpMyAdmin? Jeremy N.E. Proffitt wrote: I need to create some simple web forms for entering, changing, deleteing information from a fairly simple MySQL database. This is to be for internal use, so doesn't have to be really fancy or have alot of error checking. I could make a form for each table myself, but I would think their is an easier way... Cheers Jeremy -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] selecting random rows
select * from table order by rand() limit 2 [EMAIL PROTECTED] wrote: I'm sure this is pretty simple, but I'm having a hard time finding the answer: How do you select two random rows in a mysql table? Thanks, Kent -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] disable right-click in all frames.
1. Not a PHP question. 2. Definitley not a PHP database question. 3. No, I don't think so. Matt wrote: hey everyone. i have a php script that opens up a new window with multiple frames. i am using javascript to disable the right-click mouse button on the frames. the problem is that on of the frames uses and external source, which i can't change or modifiy at all. is there a way for me to disable the right-click mouse button in that frame? is there just some way to disable the right-click in all frames (no matter what the source) on a given page? please let me know if you have any ideas. thanks. matt -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Differences between php3 and php4
Y Al Hinai wrote: include(mydata.txt); Should be: include('mydata.txt'); 1. Is there any source (book or URL or whatever) that shows what have been changed between php3 and php4 and what are the new functions or values are? Something like a table or differences in functions. http://www.php.net/manual/en/ 2. How do u get the mail() and include() to work? Also, who do u get header() to header() function to work in PHP4?? This is the code i am using for the header() followed by the error message: There can't be ANY output before a call to header(). That includes spaces and new lines before ?php. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to find the autoincremented number?
http://www.php.net/manual/en/function.mysql-insert-id.php David Chamberlin wrote: Hey, Most of the tables I use identify things using an id which is auto-generated using autoincrement. However I can't seem to figure out a good way to find what value was generated for the ID. For example, let's say I generate a new entry and want to e-mail out a link to it and the link identifies the entry by ID. Currently, the only way I can figure to do this is to first do the INSERT and then do a SELECT on some unique information that I just inserted (e.g., submitter's ID and last-modified date). So for example, I would have: function addNewEntry( $stuffToPutIn ){ $sql = INSERT INTO myTable $stuffToPutIn; // I use pearDB with mysql $result = $this-db-query( $sql ); checkDbResult( $result ); $sql = SELECT id FROM myTable WHERE . (last_modified_by = $userId) AND . (last_modified_time = $currentTime); $result = $this-db-getAll( $sql ); checkDbResult( $result ); $entry = $result[0]; $linkAddress = $baseEntryURL.'?entryId='.$entry-id; mailOutLink( $linkAddress ); } What I'd really like to do is get rid of that SELECT or at least make it less hacky to find out what the id was that got autogenerated. Any ideas? Thanks, Dave -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Ordering...
order by col1 asc col2 desc nikos wrote: Hi list! How can I Order By in MySQL a column asceding and an other column desceding? Qbit - Gatsis Nikos Web developer tel.: 2108256721 - 2108256722 fax: 2108256712 email: [EMAIL PROTECTED] http://www.qbit.gr -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] heredoc and coding standards
I usually do something like this: function somefunction(){ //Do whatever print END Whatever text here END ; } Rob Day wrote: I try to write very clean code. However, there is one thing that always bugs me - using heredoc syntax in a function. Code in the function really should be indented (or 4 spaces for PEAR types), but, to quote the documentation, the closing identifier must begin in the first column of the line. That means no tabs, right? So is that just the way it is? Do I just need to not worry about my tabs for heredoc? Is there some way to maintain consistency without breaking my code? -Rob -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form field rejection
Try something like this (untested): $phonenumber = '(123)-123-1234'; $phonenumber = preg_replace('/[^0-9]/','',$phonenumber); if(!preg_match('/^([0-9]{3})([0-9]{3})([0-9]{4})$/',$phonenumber,$matches){ die('Invalid phone number.'); } $full_number = $matches[0]; $areacode = $matches[1]; $exchange = $matches[2]; $number = $matches[3] $banned_exchanges = array('321','654'); if(in_array($exchange,$banned_exchanges)){ die('Bad exchange.'); } Addison Ellis wrote: hello, thank you for your time... what is the best way for me to have a form field, phone reject certain phone prefixes? for example: someone enters 321-1791 and 321 prefix can not be allowed as an entry... thank you again, addison -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Storing previous versions?
I'm planning to use a wiki-style help system for my website. I've considered using existing open-source wiki systems, but it would be too much work to get them hooked up with my user system, etc. Like most wikis, previous versions of articles will be stored. I'm looking for ideas as to the best data structure for the previous versions (one table for articles, and another for each version of them?). Also, any ideas for having it not take up huge ammounts of disk space? Storing the difference between the next version and the old one, perhaps? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Getting all rows of a certain column when grouping?
I have a table that stores smileys users can use. I'm trying to make a page that lists them in an HTML table something like: || | Smiley | Image | ||---| |:), :-) | IMAGE | |:(, :-( | IMAGE | -- I could use a query something like: select * from smileys group by image But that would only return one of the possible things the user can type to make that smiley. Is there another way? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Limit to size of autoindex in MySQL/PHPMyAdmin?
The limit to tinyint is 255... use int. Jim MacCormaic wrote: Hi all. I'm new here, currently implementing my first PHP/MySQL website on an iMac running Mac OS X v.10.2.3. All has been going really well until just now while I was adding records to the MySQL database. I have a table which includes an auto-incremented field which is set as the Primary key. I was happily entering information and then suddenly got a warning of an error in my MySQL query, telling me that I had a 'duplicate entry 255 for key 1'. I've checked the relevant table in PHPMyAdmin and, sure enough, under Row Statistic in the Structure option it gives a value of 255 for the Next Autoindex even though that value was already assigned in the previous record. I feel as if I've hit a brick wall on this one. I ran Check Table, Analyze Table and Optimize Table in PHPMyAdmin Operations and all reported 'OK'. I'm using a PHP form to insert the records and have code included to print out the MySQL query and to report errors (hence the warning which I received). The field in question is of type tinyint(4), unsigned, not NULL and, as stated, is the Primary key and set to auto-increment. Have I hit some sort of limit by reaching an id of 255? If so, can I fix this? Any help would be appreciated, as my database has to all intents and purposes lost its functionality once I cannot add further records. Jim MacCormaic Dublin, Ireland iChat/AIM : [EMAIL PROTECTED] -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mysql Passwprd validation
SELECT * from table where passwordfield=PASSWORD('$variablewithpassword') and username='$usernametocheck' limit 1 Sabina Alejandr Schneider wrote: Hello to everybody!! I'm writing to know if somebody knows how can I validate a password that has been encrypted with the PASSWORD() mysql function. Thank you all for your time!!! Sabina Alejandra Schneider [EMAIL PROTECTED] _ Tutopia - Acceso a Internet rápido, fácil y a los mejores precios. http://www.tutopia.com -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cannot add header information error
You can't add headers after you've outputted anything. Without seeing the class page, I'd guess there's a space after the ?. Either remove that or use output buffering. Petre NICOARA wrote: Hi guys I have this error when I tried to use a sign-up form. The thing is that I use some classes for database interaction, and I respond by return Values; to the functions. Also, in line 18 in page.php I have this Header(Location: page1.php?string=value); The Line 363 marks the class end ? Warning: Cannot add header information - headers already sent by (output started at classes/member_class.php:363) in F:\Web Applications\My work\site\page.php on line 18 Could someone explain what is happening, the code is clear. Thanks -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Checking if number is in bottom three?
I need a way to check if a number is in the bottom three of a column in my database. For example, if I had a list of number in my table like this: 1 5 8 12 60 1 10001 I might need to know if 5 was in the bottom three, which it would be. But if I checked 60, it wouldn't be. I could check the lowest number and add 3 to it, but it may have gaps. Any ideas? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Checking if number is in bottom three?
Thanks, but what I want to do is check if a number is in the first 3, not return the first three. If returning the first three and seeing if any of them matches is the only way, I'll do that, but it doesn't seem that great for the server. SELPH,JASON (HP-Richardson,ex1) wrote: select myfield from table order by myfield DESC limit 3 That will return the last 3 records in your database where the highest number is the last. Think of it as sorting by that number in reverse and only returning the first 3. Cheers Jason -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Monday, December 23, 2002 10:14 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Checking if number is in bottom three? I need a way to check if a number is in the bottom three of a column in my database. For example, if I had a list of number in my table like this: 1 5 8 12 60 1 10001 I might need to know if 5 was in the bottom three, which it would be. But if I checked 60, it wouldn't be. I could check the lowest number and add 3 to it, but it may have gaps. Any ideas? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Set Logout Time for No Activity
Log out, meaning what? Using sessions? Cookies? Allens wrote: Hello, Is there a variable in php.ini that will allow you to log someone out if there is no activity of 30 minutes or greater from the logged in user? Thanks in advance. :) :) Gale L. Allen Jr Macintosh Support Specialist 865/947-5740 Remember, Love wins over all (: -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Assign a variable with another variables value
$foo = BAR; $varname = new$foo; $$varname = some string; Martin Allan Jensen wrote: Hi folks, I probably need a little help the next couble of days, but well here is the first question. How can i assign a variable with the value of another variable ?? Example: $foo = BAR; $newBAR = some string; The BAR is supposed to be taken from the value of $foo. THANKS A LOT!!! Regards, Martin Allan Jensen -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Making field concat of autoincrement column and other values?
I'm trying to make a field in my database table a concat of an autoincrement value and some other values. I'm trying: insert into table set val1='val1',val2='val2',concatfield=concat('whatever',id,'whatever'), but it doesn't work. Is there another way, or will I have to update the row directly after inserting? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Making field concat of autoincrement column and othervalues?
I could concat when selecting, but it will be used in the where clause (it is neccesary to do it like this, I'm also md5ing it but forgot to mention that), and I'm guessing it would be bad for the server to have to concat and md5 in the where clause. John W. Holmes wrote: I'm trying to make a field in my database table a concat of an autoincrement value and some other values. I'm trying: insert into table set val1='val1',val2='val2',concatfield=concat('whatever',id,'whatever'), but it doesn't work. Is there another way, or will I have to update the row directly after inserting? You'll have to do it after. Id probably doesn't even have a value since you're just creating the row. But, why do it this way? Why not add two more columns where you put in 'whatever' and 'whatever', then do the CONCAT when you actually SELECT out the data. Then nothing is repeated. With your method, what if the ID ever changes, then you'll have two columns to update. ---John Holmes... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP-DB] Making field concat of autoincrement column and othervalues?
I'm trying to make a customised session system (I could use PHP's built-in one, but I need a lot more control than it offers). I could use the autoincremented id in a cookie, but it would be easy for a hacker to change the cookie to gain access to others' data. John W. Holmes wrote: I could concat when selecting, but it will be used in the where clause (it is neccesary to do it like this, I'm also md5ing it but forgot to mention that), and I'm guessing it would be bad for the server to have to concat and md5 in the where clause. Yeah, I guess so. This all begs the questions though of why you're doing all of this in the first place... ---John Holmes... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP-DB] Deleting topics older than 2 hours?
I'm trying to run a cron job to delete forum topics more than 2 hours old. I know how to do that, but the problem is also deleting the posts in the topic at the same time. Can someone shed some light on this, please? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Deleting topics older than 2 hours?
Sounds to me like you didn't understand the question. The table structure is something like: topics_ | id | forum | author | subject | posttime | - _posts | id | topic | author | message | posttime| - The problem is, if I run a query like (I know the query is probably wrong, I'm just writing it now): delete from topics where posttime + interval 2 hours now() I would leave orphan posts inside of that topic. I'm not sure how (or if it's even possible) to delete the posts as the topic is deleted. DL Neil wrote: Sorry Leif, but CrystalBall v2.6 is currently unable to help. The word WHERE features. Show us the money - or second choice: the (erroneous) code... =dn I'm trying to run a cron job to delete forum topics more than 2 hours old. I know how to do that, but the problem is also deleting the posts in the topic at the same time. Can someone shed some light on this, please? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP-DB] Really dumb question... deleting everything but newest 100 rows?
I know this is a dumb question, but how would I delete everything but the first 100 results returned from a query? I know I'd use limit, but my mind's going blank as to the exact syntax. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Really dumb question... deleting everything but newest100 rows?
I was thinking something along those lines, but phpmyadmin gives an error. The table currently has way too many rows (32362), could this have to do with it? Warning: Unable to jump to row 0 on MySQL result index 4 in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php on line 223 Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/libraries/ob.lib.php on line 53 Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 23 Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 24 Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 25 Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 26 Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 27 Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 29 Database mydb running on localhost Error SQL-query : delete from `mytable` order by col desc limit 100, -1 MySQL said: You have an error in your SQL syntax near 'order by col desc limit 100, -1' at line 1 Back http://www.ecritters.biz/PhpMyAdmin/db_details.php?lang=enserver=1db=chizzy_co_ukshow_query=ysql_query=delete+from+%60topics%60+order+by+id+desc+limit+100%2C+-1 Marco Tabini wrote: If you have a column that gives you the newness of each row--I'm assuming a date here: delete from my_table order by date_inserted desc limit 100, -1 This should work... I recommend a db backup first :-) Marco php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Check us out on the web at http://www.phparch.com On Sat, 2002-11-23 at 17:38, Leif K-Brooks wrote: I know this is a dumb question, but how would I delete everything but the first 100 results returned from a query? I know I'd use limit, but my mind's going blank as to the exact syntax. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP-DB] session in php 4.2.3
My guess is a register_globals problem, but it's hard to tell without seeing your scripts. dn wrote: Hi! I have to support a PHP-Database-solution which someone else has developed. In addition I'm quite new to php ... It uses Oracle 8 to display values out of the database. Everything is running fine with php 4.1.1. Due to security reasons I wanted to update to php 4.2.3. I use the same values within both configure-runs: ./configure \ --with-oci8=/oracle/product/8.1.7 \ --with-apxs=/usr/sbin/apxs \ --enable-sigchild \ --with-zlib-dir=shared \ --with-gd=/usr/ \ --with-png-dir=/usr/lib \ --without-mysql The php-scripts do the following when a user logs in: session_register(user,password,db); I assume that other scripts can use this values when they query the database. A session-file is created in /tmp/. As I mentioned above everything runs fine with php 4.1.1. With php 4.2.3 the login-script is ok! When another script is called it seems like it is not able to read the sess-file which exists (!) in /tmp/sess Could you please give me a hint what I'm doing wrong! Thanks in advance! Daniel -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Pgsql Vs. Mysql
Sorry for the off-topic post, but it would be highly annoying to have to subscribe to a new mailing list for just one topic. I'm currently using mysql, but I'm considering switching to pgsql. I'm wondering which is better. Also, how hard would Pgsql be to install? Php seems to have pgsql support, but there's currently no pgsql server. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Performance for how many columns to update?
I'm wondering how significant the performance differences between: mysql_query(update table set col1='val1' where whatever='whatever'); and mysql_query(update table set col1='val1',col2='val2',col3='val3'... where whatever='whatever'); -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Performance for how many columns to update?
Yes, I know that one query is more efficient than 3, but I'm trying to do a mysql_fetch_array that automatically changes the row at the end of the script if it has changed. I'm trying to decide whether to make it only update the changed rows or be lazy and make it update them all if only 1 has changed. Peter Beckman wrote: Straight from the MySQL Documentation, which is where you should look first always: http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Optimisation.html#Update_speed 5.2.10 Speed of UPDATE Queries Update queries are optimised as a SELECT query with the additional overhead of a write. The speed of the write is dependent on the size of the data that is being updated and the number of indexes that are updated. Indexes that are not changed will not be updated. Also, another way to get fast updates is to delay updates and then do many updates in a row later. Doing many updates in a row is much quicker than doing one at a time if you lock the table. Note that, with dynamic record format, updating a record to a longer total length may split the record. So if you do this often, it is very important to OPTIMIZE TABLE sometimes. See section 4.5.1 OPTIMIZE TABLE Syntax. If you aren't doing an update of 50K per row, updating 3 columns instead of 1 will be much quicker (quoted from the manual). If you are doing 10,000 updates, read more of the manual on the syntax of UPDATE because you can delay your updates which allows MYSQL to update the table at its leisure which offers better performance. Peter, who reminds you to always read the manual (or less kindly RTFM!). On Sun, 10 Nov 2002, Leif K-Brooks wrote: I'm wondering how significant the performance differences between: mysql_query(update table set col1='val1' where whatever='whatever'); and mysql_query(update table set col1='val1',col2='val2',col3='val3'... where whatever='whatever'); -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP-DB] Polls?
The problem is, I need to make a page that shows all of the polls, and one query per poll would kill the server. Peter Beckman wrote: Use the dual table questions and answers suggestion before. Then just use a loop: $question = mysql_query(select * from questions where id={$this_question}); while ($r = mysql_fetch_array($question)) { $answers = mysql_query(select * from answers where qid={$r[id]}); while ($s = mysql_fetch_array($answers)) { print question input and labels; } } On Fri, 8 Nov 2002, Leif K-Brooks wrote: I'm working on a polling system, and I'm having a bit of a problem. I'm not sure how to store the questions. Storing them in a seperate table would require a query for each poll displayed - not good. I've also thought of storing them as a serialized array. Any thoughts on this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP-DB] Polls?
I'm working on a polling system, and I'm having a bit of a problem. I'm not sure how to store the questions. Storing them in a seperate table would require a query for each poll displayed - not good. I've also thought of storing them as a serialized array. Any thoughts on this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Polls?
Thanks, but my problem is how to efficiently display a page with all of the polls with results. Also, I need a variable number of questions, which that tutorial doesn't provide. Thanks, though. Ignatius Reilly wrote: One possibility: table questions( questionID, question_text, ...) PRIMARY KEY( questionID) table answers( FK_questionID, individualID, answer_code, ...) PRIMARY KEY( FK_questionID, individualID) For very simple online polls, there is a nice tutorial in Devshed: http://www.devshed.com/Server_Side/PHP/PHPDemocracy HTH Ignatius - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, November 08, 2002 8:15 AM Subject: [PHP-DB] Polls? I'm working on a polling system, and I'm having a bit of a problem. I'm not sure how to store the questions. Storing them in a seperate table would require a query for each poll displayed - not good. I've also thought of storing them as a serialized array. Any thoughts on this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP-DB] Abstraction layer or not?
I'm working on a new site, and I'm wondering whether to use an abstraction layer or not. I don't have any plans to switch DB system, but you never know what the future holds. I figure that there's no reason not to, but are there any down sides? Which abstraction layers are good? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Abstraction layer or not?
True, but a DB wrapper can do the error reporting as well. John W. Holmes wrote: I'm working on a new site, and I'm wondering whether to use an abstraction layer or not. I don't have any plans to switch DB system, but you never know what the future holds. I figure that there's no reason not to, but are there any down sides? Which abstraction layers are good? ADOdb is a good one. PEAR also has an abstraction class. Once you get used to using them, they make things easier over all. I've never actually switched databases with them, so I don't know how much easier it makes that. I find them ideal for error catching and reporting. ---John Holmes... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP-DB] Getting affected rows before executing query?
I keep forgetting where clauses. It's my dumbest mistake, and I always make it. I just lost the password of everyone on my site trying to change my own - not good. Anyway, I'm trying to edit PhpMyAdmin to warn if there's more than a certain number of affected rows for a query. Is there a way to tell number of affected rows before executing the query? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Performance problems?
I've been optimizing scripts in an attempt to speed my friend's site up, and I believe I've found the source of the performance problems. When I comment the following page load time changes from around 6 seconds to less than .5 of a second. if($loggedin){ $events = mysql_query(select * from events where whofor='{$userinfo['id']}' order by id desc limit 1); if(mysql_num_rows($events) == 1){ $events = mysql_fetch_array($events); print END p align=centera href={$basepath}doevent.php?id={$events['id']}{$events['message']}/a/p END; } } This code checks for events (new mail, etc.) that the user may have and dispays them. Any idea on what makes it perform this badly? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Performance problems?
Aha - thanks. The problem is, I also need to retrieve other data asscociated with it. I'll alter the table to order by id, but is there anything long-term I can do? Manuel Lemos wrote: Hello, On 11/02/2002 03:21 AM, Leif K-Brooks wrote: I've been optimizing scripts in an attempt to speed my friend's site up, and I believe I've found the source of the performance problems. When I comment the following page load time changes from around 6 seconds to less than .5 of a second. if($loggedin){ $events = mysql_query(select * from events where whofor='{$userinfo['id']}' order by id desc limit 1); if(mysql_num_rows($events) == 1){ $events = mysql_fetch_array($events); print END p align=centera href={$basepath}doevent.php?id={$events['id']}{$events['message']}/a/p END; } } This code checks for events (new mail, etc.) that the user may have and dispays them. Any idea on what makes it perform this badly? The order by clause is the killer. It forces the server to rebuild the whole table in memory just to returned the results sorted. If you just want the highest id, use MAX(id) . -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Multiple table select, but still returning row if no record existsin second table?
I'm using mysql. Is there any way to do a multiple-table select, but still return the results from table 1 if there are no matching rows in table 2? Something like select table1.something,table2.something as something2 from table1,table2 where table1.table2id = table2.id will only return the data from table1 if a row with the id in table1.table2id exists in table2. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Converting database from MS Access to MySQL on Linux
Sir, Can u pls help in Converting database from MS Access to MySQL on Linux. Pls send the code for converting. Bye Som __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Converting database from MS Access
Sir, Can u pls help in Converting database from MS Access to MySQL on Linux. Pls send the code for converting. Bye Som __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mysql too many connections?
Is there any way to change how many connections mysql allows? I keep getting the too many connections error... (not using pconnect) -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] The Ethics and Access of Login
That's a HUGE security flaw! Anyone could send that in a GPC value and get unauthorized access! USE $_SESSION['login'] INSTEAD!!! Daevid Vincent wrote Then at the top of each page, just check if they're logged in or not. if( !$login ) { Header(Location: .$LOGINPAGE.\n\n); exit; } -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Getting rows where column has changed?
I'm trying to make a page to help in detecting people using automatic refresher programs. In the table that stores user info, there is a column called lastseen which says when the user was last seen. I'm trying to: 1. Select all lastseen colmns that are less than 5 minutes old 2. Wait 2 seconds 3. Select lastseen columns that have changed since step 1, and display that info Any ideas on how to do this? Is it even possible? Thanks... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Adding 1 day to date/datetime/timestamp?
I need to add one day to a datetime/date/timestamp field. How would I do this? (sorry for the n00b-ish question...) I'm using mysql. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Accessing data from next row? (mysql)
Using mysql, how do I access the data of the next row using code something like this: $result = mysql_query(select column from table where whatever='whatever'); while($array = mysql_fetch_array($result)){ //Whatever } -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Random numbers with range in mysql?
I'm trying to make shops that sell virtual objects. They restock once every 15 minutes. This is all set up. The problem is, I would like to have objects in these shops with a random chance of being restocked. My idea is to store two numbers in the restock list: chance, and outof. (For a 1/5 chance on each restock, those values would be 1 for chance, 5 for outof). The problem is, I need a way of generating a random number within a certain range. I thought of going through php and mt_rand(), but that would make for a very inefficient script. Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Caculating minutes since DATETIME column?
I need a way to calculate the number of minutes since the value of a DATETIME column in mysql. Any ideas? Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Caculating minutes since DATETIME column?
Thanks a lot for your help, but just a not to anuyone else who tries this. Since there's no ()s around UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column) , it thinks that you're trying to get: UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(your_column) /60) Instead of: (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column)) / 60 John Holmes wrote: SELECT UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column) / 60 AS Minutes FROM your_table ---John Holmes... -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 26, 2002 12:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Caculating minutes since DATETIME column? I need a way to calculate the number of minutes since the value of a DATETIME column in mysql. Any ideas? Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Categorized list?
I'm trying to create a system to store virtual objects. Each object will be in a category, and the categories may be in other categories. The categorie list might look something like: Food Candy Healthy Food Vegeterian food Organic food Gross food I'm thinking of a datbase structure for the categorys something like: id (int, auto_inc, primary) name (text) insideof(int, id of other catrgory which this one is inside of) The problem is, I need to generate an indented list such as I showed before. I know how to do this with a lot of colors (selecting what each category contains, etc.), but is there a more effieient way? I use mysql. Thanks for any ideas. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Script to control mysql users?
I need to add mysql users to some databases, but my dumb control panel (ensim) doesn't seem to have a feature to do that, and I'm nothing in the mysql database. Does anyone have a script to let me add them automaticly if I supply it with the root password? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Database abstraction layer needed?
I'm redoing my web site, and I'm considering using a db abstraction layer. Would I need one, and should it be db-type specific (like, can just do one db type)? I don't plan to change database types. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database abstraction layer needed?
My current website is www.ecritters.biz. I think I need one mostly for counting how many queries a page uses, for changing stuff about how queries are executed (like doing something with the errors on every query), etc. MET wrote: What's your current website? Why do you think you need one? ~MET -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 3:28 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Database abstraction layer needed? I'm redoing my web site, and I'm considering using a db abstraction layer. Would I need one, and should it be db-type specific (like, can just do one db type)? I don't plan to change database types. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: results of mysql_fetch are returning the incorrect records
I tried echo the sql in this function but I do not know where it print the statement. This function is inside *.inc file which is require in the html that I am printing the results of the query. So, to answer your question, I using the data to display on a html page. I am returning an array from this function. David Robley [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I have problems with mysql_fetch return the wrong records. If I execute the sql statement in mysql, I receive the correct results. When I used mysql_fetch function, it does not return the correct results. Below is my function and the format sql statement function companiesByBusiness_ZipCode_BusinessOrContactName( $ctgyno, $zipcode, $businessandcontactname ) { $sql = select company_no, name, contact, business_phone, mobile_phone, services_desc, brief_bio, pager, address, city, state, zipcode, picture_file, case ifnull(picture_file, 'No Picture') when 'No Picture' then 'b' else 'a' end pic_ind from company; if( $ctgyno != ALL) { $sql .= where business_ctgy_no = $ctgyno; if( $zipcode != ) { $sql .= and (zipcode like '.substr( $zipcode, 0, 3 ).%' and zipcode != '$zipcode'); } if( $businessandcontactname != ) { $sql .= and (name = '$businessandcontactname'; $sql .= or contact = '$businessandcontactname'); } $sql .= order by pic_ind, name, company_no; } $query = mysql_query( $sql ) or die( $sql.p.mysql_error() ); //$numrows = mysql_num_rows( $query ); while( $assoc = mysql_fetch_assoc( $query ) ) { $rows[] = $assoc; sql statement: select company_no, name, contact, business_phone, mobile_phone, services_desc, brief_bio, pager, address, city, state, zipcode, picture_file, case ifnull(picture_file, 'No Picture') when 'No Picture' then 'b' else 'a' end pic_ind from company where business_ctgy_no = 1 and (zipcode like '276%' and zipcode != '27616') and (name = 'Gil Bryan' or contact = 'Gil Bryan') order by pic_ind, name, company_no It seems like it is ignoring the last condition, name = 'Gil Bryan' or contact = 'Gil Bryan'). Any help is greatly appreciated. } return $rows; } First, I'd suggest echoing $sql just before you send it to mysql to ensure that what you hope is there is actually there. Also, what are you returning from your function? Or how are you using the data gathered from your tables? -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Good mysql abstraction layer class?
I'm completley reprogramming my site, and I'm looking for a good mysql abstraction layer. I want something that basicly works just like the normal mysql functions (something like $classvar-function(), rather than mysql_function()). Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] results of mysql_fetch are returning the incorrect records
I have problems with mysql_fetch return the wrong records. If I execute the sql statement in mysql, I receive the correct results. When I used mysql_fetch function, it does not return the correct results. Below is my function and the format sql statement function companiesByBusiness_ZipCode_BusinessOrContactName( $ctgyno, $zipcode, $businessandcontactname ) { $sql = select company_no, name, contact, business_phone, mobile_phone, services_desc, brief_bio, pager, address, city, state, zipcode, picture_file, case ifnull(picture_file, 'No Picture') when 'No Picture' then 'b' else 'a' end pic_ind from company; if( $ctgyno != ALL) { $sql .= where business_ctgy_no = $ctgyno; if( $zipcode != ) { $sql .= and (zipcode like '.substr( $zipcode, 0, 3 ).%' and zipcode != '$zipcode'); } if( $businessandcontactname != ) { $sql .= and (name = '$businessandcontactname'; $sql .= or contact = '$businessandcontactname'); } $sql .= order by pic_ind, name, company_no; } $query = mysql_query( $sql ) or die( $sql.p.mysql_error() ); //$numrows = mysql_num_rows( $query ); while( $assoc = mysql_fetch_assoc( $query ) ) { $rows[] = $assoc; sql statement: select company_no, name, contact, business_phone, mobile_phone, services_desc, brief_bio, pager, address, city, state, zipcode, picture_file, case ifnull(picture_file, 'No Picture') when 'No Picture' then 'b' else 'a' end pic_ind from company where business_ctgy_no = 1 and (zipcode like '276%' and zipcode != '27616') and (name = 'Gil Bryan' or contact = 'Gil Bryan') order by pic_ind, name, company_no It seems like it is ignoring the last condition, name = 'Gil Bryan' or contact = 'Gil Bryan'). Any help is greatly appreciated. } return $rows; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] create file (simple)
I am new at php. I trying to debug my code. So, I am trying to print out my sql statement to a file to make sure the syntax is correct. I trying to find a way to print out to a message box or something. I guess php does not have that capability or I cannot find the function that will help me do that. Anyway, if someone could let me know what is wrong with the code below or help in any other way, I would greatly appreciated it. function write_to_file($filename, $stringtowrite, $writetype) { $filesession = fopen($filename,$writetype); fwrite($filesession,$stringtowrite); fclose($filesession); } function companiesByBusiness_ZipCode_BusinessOrContactName( $ctgyno, $zipcode, $businessandcontactname ) { $sql = select company_no, name, contact, business_phone, mobile_phone, services_desc, brief_bio, pager, address, city, state, zipcode, picture_file, case ifnull(picture_file, 'No Picture') when 'No Picture' then 'b' else 'a' end pic_ind from company; if( $ctgyno != ALL) { $sql .= where business_ctgy_no = $ctgyno; if( $zipcode != ) { $sql .= and (zipcode like '.substr( $zipcode, 0, 3 ).%' and zipcode != '$zipcode'); } if( $businessandcontactname != ) { $sql .= and name = gil; $sql .= or contact = gil; } $sql .= order by pic_ind, name, company_no; } write_to_file(developement/indexcode/query.log,$sql,aw); $fp=fopen(developement/indexcode/query.log,aw); fwrite($fp,$sql); fclose($fp); $query = mysql_query( $sql ) or die( $sql.p.mysql_error() ); //$numrows = mysql_num_rows( $query ); while( $assoc = mysql_fetch_assoc( $query ) ) { $rows[] = $assoc; } return $rows; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] create a file (simple)
This is my first using php. I trying to do something by creating file to see the sql statement I am sending to my database. I assuming php does not have way throw up a simple message box. Anyway, if I could get this file to create that would be great. Any help would be appreciated. function write_to_file($filename, $stringtowrite, $writetype) { $filesession = fopen($filename,$writetype); fwrite($filesession,$stringtowrite); fclose($filesession); } function companiesByBusiness_ZipCode_BusinessOrContactName( $ctgyno, $zipcode, $businessandcontactname ) { $sql = select company_no, name, contact, business_phone, mobile_phone, services_desc, brief_bio, pager, address, city, state, zipcode, picture_file, case ifnull(picture_file, 'No Picture') when 'No Picture' then 'b' else 'a' end pic_ind from company; if( $ctgyno != ALL) { $sql .= where business_ctgy_no = $ctgyno; if( $zipcode != ) { $sql .= and (zipcode like '.substr( $zipcode, 0, 3 ).%' and zipcode != '$zipcode'); } if( $businessandcontactname != ) { $sql .= and name = gil; $sql .= or contact = gil bryan; } $sql .= order by pic_ind, name, company_no; } write_to_file(developement/indexcode/query.log,$sql,aw); $fp=fopen(developement/indexcode/query.log,aw); fwrite($fp,$sql); $query = mysql_query( $sql ) or die( $sql.p.mysql_error() ); //$numrows = mysql_num_rows( $query ); while( $assoc = mysql_fetch_assoc( $query ) ) { $rows[] = $assoc; } return $rows; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] search syntax
hi everyone, I'm writing the code to make my mysql database searchable. I can search two columns, but I seem to have problems when I try to search three. In the SELECT statement, this WHERE statement works: WHERE column1 OR column2 LIKE '%$search%' AND... This WHERE statement doesn't work: WHERE column1 OR column2 OR column3 LIKE '%$search%' AND ... I'm obviously having a syntax problem...Thanks in advance for your help. And in case any of this is confusing, I'll include the real code below. Thanks, Matt $get_data = select course.CourseNumber, course.CourseTitle, concat(prof.ProfFName, \ \, prof.ProfLName), instit.InstitName, disc.DiscName, course.Format from course, disc, instit, prof where course.CourseTitle or course.CourseDesc or disc.DiscName like '%$search%' and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID and course.ProfID = prof.ProfID order by $orderby; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] search syntax
Great--it works now. Thanks very much, Tony. I appreciate your help. best, Matt - Original Message - From: Tony [EMAIL PROTECTED] To: Matthew K. Gold [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, July 22, 2002 1:01 AM Subject: Re: [PHP-DB] search syntax Try break up the query, like: WHERE (column1 LIKE '%$search%' OR column2 LIKE '%$search%' OR column3 LIKE '%$search%') AND ... Tony S. Wu Matthew K. Gold at [EMAIL PROTECTED] wrote: hi everyone, I'm writing the code to make my mysql database searchable. I can search two columns, but I seem to have problems when I try to search three. In the SELECT statement, this WHERE statement works: WHERE column1 OR column2 LIKE '%$search%' AND... This WHERE statement doesn't work: WHERE column1 OR column2 OR column3 LIKE '%$search%' AND ... I'm obviously having a syntax problem...Thanks in advance for your help. And in case any of this is confusing, I'll include the real code below. Thanks, Matt $get_data = select course.CourseNumber, course.CourseTitle, concat(prof.ProfFName, \ \, prof.ProfLName), instit.InstitName, disc.DiscName, course.Format from course, disc, instit, prof where course.CourseTitle or course.CourseDesc or disc.DiscName like '%$search%' and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID and course.ProfID = prof.ProfID order by $orderby; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] or statement in url
can I use an OR operator in a variable that is passed through a url? ex. how can I combine the following two lines so that I end up with records that have an id of either 1 or 2? http://www.xyz.com/foo.php?FooID=1 http://www.xyz.com/foo.php?FooID=2 (I tried the following, but it didn't work: http://www.xyz.com/foo.php?FooID=1||FooID=2 ) thanks in advance for your help. Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Best way to have virtual objects do something?
First of all, I'm sorry if the php general list would be a better place to do this. Anyway, I am making a game website with a friend. Among other things, it will have virtual objects that can be used to do things. My database structure idea is something like: item_actions(id int,displaycode text,code text) item_types(id int,actions text,name text) items(id int,type int,owner int) The action display code will control how the action text is displayed, it's code will be run when it gets used. The actions field in item_types will have the ids of what this type of item can do. The thing is, I want to be able to pass values to the actions so that I won't need to add a new action for every small difference. I have considered using funcctions for each action, but I want to store them in the database so artists can add items without knowing php. Any ideas? Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] passing variables from one page to another
Hi Everybody, Please forgive the basic nature of this question--I have looked at the manual, but I found that much of it went over my head. I'm trying to create a second level of a website that displays course listings. The first level lists a bunch of courses. I'd like users to be able to click on the title of a course to go to a page that contains details about that course. From what I understand, I should do this by making the title of the course on the first page (courses.php) a link to the second page (courseinfo.php) with a query string attached--so that the link would look like a href=courseinfo.php?CourseID=12Accounting 101/a What I'm having trouble doing is coding the second page. Here's what I've done. When I run this, I get a blank page in return...if anyone can help, I would greatly appreciate it. Thanks in advance. Matt ?php $db = mysql_connect(host,user,pword); mysql_select_db(dln, $db); if ( !$CourseID ) { print (no course id included) exit; }; $query = Select * from course, disc, instit, prof where course.CourseID = $CourseID and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID and course.ProfID = prof.ProfID; $result = mysql_query ($query); echo MySQL error number . mysql_errno() . : . mysql_error(); print (table border=\0\ cellpadding=\5\ class=\default\\n); print (tr bgcolor=\#ff9900\th$CourseID/th/trtrtd$CourseTitle/td/tr/t able); ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php