Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Chris, et al -- ...and then Chris Boget said... % ... % than maybe making my script run a little more slowly, I fail to see how % mysql_fetch_array() is a bad thing. From what I can see, all it does is give % me an additional numerically indexed reference to the data in my result set ... % % foreach(); list(); each(); % None are good ideas when iterating through an array generated by *_array(). Ahhh... The light begins to dawn. I only ever use while ( $row = fetch ) to go through my rows and then directly handle the fields I pull out, but I can see that one might loop across $row and for that you need only the indices that matter. [Actually, maybe I'm just too new at this, but I can't think of a practical example for which I would loop over $row... Care to help me out?] % And I'd hazard to guess that one of the most significant uses of any query is % to iterate through it's result set. Well, I typically do loop over the result set but typically don't loop over the fields in each record, so I don't know that I can agree with the weight you put on that. But at least I see why I could care :-) % % Chris Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jon, et al -- ...and then Jon Kriek said... % % Perhaps if you would stop sending your posts at attachments ;) Oh, that. I blame your mail mangler still, but this message has been folded, spindled, and mutilated just for you :-) HAND :-D - -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE/k/xoGb7uCXufRwARApHSAJ45R/0IzE0/pJhLLnsYkz5P03J1BACg6PbK x+fgoWcYOpWWl45qxCLGEqI= =B4Vv -END PGP SIGNATURE- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: crosstab (was Re: [PHP-DB] Using two colomns ...)
Chris, et al -- ...and then Chris Boget said... % [quoting Cpt John Holmes] % From: Chris Boget [EMAIL PROTECTED] % If MySQL had crosstab functionality, that *might* be able to help. % A crosstab is just a specifically formatted query, of which MySQL is % certainly capable of handling. I've done them in the past, but maybe you're ... % % Then I'm not calling it the right thing... just the name of the type of query that % was told. The kind of query I'm talking about is the one that rotates the result % set from tall to wide. Basically doing exactly what the OP had asked for. If Hmmm... You mean like taking results 1 a 2 b 3 c 4 d and changing it to 1 2 3 4 a b c d or such? I'm certainly confused. TIA HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP-DB] Re: looping over $row (was Re: [PHP-DB] Using two colomns ...)
John, et al -- ...and then CPT John W. Holmes said... % % From: David T-G [EMAIL PROTECTED] % % can't think of a practical example for which I would loop over $row... % Care to help me out?] % % How about a dynamic query where you do not know the number of columns Hmmm... I suppose so, but I can't picture it. Shouldn't you always know the DB schema and format of what you're going to get back? I can see not knowing how many RECORDS you'll get back but I should think you would know how many FIELDS will be in each. Or maybe I'm just being too compulsive :-) % that'll be returned? You would not want to use _array() as you'll have the % duplicates to worry about / skip over. using _row() or _assoc() and just % looping through that will suffice. Oh, I can see that. It's the first half that still gets me. % % ---John Holmes... Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP-DB] Re: running total (was Re: [PHP] php|cruise ...)
Edward, et al -- ...and then Becoming Digital said... % ... % I'm asking all of you to join me in Operation Send Captain on the Cruise. All it takes is a few minutes to PayPal a contribution to [EMAIL PROTECTED] Donations of any size are welcome, and every little bit helps. If enough of us chip in, John and his wife can get away for a bit, significantly reducing the chance that she'll cut off his PHP Mailing List privileges. ;) A wonderful idea. Now the only other thing is to 1) know how much a php|cruise ticket costs and 2) know where the donations stand. We need John to update us once a month or so -- or for you to bug him and then YOU update us once a month or so. Thanks again to all, including John, HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Email bouncer Program(s) - know any?
Jerry -- This is neither a PHP nor PHP-DB question, even though you use php and mysql, but here's a reply anyway. ...and then JeRRy said... % % Hi, Hi! % % I run PHP and mysql on my site. I allow people to use % a PHP page to send me an email that is logged in the % mysql for logging reasons. Good enough. % % If someone sends me an email to [EMAIL PROTECTED] % (fake address, not real) when it is sent it does not By the way, if you're going to use an example domain, you should generally use example.com since it's been dedicated to that purpose :-) You're approaching this the wrong way; instead of trying to trash the mail that comes to root, keep your form from bouncing back to root if there is a problem. Set the envelope header to specify the sender address (ie [EMAIL PROTECTED]) as well as the From: address (presumably your visitor's email address, but if you're not actually getting that (and if not then why are you using an email form??) then your local one) so that a bounce will go back to where you can control it rather than into the root mailbox. With the example above, you can just direct all mail to invalidemail@ into the bit bucket. Since this is your form and it's supposed to send email to you, how on earth are users entering some bogus address for you in the first place? % bounce, instead it gets sent to the root email % account. :( I don't want this as I don't read the I imagine you don't! % root account all the time because emails that go there Ah. No, that's not really a good reason :-/ % are mainly spam or from people who do not have the % correct email address to send to. I don't reply to % any in there. Just delete them, they take up space % sitting there. They also tell you about possible problems on your server. It would be good to read that mail every once in a while! % % Is there a Program(s) I can download or change a % setting on my server to make them bounce back with a % message? (like other web server do) You could install spamassassin on the box, have root's mail delivered through that, set a whitelist rule for your own local mail, and then mark everything else as spam, to be thrown away later by something like procmail. This isn't very safe (it would be much better, for instance, to periodically pump root's mailbox with successfully-delivered messages through SA and procmail), but you don't seem terribly concerned with the health of your box and so some lost root mail is probably not a big deal to you (and certainly no worse than what you're doing now). Note that even that isn't really very good because each domains is supposed to have a working postmaster@ account where any problem reports for the domain can go. If you just bounce any mail from the outside then you're not playing nice with the rest of the world. Just because other web servers bounce possibly-valid mail to root (very probably because it's a Win box whose master account is 'administrator') or other system accounts doesn't mean that you should. If you use qmail then it's easy enough to run whatever tests you want and, if they fail, bounce the message back. And qmail, which was built from the ground up to be reliable, would get around the problems of unsafe delivery - even for root :-) % % Sure I could setup a autoresponder of some kind but I % don't want to reveal the root account email. Can If you've gotten mail in the root mailbox then you've already revealed it. No, you don't want an autoresponder, since that's not a bounce, but the revelation is pretty insignificant. % anyone help? I'm sure someone can :-) Perhaps even this reply is particularly helpful. % % Also I host other sites and domains, if I install a What's your host name again? I need to remember never to host where someone just deletes the root email. % program on my web server for my emails to bounce will % they work for them? Preferrably is there a program I No reason it shouldn't, and slightly less reason that the would be forced to use it (you could certainly cock up the mail system so that nothing gets in, no matter what domain, but you'd have to work a bit at that). % can use to just use for my domain? And others can ask % for it to be installed for their accounts. You should be keeping all of the domains' mail separate anyway, so that's no big deal. % % All help mostly appreciated. I wonder how 'mostly' this input will strike you :-) % % Thanks! HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] MySQL, PHP or ghost?
Peter -- ...and then Peter Beckman said... % % Seems that either I don't understand mysql, or something. Looks like it, though I admit that the manual doesn't adequately explain your results. Check out section 6.2.2.4 for details. % % My table, with the non-important things removed... ... % % So my assumption is that if I insert with year= it should use the % default. Or at least . That makes sense. And so what is the default? Looks like it is, for some reason, 2000. [This isn't a TIMESTAMP field, so we don't necessarily expect it to be this year.] % ... % mysql update plate set year= where pid=65; ... % +-+-+--+- % | 65 | DVF0343 | 2000 | % +-+-+--+- % % 2000? What? Why? Confused. PHP or Mysql fault? Looks like it's standard mysql behavior: mysql create table ytest (pid int unsigned not null auto_increment primary key, y year(4)); Query OK, 0 rows affected (0.00 sec) mysql describe ytest; +---+--+--+-+-++ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-++ | pid | int(10) unsigned | | PRI | NULL| auto_increment | | y | year(4) | YES | | NULL|| +---+--+--+-+-++ 2 rows in set (0.00 sec) mysql insert into ytest values ('',1),('',''),('','2000'); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 4 mysql select * from ytest; +-+--+ | pid | y| +-+--+ | 1 | 2001 | | 2 | 2000 | | 3 | 2000 | +-+--+ 3 rows in set (0.00 sec) mysql update ytest set y = where pid = 3; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql select * from ytest; +-+--+ | pid | y| +-+--+ | 1 | 2001 | | 2 | 2000 | | 3 | 2000 | +-+--+ 3 rows in set (0.00 sec) mysql update ytest set y = '0' where pid =3 ; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0 mysql update ytest set y = '45678' where pid = 2; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql select * from ytest; +-+--+ | pid | y| +-+--+ | 1 | 2001 | | 2 | | | 3 | 2000 | +-+--+ 3 rows in set (0.00 sec) Note that I sometimes get warnings and sometimes don't. I haven't dug into them, though. % % Beckman % --- % Peter Beckman Internet Guy % [EMAIL PROTECTED] http://www.purplecow.com/ % --- HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] MySQL, PHP or ghost?
Peter, et al -- ...and then Peter Beckman said... % % On Wed, 27 Aug 2003, David T-G wrote: % % Looks like it, though I admit that the manual doesn't adequately explain % your results. Check out section 6.2.2.4 for details. % % I did; see my previous (moments ago) email on my read on that manual % section. Ah; I will when it comes through :-) % % % So my assumption is that if I insert with year= it should use the % % default. Or at least . % % That makes sense. And so what is the default? Looks like it is, for % some reason, 2000. [This isn't a TIMESTAMP field, so we don't % necessarily expect it to be this year.] % % The default at the time was . At the time of the mysql release, you might mean? Certainly at the time of the manual writing... % ... % Looks like it's standard mysql behavior: % % But that's what I'm questioning. Should it be that way? If so, the % manual page for YEAR should be altered. If it shouldn't work that way, it % should be submitted as a bug. Makes sense. Having removed all php elements, you'd probably get a better answer on the mysql list. HTH HAND Good luck! :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Sorting issue
Jeff -- ...and then Jeff said... % % One last question. % % I changed all the DB values where numbers are used - (varchar - int) Well, you should only change for those where the numbers are numbers... % % But for the well locations, there are dashes in them, I.E. 10-15-065-22 Exactly. % % With setting the field to int, it only displays the first part. % 10-15-065-22 shows as 10 % There are also several other fields that use dashes. Then those are an alphanumeric mixture and should be a varchar. % % If I set it back to varchar, will it sort it right because the numbers are % separated by an alfa character, or will I have the same problem as before? If the numbers are padded then it will sort right. That is, is the 065 holding three places with a zero? If it's always 2-2-3-2 digits then sorting will be just fine (just like 00055 would have sorted as you expected against 14000 in a varchar field). HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Sorting issue
Jeff -- ...and then Jeff said... % % Yes duh... *grin* % % I didn't realize numbers weren't considered characters. % What's the sql entry for numeric characters? Integer looks like it will do the trick for you. % % I'm new at this, and figure I'm not doing to bad so far. . I know what you mean :-) Spend a *lot* of time with the manual! HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
RE: [PHP-DB] alphabetical sorting... limiting and paginatingonnext set of letter group
On Wed, 2003-07-30 at 11:17, Aaron Wolski wrote: Hey, Thanks. Is there anyway this can be performed one function/loop? yes of course. =) just create a function that takes in two letters as a parameter, then build the query string from it. function($char_begin, $char_end) { $q_begin = strtolower($char_begin); $q_end = chr(ord(strtolower($char_begin))+1); $query = SELECT designer_name FROM designer WHERE designer_name BETWEEN '.$q_begin.' AND '.$q_end.' ORDER BY designer_name; //do your query here. } I knew it was possible with several queries.. I guess I was just looking for a all_in_one solution. Thanks for your help! Aaron -Original Message- From: Ramil G. Sagum [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 11:07 PM To: Aaron Wolski Subject: Re: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group On Wed, 2003-07-30 at 10:36, Aaron Wolski wrote: Hi Guys, What I would like to do is: Pattern Designers: A/B/C Artists Collection The Barrick Samplers Bent Creek Bobbie G. Designs Calico Crossroads Charland Designs Country Cross Stitch Click for D/E/F Click for G/H/I Click for J/K/L When the user clicks on one of the another Letter Groupings... the A/B/C changes to whatever they selected as does the displayed results for their selection. Is this even possible? Aaron yes it is. =) try for a/b/c SELECT designer_name FROM designer WHERE designer_name BETWEEN 'a' AND 'd' ORDER BY designer_name; for d/e/f : SELECT designer_name FROM designer WHERE designer_name BETWEEN 'd' AND 'g' ORDER BY designer_name; for j/k/l: SELECT designer_name FROM designer WHERE designer_name BETWEEN 'j' AND 'm' ORDER BY designer_name; hope this helps. ramil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] alphabetical sorting... limiting and paginatingonnext set of letter group
function($char_begin, $char_end) { $q_begin = strtolower($char_begin); $q_end = chr(ord(strtolower($char_begin))+1); make that $q_end = chr(ord(strtolower($char_end))+1); sorry. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] problem with starting a session
To make it little more clear, always write session_start() on the top of the page. Because if you output some thing to the browser without starting a session will show you these kind of error. -Sourabh From: Ford, Mike [LSS] [EMAIL PROTECTED] To: 'Ahmed Abdelaliem' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] problem with starting a session Date: Tue, 15 Jul 2003 10:29:06 +0100 -Original Message- From: Ahmed Abdelaliem [mailto:[EMAIL PROTECTED] Sent: 15 July 2003 08:54 i have a problem with starting a session in the page that validates the user input and sends it tothe database, when the user clicks register he gets this error Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in c:\inetpub\wwwroot\ads4u\register_new.php on line 89 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in c:\inetpub\wwwroot\ads4u\register_new.php on line 89 and here is the code i wrote : There must be approximately 73 lines before this, as the error message says the session_start() is on line 89. Your problem is that one of those lines is an include/require for data_valid_fns.php, and line 25 of that file outputs something that can't be output before the session_start(). Take a look there and work out how you can fix that. ? $email=$HTTP_POST_VARS['email']; $passwd=$HTTP_POST_VARS['passwd']; $passwd2=$HTTP_POST_VARS['passwd2']; $title=$HTTP_POST_VARS['title']; $name1=$HTTP_POST_VARS['name1']; $name2=$HTTP_POST_VARS['name2']; $phone=$HTTP_POST_VARS['phone']; $mobile=$HTTP_POST_VARS['mobile']; $address1=$HTTP_POST_VARS['address1']; $address2=$HTTP_POST_VARS['address2']; $town=$HTTP_POST_VARS['town']; $pb=$HTTP_POST_VARS['pb']; $country=$HTTP_POST_VARS['country']; $occupation=$HTTP_POST_VARS['occupation']; session_start(); Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Why old session poping up in new Browser window
Hi, Session problem. I am getting a weird session problem in my site. Background of the Problem: -- My site use sessions for user authentication. Site has a Admin Panel where admin can search users and then through a link (which has login and password appended) login as user. On login as user, session var changes to the new user vars, like user id etc. So, if some one try to access any thing on admin panel, they get error which is quite evident why is that happened. The login user is not a admin any more, its a normal user with no privilege. I came to a conclusion that if I spawn new browser window it takes old session. After trying for hours, I was able to solve this. I started a new session when I login as user by setting session name and storing the other vars. This way I can start the session as needed. After solving this problem I thought I am done. But some thing really weird popped up. The links on the page, like My Account, Change Password goes to admin when I click them. This looks like on clicking the link, Old admin session becoming active and showing the page as a admin. I have no idea why is that happening. I have searched goggle but no result. Is it a browser issue, or php issue, or I am doing something wrong. * I have compiled PHP with trans-sid option. ** I store session in my sql database. I can see the user session active. Ideal Solution:-) -- When I search the user and login as user. Both admin and user session remain alive and I can work on both windows seamlessly. Can Any one point me in the right direction. Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Save mySQL data into a CSV file.
do a var_dump($result_set) to see what $result_set contains (if it's actually and array. (did you implement the code given as is? if not AND you have put line-11 in a function and $result_set as a global variable then you need to define $result_set as a global inside the function.) ramil On Tue, 2003-06-17 at 14:16, Martin E. Koss wrote: Error found when testing the code below: Warning: Variable passed to each() is not an array or object in apache/htdocs/speeddials.php on line 11 Line 11 is: while ($record_set_array = each($result_set)) { What did I do wrong? Thanks Martin -Original Message- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Password generator
a simple way would be to : $pass = $allowable_characters[mt_rand(0,$ps_len-5)] for($i = 0; $i ($length -2); $i++) { $pass .= $allowable_characters[mt_rand(0,$ps_len-1)]; } $pass .= $allowable_characters[mt_rand(0,$ps_len-5)] // This variable contains the list of allowable characters // for the password. Note that the number 0 and the letter // 'O' have been removed to avoid confusion between the two. // The same is true of 'I' and 1 btw, you didn't implement this. hope this helps ramil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Connection
On Wed, 2003-06-18 at 08:16, [EMAIL PROTECTED] wrote: Hello, Would be grateful if someone couldkindly point me in the right direction. Whenever I try to connect to mysql server, I get these messsage back 1. mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY cludiana; ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO) mysql 2. mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY cludiana; ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO) mysql something must be wrong with your connection string, would you post the mysql_connect statement here. what could be wrong. Help please . Regards Moses -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Install conflicts w/ MySQL
On Tue, 2003-06-17 at 03:08, Nathan wrote: # ./bin/mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 030616 12:04:24 mysqld ended I'm running the command as root so I don't think it's a permission issue. Does anyone know anything about the PHP install that would change the way MySQL is running? bothered to take a look at what the logs/error logs say? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Get last id in postgresql
pg_last_oid returns the last object id (an id used in the system catalogs) and not the ID/index of the row. if you need to get the last ID, you need to execute another select or write a pl/sql function. On Tue, 2003-06-17 at 10:13, Norma Ramirez - TECNOSOFT wrote: Hi all, Im starting with posgresql and i trying to use pg_last_oid to get the last id in a insert query, but this function returns me a big number like 21318 and bigger, but the table just have 3 or 4 records. Could some one help? Any ideas? This is the script im using $insert = insert into test(name) values('myname'); $test = pg_exec($insert); echo $id = pg_last_oid($test); Norma Ramirez [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Select statement drops 10th digit during table lookup?
I hope this is something easy I am overlooking but here goes: I have a table called: country which has the following fields: FieldType ip_from double(11,0) ip_todouble(11,0) country_code char(2) country_name varchar(50) IP_FROM NUMERICAL (DOUBLE)Beginning of IP address range. IP_TONUMERICAL (DOUBLE)Ending of IP address range. COUNTRY_CODE CHAR(2) Two-character country code based on ISO 3166. COUNTRY_NAME VARCHAR(50) Country name based on ISO 31 Here are a few lines from the country table which starts at 33996344 and ends at: ip_from ip_to country_code country_name 33996344 33996351 GB UNITED KINGDOM 50331648 83886079 US UNITED STATES 94585424 94585439 SE SWEDEN approx 65000 rows 3714175488 3714175743 DK DENMARK 3715104768 3715629055 JP JAPAN 3717201920 3718840319 KR KOREA, REPUBLIC OF The IP_FROM and IP_TO fields of the database are numeric representations of the dotted IP address. The formula to convert an IP Address of the form A.B.C.D to an IP Number is: IP Number = A x (256*256*256) + B x (256*256) + C x 256 + D So here is what I do in PHP: $resolvingip=sprintf(%u,ip2long($ip)); $resolved=$DB_site-query_first(SELECT * FROM country WHERE '$resolvingip' BETWEEN ip_from AND ip_to); $resolvecountry = $resolved[country_code]; so I type in: 213.21.158.96 and $resolvingip shows as: 3574963808 when I check $resolved[ip_from] I find out the SELECT statement looks up this line: 335544320 369098751 US UNITED STATES instead of looking up this line: 3574956032 3574972415 IT ITALY which really makes me think the SELECT statement is dropping the last digit... I tried ip: 10.25.215.30 and $resolvingip shows as 169465630 which looks up correctly since it is only 9 digits. When I try ip: 68.109.155.135 $resolvingip shows as 1148033927 but the SELECT statement drops the last digit and goes to a 9 digit again: 114803392 Any help is greatly appreciated.. Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Related to WAR - 1
My dear ckra -- ...and then [EMAIL PROTECTED] said... % % The War % By Eduardo Galeano Would you please keep this crap off of the php-db list (and, before I see it anywhere else, any other php list at the very least)? I am here to discuss php and nothing else unless it is related to php. If you want to show how you've used php to create an anti-war site, then that's great. If you want to ask for help in your php project praising GWBush, then do so. If you want to talk/evangelize/whine about war, however, then go and do it elsewhere. It is NOT welcome here. TIA :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Generating view of tree?
Craig -- ...and then Craig Kohtz said... % ... % The script I've included works for a table named structure with the % following fields: Sounds interesting. Care to actually post the script? ;-) I'd like to see it. TIA HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] compare php and perl
Mignon -- The short answer is that the two are fairly equivalent and if you're asking the question then you're not going to run up against the nitty gritty differences for a while. In general, I bet you get more PHP is better answers on this list ;-) Both can talk directly to databases, both are quick, and both are easy to use (and once you know one picking up the other is pretty easy because they are quite similar). Both are popular and many things are written for both because porting is pretty easy. That said, I would be inclined to point a new user who is only writing web pages and web scripts toward PHP because - you can, indeed, easily scatter your php all over your web site (even if some might not think that that's terribly pure :-) while doing so with perl takes a little more manual configuration - perl is incredibly powerful (not to say that php isn't, but...) and picking up php may be likened to learning to fly in a Cessna instead of a multi-engined jet even though I am a fan and user of both and often use perl because an existing script will translate so easily to a web page. For an advanced programmer I'd say to pick up bother because of the awesome depth of functionality available through CPAN, a collection of modules and tools for perl that already do, and generally quite well, anything most people are likely to want to do :-) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] compare php and perl
Scott -- ...and then NIPP, SCOTT V (SBCSI) said... % ... % correct any of my errors. One other big advantage of PHP is this mailing % list. The people in this list are quite knowledgeable and extremely % helpful. I honestly have not found a group this supportive and responsive Aha -- you obviously haven't found the beginners, beginners-cgi, and db lists at perl.org yet :-) % for my Perl scripting. (This last may sound like sucking up, but it's the % honest truth.) Hey, these *are* awesome lists :-) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] disable right-click in all frames.
Matt -- ...and then Matt said... % % 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 ... To answer your question, you might instead of calling the other content directly just have your script spit out the leading javascript and then passthru the actual file. Note that those of us who have javascript turned off can use the right mouse button all we want :-) It may not be worth your effort. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] How to produce the report using PHP?
Rokasa wrote: Hi there, I want to produce the report using the PHP but I don't know the PHP command. Or is it any third party software that can be called by PHP to produce the report? Is it anybody out there can help me. gotta do it the old fashion way, by writing it yourself... or you can ODBC it, and use ms access and it's report writer. -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php date manupulation functions
Rajesh Fowkar wrote: Hello, There seems to be very few date manupulation functions in php. In my php form I am displaying select combos for day, month and year. Now while updating the form I want to retrieve the date and take out day, month and year from that date and display the correct selection in the combo. I could not find any function like say day($dbdate); month($dbdate); year($dbdate); Am I missing something ? Is there anyway to accomplish the above ? or I will have to store these three values separatly in the database rather than as a date. yes, you are missing it. you need to do the opposite. first read this: http://www.php.net/manual/en/function.date.php and everything will become clear... btw, if the current date is jan 1, 2000, then $day = date (d); $month = date (m); $year = date (y); echo $day; // would return 01 echo $month; // would return 01 echo 4year; //would return 00 -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql +php
Hi I was wonder if any knows how 2 display sound clips held in a mysql database using a php page ? I have stored the urls of the clips in mysql database and I belive I need some like to (below) to display them but its not quite working. while ($row= mysql_fetch_row($result)) //retrieve a row and store in array $row { for($i=0; $imysql_num_fields($result);$i++) // echo (A HREF= $row[$i]); // any ideas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql +php
Thanks got it working -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: WG: [PHP-DB] Confirmation e-mail
you dont. your confirmation email will tell them once they are logged in with a random password your script made, then they can go into the profiles section and change the password. just have a boolean column that is set once they are confirmed. you can check that against another column that holds the value when they first signed up. Davy Obdam wrote: Hi Andreas, Thanks for you responce. I am also wondering how you would do that in the database, i have a table users in my MySQL database containing the users information that submitted when they registerd. Now i want to activate thier account only after they have clicked on the confirmation link... if possible without any additional tables in my db. I users do not confirm thier account i wanna remove thier data from the database after 48hours. Thanks for your time.. Best regards, Davy Obdam info@phpken wrote: hi, too please don't send password over the internet. better you ask the user if they click the link below your email. then the user get a formular and there you can ask him for his password. then you can make sure the emails wasn't read by other user. this is a secure method. -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] .htaccess
Matt -- ...and then Matt said... % % I have a php script that accesses a folder, and displays all the photos % inside the folder. I want to use this script to display images that people % upload from the anonymous ftp account. I know that when they upload a photo, % it goes into the: % % /home/username/public_ftp/incoming/ folder 1) Just change your script to point to this directory just like it points to any other folder. 2) Is the public_ftp/incoming/ folder available to the browser, or is it outside the DOCUMENT_ROOT tree? If the latter, you will have to serve up the images yourself rather than relying on img... tags to simply point to them. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg18501/pgp0.pgp Description: PGP signature
Re: [PHP-DB] How can i upload files
Gabriel -- ...and then Gabriel Gramajo said... % % Hi All, % Can anyone tell me how can i select and upload files using php. You can begin by not hijacking a thread and changing the topic. When you want to start something new, start a fresh message. You could next check the list archives; this comes up at least twice a month. After that you could take a look at the Fine Manual and read the Fine Example and try it out. That's all there is to it! % % Thanks in advance, % % Gabriel, HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg18431/pgp0.pgp Description: PGP signature
Re: [PHP-DB] List Server Configuration; Was [Import text file]
Mitch, et al -- ...and then [EMAIL PROTECTED] said... % % Well ... in fact, most lists that I've been on use the Reply-To header to % automate this. MOST email clients I have used do not recognize email as That doesn't make it right :-) % list email and while they have a Reply and Reply All option, I've never That doesn't mean they're doing it right :-) % seen a Reply-List option. That doesn't mean it doesn't exist :-) % % So ... what is right, and who is broke could be argued all day. The one % I've seen used the most would be implemented as a change to the list % server. I invite you to surf over to http://www.unicom.com/pw/reply-to-harmful.html and have a read on why this is such a bad idea. % % -- Mitch Now back to our regularly schedule discussions... HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg18438/pgp0.pgp Description: PGP signature
Re: [PHP-DB] Re: Something is fishy in my selection
Mathieu Dumoulin wrote: Oh crap, someone mailed me about having nulls in my field compared... you can no disregard this thread...its closed i got the culprit, it's a stupid NULL i found in a column reminds me of the time i had a query to look for 0 and 0. i forgot some values where 0... lol... -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] backing up databases
Chris -- ...and then Chris Payne said... % % Hi there everyone, Hi! % % I have way too many databases to backup manually or with PHPMyADMIN, how, using PHP with MySQL could I backup multiple databases easily? 1) What level of 'manual' is too much? 2) Are all of the databases on the server yours to back up, or only some of them? 3) Do you have access to the command line through your php script as might be expected, or are you somehow limited? 4) Do you have a user/password who can dump your databases? 5) Can you use cron to run jobs repeatedly? I'd write a script (php CLI, perl, shell, whatever) to do the dump and then just call it from your web click or, better yet, from a crontab. % % Any examples would be really appreciated :-) Answers first, grasshopper :-) % % Thank you. % % Regards % % Chris HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg18010/pgp0.pgp Description: PGP signature
Re: [PHP-DB] PHP-DB - ot browser compatibility
Peter, et al -- ...and then Peter Lovatt said... % % Hi Hi! % % I test on NS 4.75 and IE4 as a minimum browser spec. Those are too maximum, actually. % % I test on the following % % IE 4, 5, 5.5, 6.0 % NS 4.75, 7 (NS 6 has very low distribution and flaky table handling ) % Opera 5.0 and 6.0 % Mozilla 1.1 No lynx? bash-2.05a$ lynx --version Lynx Version 2.8.4rel.1 (17 Jul 2001) Built on freebsd4.5 Jan 23 2002 07:28:38 I'm crushed! ;-) HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg17912/pgp0.pgp Description: PGP signature
Re: [PHP-DB] Design suggestions - performance improvement
Matthew Nock wrote: Hi all, I am currently building a site for a cinema to display session times, film synopsis' etc... I have built the database as follows: TABLE: film_detail FilmID FilmName FilmRunTime FilmRating FilmSynopsis etc... TABLE session_data session_ID session_filmID session_StartTime session_Date normalize the SESSION_DATA more. i would: table:film_date fd_id fd_filmid fd_date table: session_data sd_id sd_fd_id (- foreign key) sd_starttime psuedo code: print movie info for (movie) select fd_date from film_date where fd_filmid = filmID print fd_date for (filmID - fd_date) loop select sd_starttime from session_data where fd_id = sd_fd_id print sd_starttime end loop next fd_date next movie film_detail has a 1 to many to film_date film_date has a 1 to many to session_data -- --- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySQL
Rodrigo Corrêa wrote: I´m new with MySQL, i´m just wondering if there is a way to get the IP from a MySQL Server, since i acess this by localhost in the webserver even if you could, the MYSQL admin probably set your account to access your data with a LOCALHOST permission only... so if you try to access your data, the system would not let you in. this is common. -- --- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] áéíóúÁÉÍÓÚñÑ
How can I query this characters 'áéíóúÁÉÍÓÚñÑ' from a MSSQL DB with PHP??? Actually I obtain this: ' '¡¢£µÖà餥'!!! Thanks Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Users on line
OK, guys, thanks!! I'll try it and then I'll tell you!!! Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Peter Lovatt [mailto:[EMAIL PROTECTED]] Sent: Friday, January 03, 2003 7:10 PM To: Bernain, Fernando G.; 'Peter Beckman'; Hutchins, Richard Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Users on line Hi My bank uses two processes. If a user is inactive for more than about 5 minutes it forces you to log in again. This is done server side and just does not allow you to do anything if your last activity was more than 5 minutes ago. It probably also marks the session as logged out. It also uses JavaScript body onUnload='' to log you out when you close the window. Not sure if this works when you just close the browser. I do have a suggestion, which may or may not meet your needs. When the user logs in, open a popup window and set focus to the main window body unload=self.focus() so the popup becomes a popunder. Using a header or meta tag refresh the popunder once a minute and log the session as already discussed, but with a timeout of 2 minutes, so it will be up to date. This will tell you that the user has a browser open. This might be enough for your needs If not you could use body onUnload='' to post a form to the popup window when the main window closes. This logs out when the user closes the main window. The only exception will be if the user navigates away from the site. If you need to, you could prevent this by displaying site content in another popup window with no navbar and no external links. http is stateless, so you cannot do a true session like Messenger but the above is reasonably close :) HTH Peter --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel. 0121-242-1473 International +44-121-242-1473 --- -Original Message- From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]] Sent: 03 January 2003 20:31 To: 'Peter Beckman'; Hutchins, Richard Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Users on line I'm thinking in something similar to ICQ or MSN. This is an app for a few number of users (less than 50) but they need to know who are online when they are working in the app too!!! Maybe I can use the table online and insert then name of the user when he login the app... but I still have the problem of the logout... I was looking for something (like a function?) in apache or php who tells me the open sessions at a moment... Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED]] Sent: Friday, January 03, 2003 4:49 PM To: Hutchins, Richard Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Users on line I agree; it'd be nice if there was some sort of code that'd be executed when someone closed their browser. There is the javascript on_exit() or something where the user, when they leave a domain, is executed. However, this only works if they click off the site, not if they close their browser. Plus if they go to another site and come back within 5/10/15 minutes, are they still considered logged in? It's fairly impossible to keep track of when users are or are not using the site that is not really complex. What if they are reading an article, run to the restroom, finish reading the article and then click on another page? I figure they are idle after 15 minutes. If they continue to surf the site in an hour or two, their session will be updated (if your sessions last long enough, or if not they'll probably be automatically re-logged in which case they'd be updated/re-inserted in the online table), and will once again be counted as a person online. One example is forcing people to be logged out after 10 minutes of inactivity. Bank of America does this, most likely using javascript. However, if yahoo! did this when I was reading my mail and I stepped away, I'd be annoyed. Most sites allow you to be logged in forever (Remember me) so forcing people to log out just to be able to count who is online seems silly. If you just want to keep track of how many people are logged in, I'd just say that logged in is defined as having an active logged in session that was active in the last 5/10/15 minutes. I'm almost positive that method is how most web sites determine time online. Peter On Fri, 3 Jan 2003, Hutchins, Richard wrote: How would the online table be maintained if a user simply closes out the browser without actually logging out properly? I'm not at all experienced with sessions, but closing the browser should terminate the session, correct? Bernain may want to delete from his online
RE: [PHP-DB] displaying a MySQL date in a different format
I dont know if its the best solution, but I made a function that cut the date: function sqldate($fecha) { $dia=substr($fecha,0,2); $mes=substr($fecha,3,2); $anio=substr($fecha,6,4); $fechasql=$anio./.$mes./.$dia; return $fechasql; } You input 12/01/2002 and output 2002/01/12 Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Ali McLeod [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 04, 2003 8:27 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] displaying a MySQL date in a different format Can anyone help me. I am trying to display a date in a different format from that stored in a MySQL database. MySQL forces you to store it as -mm-dd but I want to display it as dd-mm-, or dd- Any ideas? Many thanks in advance Ali McLeod [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Special characters
I'm working with MSSQL7.0 Apache 1.3.19 and PHP4.2.3 When I select a table with this kind of characters: ó The output is ¢... I have the same problem with the others vocals (á-é-í-ú) What can I do??? Forgot the spanish??? Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Special characters
I can't modify the character set of my MSSQL... (Character Set = 1, iso_1 ISO 8859-1 (Latin-1) - Western European 8-bit character set.) And I NEDD the á-é-í-ó-ú-ñ Any idea? Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Andrey Hristov [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 2:30 PM To: Bernain, Fernando G.; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Special characters Fernando, try to store you data in unicode (utf8) for example. You iconv to transform if it is needed. Andrey - Original Message - From: Bernain, Fernando G. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 06, 2003 7:25 PM Subject: [PHP-DB] Special characters I'm working with MSSQL7.0 Apache 1.3.19 and PHP4.2.3 When I select a table with this kind of characters: ó The output is ¢... I have the same problem with the others vocals (á-é-í-ú) What can I do??? Forgot the spanish??? Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Is MySQL available from my host.
Robert Wagner wrote: At www.download.com I located PHP Triad, but I'm a bit nervous, although the overall ratings for the package are high. Here are my concerns: 1) Some people couldn't install it all. 2) Apparently it MUST be installed on drive C. While I have over 500 MB in C:, it's merely my boot drive in a multi-boot installation. I normally boot to my WinXP partition. I'd rather install it elsewhere. 3) I do want to install it under Win XP. 4) I already have MySQL installed, and I'm guessing that it's a later version. Do any of these represent serious barriers to installing PHP Triad? another WAMP that i use is www.foxserv.net. they use apache 2.0 and a 4.2.x php. forget the mysql version. but why not install it yourself. php requires about 3-4 lines added to apache's conf file. php requires maybe 2-3 mods in the it's ini file. mysql is a no brainer install... i recently upgraded my foxserv install by doing each one manually. after a few hours of almost killing myself, i got it down to about 15 minutes. that's total for all 3. i didnt want to go through foxserv since they install perl and a few others i didnt want. (plus the first time, it nearly killed my programming machine...). -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Users on line
I'm working in an app that requires to know who are on line. When the user login the app, I use session in order to storage de name and login. Its posible to do this??? Thanks! Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Users on line
I'm thinking in something similar to ICQ or MSN. This is an app for a few number of users (less than 50) but they need to know who are online when they are working in the app too!!! Maybe I can use the table online and insert then name of the user when he login the app... but I still have the problem of the logout... I was looking for something (like a function?) in apache or php who tells me the open sessions at a moment... Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED]] Sent: Friday, January 03, 2003 4:49 PM To: Hutchins, Richard Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Users on line I agree; it'd be nice if there was some sort of code that'd be executed when someone closed their browser. There is the javascript on_exit() or something where the user, when they leave a domain, is executed. However, this only works if they click off the site, not if they close their browser. Plus if they go to another site and come back within 5/10/15 minutes, are they still considered logged in? It's fairly impossible to keep track of when users are or are not using the site that is not really complex. What if they are reading an article, run to the restroom, finish reading the article and then click on another page? I figure they are idle after 15 minutes. If they continue to surf the site in an hour or two, their session will be updated (if your sessions last long enough, or if not they'll probably be automatically re-logged in which case they'd be updated/re-inserted in the online table), and will once again be counted as a person online. One example is forcing people to be logged out after 10 minutes of inactivity. Bank of America does this, most likely using javascript. However, if yahoo! did this when I was reading my mail and I stepped away, I'd be annoyed. Most sites allow you to be logged in forever (Remember me) so forcing people to log out just to be able to count who is online seems silly. If you just want to keep track of how many people are logged in, I'd just say that logged in is defined as having an active logged in session that was active in the last 5/10/15 minutes. I'm almost positive that method is how most web sites determine time online. Peter On Fri, 3 Jan 2003, Hutchins, Richard wrote: How would the online table be maintained if a user simply closes out the browser without actually logging out properly? I'm not at all experienced with sessions, but closing the browser should terminate the session, correct? Bernain may want to delete from his online table every hour or so to catch those people who have not properly logged out (assuming the delete from online... query is only fired when they click on a log out button). I'm not slagging Peter's recommendation. I was thinking this solution through as well, but was a bit stuck when it came to users just closing their browsers without logging out. -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED]] Sent: Friday, January 03, 2003 2:32 PM To: Bernain, Fernando G. Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Users on line Create a new table named online: id time (int unix timestamp) uid (int probably, user ID of user in question, relating to a user info table?) sessid (char 32 I think) When the user logs in, I assume you set the session. Insert a row with the current time (unix_timestamp(now()), User ID and the output of session_id() in PHP. This way you can run a query on that table at any time in one of two ways. 1. select count(id) from online where time=(unix_timestamp(now())-900) This will give you the number of people who at least logged in in the last 15 minutes. This isn't very accurate though... so 2. If not already, put sessions in your SQL table. This way you can run a query like (and John Holmes, please feel free to clean up my joins, i suck at them): select count(*) from online,sessions where online.sessid=sessions.sessid and sessions.date=(unix_timestamp(now())-900) This will give you the number of users who have done anything on the site in the last 15 minutes. Change the 900 to 600 or 300 for 10 or 5 minutes respectively. Every week or so you'll want to delete from online where time=[some number here, unix_timestamp(now()) minus how long you want to leave those entries there]. Depending on how often you want to do this and how busy your site is and how focused on performance you are, I'd advise running it once per minute and every time someone logs in, rather than once per page view, and put the values generated into a text file and read it in with readfile(). Peter On Fri, 3 Jan 2003, Bernain, Fernando G. wrote: I'm working
RE: [PHP-DB] Re: NewB: Return New Record ID...
This is from de books online (MSSQL). @@IDENTITY (T-SQL) Returns the last-inserted identity value. Syntax @@IDENTITY Return Types numeric Remarks After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY contains the last identity value generated by the statement. If the statement did not affect any tables with identity columns, @@IDENTITY returns NULL. If multiple rows are inserted, generating multiple identity values, @@IDENTITY returns the last identity value generated. If the statement fires one or more triggers that perform inserts that generate identity values, calling @@IDENTITY immediately after the statement returns the last identity value generated by the triggers. The @@IDENTITY value does not revert to a previous setting if the INSERT or SELECT INTO statement or bulk copy fails, or if the transaction is rolled back. Examples This example inserts a row into a table with an identity column and uses @@IDENTITY to display the identity value used in the new row. INSERT INTO jobs (job_desc,min_lvl,max_lvl) VALUES ('Accountant',12,125) SELECT @@IDENTITY AS 'Identity' Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 2:06 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... for MS SQL and Oracle does anyone know a more reliable way to do this than select max(ID) immediately after the insert? It seems silly that I'd have to take my chances that another has been inserted in between. Ryan -Original Message- From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 1:52 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: NewB: Return New Record ID... Try $last=mysql_insert_id(); Jochem Doug Coning wrote: Hi all, How do I do this: I need a PHP page that simply creates a blank record so that I have the record's ID (which is automatically generated). That same page then needs to return the record ID back so that I know what the ID is. I will later allow that record's information to be populated based on the ID it first returned. How would I do this? Thank you, thank you! Doug Coning -- 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 Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: NewB: Return New Record ID...
You can use this inside an stored procedure, for instance: CREATE PROCEDURE SP_INSERT_TRANSACCION @transacfecha datetime, @observacion char(100) AS INSERT INTO Transaccion(transacfecha, observacion) VALUES( @transacfecha, @observacion ) SELECT @@IDENTITY AS 'nrotrans' END In this example, I insert two values with this sp in a table with and Identity column. So, the SP return the value of the transaccion generated... You've got the idea??? Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 2:36 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... This doesn't work as expected through ODBC... it does not seem to return any value... Ryan -Original Message- From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 10:09 AM To: Ryan Jameson (USA) Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... This is from de books online (MSSQL). @@IDENTITY (T-SQL) Returns the last-inserted identity value. Syntax @@IDENTITY Return Types numeric Remarks After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY contains the last identity value generated by the statement. If the statement did not affect any tables with identity columns, @@IDENTITY returns NULL. If multiple rows are inserted, generating multiple identity values, @@IDENTITY returns the last identity value generated. If the statement fires one or more triggers that perform inserts that generate identity values, calling @@IDENTITY immediately after the statement returns the last identity value generated by the triggers. The @@IDENTITY value does not revert to a previous setting if the INSERT or SELECT INTO statement or bulk copy fails, or if the transaction is rolled back. Examples This example inserts a row into a table with an identity column and uses @@IDENTITY to display the identity value used in the new row. INSERT INTO jobs (job_desc,min_lvl,max_lvl) VALUES ('Accountant',12,125) SELECT @@IDENTITY AS 'Identity' Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 2:06 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... for MS SQL and Oracle does anyone know a more reliable way to do this than select max(ID) immediately after the insert? It seems silly that I'd have to take my chances that another has been inserted in between. Ryan -Original Message- From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 1:52 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: NewB: Return New Record ID... Try $last=mysql_insert_id(); Jochem Doug Coning wrote: Hi all, How do I do this: I need a PHP page that simply creates a blank record so that I have the record's ID (which is automatically generated). That same page then needs to return the record ID back so that I know what the ID is. I will later allow that record's information to be populated based on the ID it first returned. How would I do this? Thank you, thank you! Doug Coning -- 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 Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: NewB: Return New Record ID...
It's not a bad idea to encapsulate de querys (selects, updates, inserts,...) in SPs... Good luck with the select max()!!! PD: If you dont want/can use identitys, maybe you can use another table where you store de next number of transaction. So its easy to update this number (plus one) and make a select inmediatley to obtein the number... its a bit strange but it works!!! Buena suerte!!! Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 2:46 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... The problem is I have hundreds of tables each with a different column list and syntax, I don't want to have to create a SP for each table. There really has to be an easy way to do this. Now my sql server is saying this: Connection is busy with results for another hstmt, SQL state S1000 . it looks like I'll have to take my chances with select max() Ryan -Original Message- From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 10:43 AM To: Ryan Jameson (USA) Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... You can use this inside an stored procedure, for instance: CREATE PROCEDURE SP_INSERT_TRANSACCION @transacfecha datetime, @observacion char(100) AS INSERT INTO Transaccion(transacfecha, observacion) VALUES( @transacfecha, @observacion ) SELECT @@IDENTITY AS 'nrotrans' END In this example, I insert two values with this sp in a table with and Identity column. So, the SP return the value of the transaccion generated... You've got the idea??? Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 2:36 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... This doesn't work as expected through ODBC... it does not seem to return any value... Ryan -Original Message- From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 10:09 AM To: Ryan Jameson (USA) Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... This is from de books online (MSSQL). @@IDENTITY (T-SQL) Returns the last-inserted identity value. Syntax @@IDENTITY Return Types numeric Remarks After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY contains the last identity value generated by the statement. If the statement did not affect any tables with identity columns, @@IDENTITY returns NULL. If multiple rows are inserted, generating multiple identity values, @@IDENTITY returns the last identity value generated. If the statement fires one or more triggers that perform inserts that generate identity values, calling @@IDENTITY immediately after the statement returns the last identity value generated by the triggers. The @@IDENTITY value does not revert to a previous setting if the INSERT or SELECT INTO statement or bulk copy fails, or if the transaction is rolled back. Examples This example inserts a row into a table with an identity column and uses @@IDENTITY to display the identity value used in the new row. INSERT INTO jobs (job_desc,min_lvl,max_lvl) VALUES ('Accountant',12,125) SELECT @@IDENTITY AS 'Identity' Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 2:06 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: NewB: Return New Record ID... for MS SQL and Oracle does anyone know a more reliable way to do this than select max(ID) immediately after the insert? It seems silly that I'd have to take my chances that another has been inserted in between. Ryan -Original Message- From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 1:52 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: NewB: Return New Record ID... Try $last=mysql_insert_id(); Jochem Doug Coning wrote: Hi all, How do I do this: I need a PHP page that simply creates a blank record so that I have the record's ID (which is automatically generated). That same page then needs to return the record ID back so that I know what the ID is. I will later allow that record's information to be populated based on the ID it first returned. How would I do this? Thank you, thank you! Doug Coning -- 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 Email Disclaimer
RE: [PHP-DB] Questions regarding primary keys, updates, and autoincrement
Michael, why do you need to link de manufacturer table with de product table? I think that you have to clarify the design of your db and your business rules first... for instance, if you have to reuse the IDs (the barcode and de manufa cturer ID), then you will create new tables in order to preserve your history (I supouse that it will be interesting to know that in 1999 the transactions of the ID 111 corresponds to Michael!!). Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] -Original Message- From: Michael Conway [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 21, 2002 9:15 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Questions regarding primary keys, updates, and autoincrement I have been working on an e-business project and have a product table and manufacturer table that are linked via barcode and a manufacturer ID (both primary keys in the tables mentioned). For now, I have been setting the manufacturer's ID manually, primarily for that rare instance where a manufacturer and its products are dropped from the database, but the number should be reused. Is it better or possible (without complications) to use autoincrement and simply delete the product information and manufacturer information while leaving the ID column intact for a later update operation with a new manufacturer and its products? I suppose only one table (the linking table?) should be set to autoincrement and that ID number used to populate the remaining tables depending upon that number for insert operations. The code is probably simple, but my head is already swimming. I suppose what I am looking for is best practice advice from seasoned db administrators. A second question, which may be moot if autoincrement is the best way to go, is why I keep getting an duplicate key error despite using IGNORE in my mysql update scripts. Keep in mind that the update is completed anyway (even without using IGNORE) but the abort prevents an acknowledgement script which is essential in unregistering sessions crucial in future update operations. Thanks. Michael Conway [EMAIL PROTECTED] (703) 968-8875 Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: copying data
There is a utility called MyAcess it is like MyODBC and I have used it to do this exact thing. It works very well. I believe you can find it on Freshmeat. Thomas G. Knight [EMAIL PROTECTED] http://www.slaponline.com -Original Message- From: David Eisenhart [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 15, 2002 4:51 AM To: [EMAIL PROTECTED] Subject: Re: copying data If its a 'one off' kind of transfer then i'd recommend that you consider doing what I did - export the data from Access to text file(s) and then import from the text file(s) into MySQL (phpMyAdmin is v handy for this lind of task) {Of course if you want a more automated solution then this is not the way to go) David Eisenhart If I have a microsoft access file .mdb on my server, can I use a php page to move the data from the file to a mysql db? Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Crystal Report - PHP4 / Report Generator
I'm working in a migration of an application from MSSQL7-VB6.0-Crystal Reports to MSSQL7-winApache-PHP4. I'm having problems with the reporting, because I cant find an user friendly solution for the creation of reports with PHP (I need something similar in functionality and look and fell to the Crystal Reports). I tried with a class report wrote in PHP4 but I saw that I'll have a long way to obtain a minimum level of functionality... Am I following the correct way in solving this problem??? Have anybody of you developed something similar to a Report Generator??? Does exist any application that I could use??? Thanks Fernando Bernain Senior A Business Process Outsourcing KPMG Argentina Tel: 54 11 4316 5754 Fax: 54 11 4316 5734 [EMAIL PROTECTED] Email Disclaimer The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Optimizing
This varies from database to database. I would suggest reviewing the documentation on your database type. For review here is some information on indexing from PostgreSQL (my database of choice): http://www.postgresql.org/idocs/index.php?indexes.html That should give you some ideas on how indexing works. HTHs On Sun, 2002-11-10 at 18:46, Chris Payne wrote: Hi there everyone, How does indexing work, and does it speed up small / average size DB's of around 20,000 records, with 12 columns per record? (Some columns being paragraphs of text). Also, do you create an index on everything or just 1 item or or or :-) I've not looked at indexing but think it's time to start, but in a way even I can understand so I thought i'd ask you all here :-) Thanks Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci functions
Compile php with the OCI configuration option. That will work with oracle9i. On Thu, 2002-11-07 at 08:32, Maziar wrote: Hi everybody What should I do for useing OCI functions of oracle 9i in PHP4. I think I should recompile PHP with somthing but I don't know with what and how should I do this. I installed oracle 9i on SUSE linux 8.0. Best Regards Maizar -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] first Array value duplicating..
I would suggest doing a var_dump of $order_index and see what is in there. Plus, you should take out the values in the form arrays... Just do: name=order_index[] On Thu, 2002-11-07 at 15:24, Aaron Wolski wrote: Hi All, In a form I have checkboxes associated with order records. The checkboxes are for deleting order records (should a client choose to do so). It looks like this: form name=form action=process_bank.php method=POST input type=hidden name=order_index[0] value=1 td class=cartlink align=centerinput type=checkbox name=delete[0] value=1/td input type=hidden name=order_index[1] value=3 td class=cartlink align=centerinput type=checkbox name=delete[1] value=1/td input type=hidden name=order_index[2] value=8 td class=cartlink align=centerinput type=checkbox name=delete[2] value=1/td input type=hidden name=order_index[3] value=12 td class=cartlink align=centerinput type=checkbox name=delete[3] value=1/td /form Now.. when the process button is pressed the information is carried off to the process_bank.php script. Lets assume for this example.. I selected the checkbox delete[0] (which equals value 1) and delete[3] (which equals value 12). In the script I have this code: for ($i=0;$isizeof($order_index);$i++) { $orderQuery = db_query(SELECT id FROM TestOrderTable WHERE id=.$order_index[$i]); $orderResult = db_fetch($orderQuery); if ($delete[$i] == 1) { $ids .= $orderResult[id]; echo $ids; } } The echo'd value that I get is 1,1,12 when it should be 1,12. When only ONE checkbox is selected I just get the one value displayed (i.e. if I selected the first checkbox the echo'd value would be 1). Does anyone know why the first value is being duplicated on a multiple select but not on a single select? Sorry if this sounds confusing :( Aaron -- .: B i g D o g :. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Argh!!!! Help with something o-f-f-t-o-p-i-c
You need to get the element by name and then do the confirmation... On Thu, 2002-11-07 at 21:23, Aaron Wolski wrote: Sorry for the OT post y'all.. but I can't find this answer - well not without major major code information that I can't figure out! Basic? I have a series of checkbox arrays like: input type=checkbox name=delete[] value=$row[id] These are for different records in my DB. Now... I want to check (javascript - this is the off topic part :P) if one of them checkboxes HAS been selected and if so display a confirm message. This is what I have: function checkform(f) { var el, e = 0, firstBox, msg = 'You are about to delete something'; while (el = f.elements[e++]) if (el.type == 'checkbox' el.checked) { return confirm(msg); return false; } return true; } Now... this DOES work but with one problem.. I have another checkbox within the form that does something different but the confirm() will display if EITHER checkboxes are selected and it SHOULD ONLY be on the delete[] checkbox. I know.. waaay off topic but I don't know how to reference the names that are arrays in javascript :( Sorry again all. Aaron -- .: B i g D o g :. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms question..
1. document.formname.elementname.focus(); Example: if my form has a name of testform and the first element is fname... then in the body tag i would do this... body onload=document.testform.fname.focus(); 2. Yeah, you need to use the select() method... so document.testform.element.select(); Example: input name=example value=N/A onfocus=document.testform.example.select(); That should work...or it might have to be in a function... 3. It should do that for you with the submit button...what browser are you using? 4. use the align attributealign=left On Sun, 2002-10-20 at 12:27, James Hatridge wrote: Hi all... When I have an input form I must click on the first input field. Is there anyway to have it active when the form loads? #2 When I tab down to the next input field, is there anyway to have it highlight what is in the field (ie the default data) so that it will overwrite it? #3 How can I get the form to submit when I hit the return button? Right now I have to click on the button with my mouse. #4 How can I get a column of numbers to left justify? Thanks JIM -- Jim Hatridge Linux User #88484 -- BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle problem
You might want to play with the magic_qoutes... On Wed, 2002-10-16 at 01:50, [EMAIL PROTECTED] wrote: Hi, Has anyone out there using PHP and Oracle come across this problem? I have a text area that allows free-form text that I store in a varchar2 column. I have problems with apostrophes in the free-form text. When users put in an apostrophe the SQL fails. If I force 3 apostrophes (the usual Oracle method of embedding apostrophes) the SQL fails. The only way to get round the problem is to strip them out (which I consider a work-around not a fix). Can anyone help? Neil Morgan Admin Computing Section University of Brighton Tel: +44 (0) 1273 64 3930 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Enhancement of script
start with the easy part. to display 3 months at a time, just do a 3 cell table where each cell contains a month. assuming you can write code to do one month, how is 2, 3 or even more months that difficult? as for doing multiple days, either draw a month with check boxes on them. or have a pull down tool that can you do mutiple selections. Ray Healy (Data Net Services) wrote: Dear All I have recently downloaded a calendar from CST (which is no longer supported ) and I have made a few changes to the script. The calendar will be used to see when something is booked and you can assign messages to it as well which the general user cannot see. In this respects I have created 2 pages - welcome .php for the general viewer and admin_welcome for the updating of the calendar. What I would like to do is to be able to enter multiple dates in at the same time - either saying from a start date for so many days or from a start date to an end date. After spending hours looking at the code and in this forum I cannot seem to get it right - basically I cannot do it. I was wondering if someone could have a look and tell me where I am going wrong. I have attached the files to this email along with the mySQL table file in case another column needs to be added. You can see the script running at www.matrix-hosting.co.uk/prestige/welcome.php for the general view and www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side. Any help would be appreciated Ray P.S. if any one also knows how to get it to display a 2 or 3 months at a time or even a year this would also be a bonus as I have tried to do this as well. -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to display tree structure from database???
Pierre-Alain Joye wrote: Hello, http://membres.lycos.fr/sqlpro/Tree/SQL_tree.htm provides a good way to store trees in a DB, docs are in french, nut sqlimages are universal. hth pa run this URL through the translator at http://babel.altavista.com and you have a 90-98% accurate translation. handy site to keep around... -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: securing directory tree and allowing PHP to work
bmw wrote: You could restrict autoindexing through apache's httpd.conf. Look it up in apache's manual. Milan This is not my personal web server. It is a remote ISP which provides PHP and MySQL support. I cannot control the HTTP or PHP server build configurations...They have autoindexing built into the Apache server. just add an .htaccess file in that directory saying no one but LOCALHOST has access to it... http://www.javascriptkit.com/howto/htaccess5.shtml -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database question
Shiloh Madsen wrote: I was wondering if there were any good documents out there about good database design...I know the basics of creating tables, setting data types and such, and now i want to know how to use it to the best effect...generating logical, streamlined tables, etc. have you got a lifetime? seriously, just google it. say relational database design and start from there. or pick up some college text book on that subject As a side-related note, i have a few tables now that call for some data which could be quite lengthly, say 3-6 paragraphs worth of text. what would be the best data style and length for this kind of field? you can use either TEXT, MEDIUMTEXT or LONGTEXT. 64K, 16 million and 4 billion bytes, respectively... the downside is the space taken up when the actual data is less than the field size. then there's VARCHAR. the downside is that it's limited to 255 bytes... good news is that it's N+1 byte size. -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] authenticating methods...
i was curious as to which methods you are authenticating your users? for example, i'm using apache, mysql and php in a win2k box. i want to maintain my own table of users and authenticate from that. do you have a single user with just enough rights do a SELECT? and then have another account for the other tasks? or a single user that does everything including the INSERTS? and where are you storing the username and password? in the code itself or call it via the INCLUDE statement? thanks... -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] select distinct with all columns
you maybe using it the wrong way. read the doc: russ arbuthnot wrote: I have a mysql table named equipment with 11 columns named: id, staff_member, class, type, manufacturer, model, description, picture, created, modified, and published. I'm trying to write a select statement similar to this: SELECT DISTINCT type FROM equipement WHERE class = microphones; yet shows all 11 columns of the selected rows rather than just the type column. The only way I know how to show all the columns is to use SELECT *, or to list all the columns manually like SELECT id, type, class, ... etc. But when I tried doing this: SELECT DISTINCT type, id, staff_member, class, manufacturer, model, description, picture, created, modified, published FROM equipment WHERE class = microphones; I just got the exact same answer as if i would have done this: SELECT * FROM equipment WHERE class = microphones; so it didn't help. Can anyone offer a hint? Thanks, russ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] oops...Re: [PHP-DB] select distinct with all columns
oops, i accidentally sent it without finishing... anyway, what i wanted to say was DISTINCT, at least how i learned it, was working with rows instead of colums: http://www.mysql.com/doc/en/DISTINCT_optimisation.html is there a reason why you dont want to list the columns? russ arbuthnot wrote: I have a mysql table named equipment with 11 columns named: id, staff_member, class, type, manufacturer, model, description, picture, created, modified, and published. I'm trying to write a select statement similar to this: SELECT DISTINCT type FROM equipement WHERE class = microphones; yet shows all 11 columns of the selected rows rather than just the type column. The only way I know how to show all the columns is to use SELECT *, or to list all the columns manually like SELECT id, type, class, ... etc. But when I tried doing this: SELECT DISTINCT type, id, staff_member, class, manufacturer, model, description, picture, created, modified, published FROM equipment WHERE class = microphones; I just got the exact same answer as if i would have done this: SELECT * FROM equipment WHERE class = microphones; so it didn't help. Can anyone offer a hint? Thanks, russ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] best way to stare true, false
if you are storing a bunch of T/F, you can store 8 of them into a single byte... each bit position will represent one question... you just have to do some BIT manipulation on your end... andy wrote: Hi there, I am searching for the best way to store true or false inside a MySQL DB. With best I mean the most data efficient way and in the same time the best for fast searching later on the table to find all which are false, or true. I think I did read something about a way to do this with ENUM, but cant remember where and how, all tryes did not succeeed so far. -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] JOIN in embedded query
since you didnt list what type DB you are using, i assumed MYSQL. and MYSQL doesnt have sub SELECTs... :( http://www.mysql.com/doc/en/UPDATE.html the syntax lists ...WHERE where_condition... Michael Hendsbee wrote: UPDATE Emails SET Sent = 'T' WHERE ID = (SELECT Emails.ID FROM Emails RIGHT JOIN KeyWords ON Emails.ID = KeyWords.EmailsID) LIMIT 250 I am getting an error, and I am quite certain that it is my syntax -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed
you need a second REQUIRED parameter: mysql_result (PHP 3, PHP 4 ) mysql_result -- Get result data Description mixed mysql_result ( resource result, int row [, mixed field]) as copied from php's doc site... http://www.php.net/manual/en/function.mysql-result.php Manoj Japher wrote: hi, I have started working with PHP-MySQL recently. I have been getting a warning message which i am not able to debug. Could some one pls help me out? The message is Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/local/apache2/htdocs/verify.php on line 37 The code is @$db=mysql_pconnect(localhost:/var/lib/mysql/mysql.sock,,); if(!$db) { echo The Server is Busy. Please Try Later ; exit; } mysql_select_db(userinfo); $query = select * from userinfo; $mysql_results = mysql_query($query,$db); line 37:$num_result = mysql_num_rows($mysql_results); if($num_result == 0) { echo PInvalid Username or Password entered/P; exit; } Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] 2 groups of random result pls help...
did you mean you need help with an sql query for this? sounds like select id, group, name from MYTABLE order by group; since i cant read your mind and you didnt specify anything else and since this is a php-db mailing list, hope that's what you are asking for... of course i could me a mile off... [EMAIL PROTECTED] wrote: Hi.. I need to get 2 groups of random result with 1 group always on top of the other. Can anyone help me with this please.. Something like id|group|name 21john 51smith 32 1sara 12 1michael 12don 92beth 42bob -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Comparison with formatted numbers
try the good ol' SETTYPE function to set the variable type from string to numeric and visa versa... http://www.php.net/manual/en/function.settype.php Terry Romine wrote: I've run into a sticky case where my query is failing (PHP4.x/MySQL). I have a table where the price value is imported from an external source, so I can't change it on the fly, and they embed thousands seperators (in my case ','). When I try to do a query such as .. where price = '25' .. if finds values that meet or exceed that value (returns some in the range of 2,500,000. I gather that it is failing because of the comma (the price field contains values of '2,500,000'). Is there a function that I can use to force the price format to integer before/during the query? Or would it work if I did a number_format on the test value? ie: '.. where price = '200,000' ..' Help would be appreciated. Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: please help.. serial number generator
use the MD5 function and just take the 1st 10 chars or better yet, once you have the MD5 value, use a wacky routine to take the first 10 odd position values... since each time you run the function, it will always return the same value (given the same string parameter...). [EMAIL PROTECTED] wrote: I need to create some kind of 10 digits serial number where I can generate and check that it is valid. Sort of like a checksum.. Jj Harrison [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... if u are looking for a simple random string try this php: echo md5(time()); or md5() a random number your choice. md5() genetates a one way non-reversable hash. which could be kept in a db. here is an example of the md5 hash of my library card number: 11d560821fb027c227d837df53a5a73a md5() is often used to store passwords and make them non-viewable. if you are just looking for a unique number an auto-increment coloumn in mysql or what ever should do it. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Rainydays Sunshine [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Any ideas how to generate a unique serial number that you can check that it's valid.. Thanks... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connect to MySql DB on diferent domain
first, get a user account on that DB outside your domain. then when making the connections, just use that on the mysql_connection () function... should be no different that using LOCALHOST... the trick is the user account with the appropriate (and should be limited) rights... M. Couto wrote: Hi, Im using PHP 4.0 and MySQL and I have a PHP procedure on one site that need to connect to a MySql database outside this domain, I need to append records in a database on a different domain. How can I do this? I will apreciate if anyone give me some help or a simple example how to do this? -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] XML
MySQL has xml support...have you looked at the docs at mysql.com for anything that might help you input the data directly... B i g D o g - Original Message - From: Peter Lovatt [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, June 27, 2002 3:03 PM Subject: [PHP-DB] XML Hi I am looking at a project using XML to import and export data into MySql directly or using php. The datasets are quite large (40-50 million records) I haven't used XML before. Does it take long to work out how to use php/XML? Are there any problems working with large datasets? Thanks Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 27 June 2002 17:43 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Re: PHP and msql Error The error is in your MySql statement. Sounds like you are calling the wrong data field / column. Check you spelling and syntax to make sure all of that is in order. If you can't find it, copy it and post it. We'll help you out gl -- Seth Comp Boy wrote: I am getting the following error: Warning: Supplied argument is not a valid mSQL result resource in /usr/local/apache/htdocs/inc/listings.inc on line 24 listings.inc: 24 $numRows = msql_numrows( $result ); The manual on php.net says that it takes no variables msql_numrows(void) however it says it is another version of msql_num_rows(int msql); The code I am trying to run, runs perfectly fine on another one of our systems. I was just setting up a development server and now I am getting this problem. The specs are the same except for the version of Apache production is 1.3.9 and development is 1.3.26 PHP vesrion 4.1.2 ./msqladmin version Version Details :- msqladmin version 2.0.11 mSQL server version 2.0.11 mSQL protocol version 23 mSQL connection Localhost via UNIX socket Target platform Linux-2.2.14-5.0-i686 PHP was configured: ./configure --with-apxs=/usr/local/apache/bin/apxs --with-msql msql was a default install. Does anyone know what I did wrong? Do I need to recompile with some different options? TIA Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] CGI Error - Need Help
I had to reinstall PHP SQL, now whenever I run a PHP script I get the following error, can someone please help. Thanks CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] new php developer
Hi, At 12:17 AM 2/7/2002 -0500, John George wrote: I am a student a the University of Pittsburgh, and a new php developer. Is it possible to have a mysql database that is made up of html documents that can be accessed using php? This question may sound strange, but I'm not sure of any other way to say it. Not strange, sounds like a content management system... Store the HTML in a mysql TEXT field or like... (make SURE to use addslashes() before inserting the data) Another question I have was, is it possible to have php recognize a user, by say password or ip address, and determine which which files or links to show them. Example, say I had a user Joe. When Joe accessed the password protected directory, he would be prompted to a page where php would then recognize Joe and then create a list of files (links) that he would be able to access. Sure, you need to look into session management probably... I have written a system like that from scratch, but there may be easier ways... Is php the right scripting language for this job? DEFINITLY Thank you for your time, it is greatly appreciated. John George [EMAIL PROTECTED] -Jason Garber IonZoft.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mass insert to database
See the set_time_limit() function in the php manual. -Jason Garber IonZoft.com At 10:22 AM 2/4/2002 +0800, J-E-N wrote: hello all, i'm trying to make a script where i can do a mass insert to database (4,000 entries) and then send confirmation email to each of the entry's email address stating that their record has been inserted to database. My problem is, when i use a while loop the page time-out on the 300th entry. please help. thanx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] counting with CURDATE() - please help!
if you have a date column 'birthdate' SELECT (birthdate + INTERVAL 7 MONTH) as birthdate FROM yourtable WHERE ... Look at the date and time functions in the MySQL manual. -Jason Garber IonZoft.com At 02:28 PM 1/27/2002 +, DL Neil wrote: Hello Sander, I want to add a variable numer of months to the current date CURDATE(). I thought it should be something like this: select (MONTH(CURRENT_DATE)+MONTH(2)) but i get NULL as a result. The purpose of this it to check which records with a experation date is earlier or later than today+2 months later. Can somebody please tell me how to do this? Would MySQL's ADD_DATE() suit? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Storing Credit Card info
Hi olinux, If I understand what you are saying...I would use mcrypt and encrypt the stored info, keeping the KEY and IV in a separate location for when you need it. Chances that anybody will break the triple des encryption without the KEY and IV are slim to none. That way, you don't have to freak out about moving the information around, that is, until it has been decrypted. In order to convert the KEY and IV into a normal string, you need to use some base64 conversion function, I don't remember where I got that or if it was built into PHP when I did it, but I was able to get it to work pretty quickly. PHPs hooks into the mcrypt libraries are the best. So easy to use(and high quality) compared to anything else I've seen. Hope that helps, -Paul - Original Message - From: olinux [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 17, 2002 1:22 PM Subject: [PHP-DB] Storing Credit Card info I have a client that would like to store credit card information online. I have worked with shopping cart type systems in the past, but never stored CC info. What is the best way to do this? I was thinking that I can write and read using include() to a directory that is not available to the web. Then just display these on SSL so that the client can retrieve the numbers. Any ideas? Thanks much, olinux __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Storing Credit Card info - Encryption Functions
Hi olinux, This is what I ended up doing. This will work if you have a PHP that was compiled with mcrypt as it is, just pass the info to your encrypt and decrypt functions. The key I used is 123 but you can use something different. The Initialization Vector is hard coded, but there is a function that will generate a new one for you. Look at the mcrypt_encrypt and mcrypt_decrypt functions at php.net for details. I lifted the hex2bin() from the user comments If I remember correctly. Have Fun... -Paul / function encrypt($plainText) { return(bin2hex(mcrypt_encrypt (MCRYPT_RIJNDAEL_256, 123, $plainText, MCRYPT_MODE_ECB, hex2bin(f6d53befbaac65a609e24d4b3a573ec56618b185280b615b6cde67793c7e4091)) )); } / function decrypt($cipherText) { return(mcrypt_decrypt (MCRYPT_RIJNDAEL_256, 123, hex2bin($cipherText), MCRYPT_MODE_ECB, hex2bin(f6d53befbaac65a609e24d4b3a573ec56618b185280b615b6cde67793c7e4091)) ); } / function hex2bin($data) { $len = strlen($data); for($i=0;$i$len;$i+=2) { $newdata .= pack(C,hexdec(substr($data,$i,2))); } return $newdata; } / - Original Message - From: olinux [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 17, 2002 1:22 PM Subject: [PHP-DB] Storing Credit Card info I have a client that would like to store credit card information online. I have worked with shopping cart type systems in the past, but never stored CC info. What is the best way to do this? I was thinking that I can write and read using include() to a directory that is not available to the web. Then just display these on SSL so that the client can retrieve the numbers. Any ideas? Thanks much, olinux __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] FreeBSD 4.2 and ODBC
Hi All, I'm just new to this list and I'm hoping somebody might have information leading to a PHP that can access an MS Excel Spreadsheet. FreeBSD 4.2, PHP 3.0.18 (for gif GD), Apache1.3.12. I have had no luck getting any of the ODBC functions to work with this OS (odbc_connect, php compiled with and without --with-iodbc switch results in Fatal error: Call to unsupported or undefined function odbc_connect() ). I also had no luck compiling iODBC, which resulted in syntax errors and ultimately stoppage. Wondering if anybody has a gem out there. |:) Ever pull something like this off? Got any ideas? Thanks Alot! -Paul
Re: [PHP-DB] FreeBSD 4.2 and ODBC
Thanks Andrew, I will attempt this in the morning. Is it okay with you if I email you on the iODBC stuff? PHP was compiled like so: Configure command: ./configure '--with-apxs=/usr/local/apache/1.3/bin/apxs' '--with-config-file-path=/usr/local/lib' '--with-system-regex' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-ttf' '--with-ftp' '--with-gd=/usr/local' '--enable-memory-limit' '--enable-fast-install' 'with-iodbc=/usr/local/src/odbcsdk' php3.ini file path is set to: /usr/local/lib (iODBC resulted in syntax errors last time I tried. I am new to this I should emphasize!) Also, any ODBC driver you would recommend? -Paul - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Paul G [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 2:37 PM Subject: RE: [PHP-DB] FreeBSD 4.2 and ODBC Paul, You can simply download the binary at www.iodbc.org and configure --with-iodbc as per the HOWTO. If you tried this and then got undefined function then this means you didn't use the correct php binary or somesuch. Ensure that ODBC support is compiled in by examining the output of a phpinfo(); You will still need an ODBC driver, as iODBC is simple the Driver Manager (enabling use of a driver). To enable BSD to access an Excel spreadsheet will require the following configuration. BSD Client PHP --with-iodbc (using iODBC SDK, use non-threaded option if you get pthread errors) Client-side ODBC - OpenLink MT Client DSN (in odbc.ini) configured with: Host = windows box below ServerType = odbc Database = server-side DSN below (foo) Environment variables in your PHP script: putenv(ODBCINI=path/to/odbc.ini); putenv(LD_LIBRARY_PATH=path/to/odbcsdk/lib); (ODBCINSTINI is optional) Windows Server -- -- --- Server-side ODBC: OpenLink MT ODBC Agent (choose Access in the selection dropdowns) foo - DSN configured with the Microsoft driver for Excel that can open the spreadsheet All components are available as free downloads from OpenLink's website. Free support is available at http://www.openlinksw.com/support/suppindx.htm Hope this helps! Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Paul G [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] FreeBSD 4.2 and ODBC Hi All, I'm just new to this list and I'm hoping somebody might have information leading to a PHP that can access an MS Excel Spreadsheet. FreeBSD 4.2, PHP 3.0.18 (for gif GD), Apache1.3.12. I have had no luck getting any of the ODBC functions to work with this OS (odbc_connect, php compiled with and without --with-iodbc switch results in Fatal error: Call to unsupported or undefined function odbc_connect() ). I also had no luck compiling iODBC, which resulted in syntax errors and ultimately stoppage. Wondering if anybody has a gem out there. |:) Ever pull something like this off? Got any ideas? Thanks Alot! -Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Trouble with date column
Hello, My boss is going through the mysql.com tutorials starting at ... http://www.mysql.com/articles/ddws/12.html ... and currently stuck at ... http://www.mysql.com/articles/ddws/13.html The boss is using phpMyAdmin to access the database, and everything has been working just fine until it gets to a database query where it's using a date column (JokeDate) in the where clause. The query is shown below and the phpMyAdmin error is also shown... SELECT COUNT(*) FROM Jokes WHERE JokeDate = 2000-01-01 MySQL said: Lost connection to MySQL server during query The database table is defined thusly: CREATE TABLE Jokes ( ID int(11) DEFAULT '0' NOT NULL auto_increment, JokeText text, JokeDate date DEFAULT '-00-00' NOT NULL, PRIMARY KEY (ID) ); With three rows of information in it. Even if I change the query to : select * from Jokes where JokeDate = 2001-01-01 -or- select * from Jokes where JokeDate = '2001-01-01' -or even- select ID, JokeText, JokeDate from Jokes where JokeDate = '2001-01=01' ... it just doesn't work and it returns the Lost Connection error. If I select on a different column (like ID or JokeText) it works just fine. The MySQL database is 3.22.26a running on a Solaris through iPlanet webserver on a test machine/database and Apache on production machine/database. Any help. Thanks in advance. -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3016 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org // // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How to insert to DB from txt??? Please help
How about LOAD DATA INFILE 'filename.txt' INTO TABLE Table FIELDS TERMINATED BY ',' comma delimited for tabs use '\t' LINES TERMINATED BY '\n' *nix line terminator, for Dos/Win use '\r\n' IGNORE 1 LINES use if the first line of the file has col. hdrs. (column1name, column2name, column3name, column4name); -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3016 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org // // -Original Message- From: Kelvin [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 11:44 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to insert to DB from txt??? Please help Hi everyone, I have a txt file which is contained the following: ,aaa,ccc,ddd ,aaa,ccc,ddd .etc. Now, I need to read the data from that file and than insert it into the table. insert into Table (name,pass,phone,somethingelse) Could someone help me out here, How to write the code? I know how to read from a txt file, but I don't know how to separate the data determine by , Please help, I'll be very appreciate.Thanks Kelvin. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Re: parse error
Not sure but if line 358 is... 358nobr .. as it says below, then the before the no needs a beginnnig to it somehow. It's like a html-tag that's only half baked. -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3016 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org // // -Original Message- From: Rob Day [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 5:37 PM To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Re: parse error Sorry for not giving enough info. This is right in the middle of the script. I do have the opening and closing tags. It must ne something else. -Original Message- From: Matthew Crouch [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 4:04 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: parse error you haven't shut your script with the ? before starting your HTML, near as I can figure it Rob Day wrote: I've written a small script that processes a form from a webpage and sends the submitted data as an HTML e-mail that has the form all filled out already. I've gotten smaller versions of this script to work without any problem just to test the idea.I can't figure out why I'm now getting the following error: Parse error: parse error in /home/httpd/cgi-bin/rday/lists/do_listapp.php3 on line 358 Here is the offending code: 353 if ($moderation == no){ 354 $message .= checked; 355 } 356 357$message .= ' 358nobr 359pAnswer yes if you want all postings to the list to be sent to 360 a moderator for approval before distribution to the list./p Any help would be greatly appreciated. Thanks! Rob Day Web Team Leader Texas State Library and Archives Commission phone: 512.936.4463 fax: 512.463.5436 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] RE: Getting apache to recognizeindex.php....
Luke M. said: Find the DIRECTORYINDEX attribute in httpd.conf and add 'index.php' to the list: DIRECTORYINDEX index.html index.php index.wml homepage.html index.shtml homepage.shtml index.cgi homepage.cgi index.htm \ Index.html Homepage.html Index.shtml Homepage.shtml Index.cgi Homepage.cgi Index.htm Another thing to note... the closer to the beginning of the DirectoryIndex directive, the higher the precedence it takes. What that means is, a single directory can have any one of the above files in it... the one that Apache will use *first* when accessing the directory name is the one that it *matches* in the directoryindex list *first*. So, if for example, you have four files from the above mentioned list (homepage.shtml, index.shtml, index.cgi, and index.php).. the one it'll use first when deciding which one to run when just the directory is accessed would be index.php because it's the second entry of the list (above) and the first entry (index.html) doesn't exist in the directory. -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3016 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org // // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP/MSQL/HTML and Javascript
I don't know much about javascript, but I would do the following: 1. Figure out what javascript data structure you are going to use to hold the data. 2. Figure out exactly how it should be coded. 3. Simply write your PHP script to output your javascript as in 2. The hard part of the matter (which is not very hard) is to figure out how to do the javascript. Create a static page on your local hard drive with hard coded javascript data structures. When you figure out how to do it like that, then add the PHP to generate the page in that format. By the way, I am going to soon need to do something similar - where the user gives several inputs in a row, and then the data is packed and posted to a php script - which outputs another batch of questions. If you are running a slow connection, or the server is loaded, then having to reload the page each time you type a word or two could get quite frustrating. So, let me know what you come up with if you have the time. -Jason Garber IonZoft.com At 10:29 AM 11/22/2001 +0100, [EMAIL PROTECTED] wrote: Hi, out there Has anybody found a way to pass variables between javascript and php? Here's what I want to achieve: 1. I want to display a mysql_query result record-by-record (first/prev/next/last buttons) without re-querying. 2. I want to use a static html-form and plug the data into input name=field_# type=text value= via event triggers onclick=this.form.elements[field#].value=queryresult_for_field# 3. I read the query result into an php-array and want to pass array_values[1-n][1-m] to query_result_for_field 4. Obviously, I can increase/decrease values of javascript variables Obviously, there's a php array and I can set I php-array-counter BUT: I can't achieve to pass either value to the other 5. I know, that php parses html first and then comes javascript, but the array is there and I can use the java- script to place anything into this.form.elements[field#].value 6, The whole thing is about NOT reload/refresh the page/re-query but placing values via javascript.objects and triggers into an otherwise static forms-fill-in Has anybody got a clue on that or is it really simply not possible due to 5 above? regards Dietmar -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] date help
Hello, You said that you are using MySQL. Create 2 columns like: create_ts INT UNSIGNED NOT NULL, last_login_ts INT UNSIGNED NOT NULL Use the MySQL UNIX_TIMESTAMP() function, comparable to the PHP time() function (number of seconds since 1-1-1970 12:00:00 AM). UPDATE table SET last_login_ts=UNIX_TIMESTAMP() where ID=12345; -Jason Garber IonZoft.com At 02:45 PM 11/17/2001 +, Srinivasan Ranganathan wrote: Hi I need to store the date and time of sign-up and date and time of last successful login in a mysql database and calculate how long the user has been using a site. how do i do this? thanks in advance Srinivasan __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Why use MySQL with PHP
Hmm it's not PHP functionality that makes html ugly as shown at validator.w3.org. It's the person's html/php coding ability to avoid coding mistakes. Basically, PHP gives functionality. A part of that functionality is for the php programmer to make correct HTML as output so the browser will render a page as output correctly. If the php programmer is a real bonehead and he/she can't instruct php to return good HTML that doesn't make a HTML validator from coughing up errors, it's not PHP's fault, it's the coders. I've been programming PHP for quite a while now and I can't think of a single regular thing in PHP that'd cause any browser (Netscape or IE) to hang. Any time that I've had problems, it's because I didn't know the limits of what I was coding to try and do something that is outside the possibilities. Whether it's storing information in a database, retrieving information from a database, sending PHP headers to redirect to another page or sending PHP headers to set a cookie, etc. You have to know when you can do things in PHP and when you can't. If web pages hang in a browser, it's the buggy PHP code that is interpreted that's causing the problems. Not PHP itself. It's like putting gasoline w/ water in a gas tank. It's not the engine's fault it's spitting and sputtering. It's the fuel supply. Tyler Nally [EMAIL PROTECTED] American Legion Website -Original Message- From: Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 6:02 PM To: B. van Ouwerkerk; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Why use MySQL with PHP Tell me about it. You ever try running php.net through http://validator.w3.org ? It's not pretty. Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: B. van Ouwerkerk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 15, 2001 12:28 PM Subject: Re: [PHP-DB] Why use MySQL with PHP I just remembered, the only bad thing I can think of about MySQL... their website locks up Netscape =) PHP qualifies for this too. www.php.net looks pretty messy in NS. By the way, both doesn't break NS.. Bye, B. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] what's a GOOD starting HOURLY rate for a PHP/MYSQL job?
okay, you consultants... i'm gonna venture at work to do some side jobs here for some online dynamic web pages. but what would be a good starting pay rate? or would you contract for the entire job? what about a per PAGE/SCRIPT basis? thanks... -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] sending bulk emails
I just encountered the same problem... I made a MySQL table with an email_id, email, and sentdate field. while(true) { set_time_limit(10); //Give script 10 more seconds to run SELECT email_id, email FROM thelist WHERE sentdate=0 LIMIT 1 if record not found, then break; then I use the mail function to send it UPDATE thelist SET sentdate=UNIX_TIMESTAMP() WHERE email_id=$email_id then I use the sleep() or usleep() function to wait a second or so (so I do not use too much bandwidth) } -Jason Garber IonZoft.com At 07:26 AM 11/2/2001 -0600, Rick Emery wrote: Opswe've just armed a potential spammer... -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Friday, November 02, 2001 6:20 AM To: Cami Cc: PHP DB list Subject: Re: [PHP-DB] sending bulk emails Does anybody know how to send bulk emails using php? Don't do it!! But of you must - I guess you could build an array containing email addresses, names, etc - taken from form input or a database or whatever and then loop the arrays mailing people... $mail = mail(; for($i=0; $i$email_array_name;$i++( { $mail .= $values,; } $mail .= \$subject\,\$body\,\From: $from\);; Something like that anyway (that's just off the top of my head) Regards. Russ On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote: Hi guys, Does anybody know how to send bulk emails using php? Thanks, Cami -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Variables in a loop
If you have a string that is the name of an input field, you can do one of 3 things: Ex: $sName = input.$i; //result = input1 $sName = input.$i; //result = input2 etc... 1: Variable Variables $value = $$sName; 2: If you posted the form $value = $HTTP_POST_VARS[$sName]; 3: If you used GET with the form $value = $HTTP_GET_VARS[$sName]; Regards, -Jason Garber IonZoft.com At 09:10 AM 10/30/2001 +0100, * RzE: wrote: Original message From: LeTortorec, Jean-Louis [EMAIL PROTECTED] Date: Mon, Oct 29, 2001 at 04:03:45PM -0500 Message-ID: 615315231286D21182E40008C7B1EED23C6E76@COMPAQ3000 Subject: [PHP-DB] Variables in a loop I'm trying to write a loop to read variables I receive from a form: form ... input name=a1 value=.. input name=a2 value=.. input name=a3 value=.. input name=a4 value=.. I'd like to get something like: for ($i=1; $i=10; $i++) { $tab[$i]=a.$i ;} The expression a.$i is actually a string, not a variable. Any idea how to read the value of that string? Thanks for your help. Jean-Louis /Original message Reply Why don't you just use an array? form ... input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] keys in mysql
You read the mysql manual. www.mysql.com Look up alter table. ALTER TABLE mytable ADD KEY keyname (keyfield1, keyfield2); -Jason Garber At 08:33 PM 10/23/2001 -0700, søren eriksen wrote: How do I set up secondary keys in mysql? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] wildcard in mysql search with php
From: Thomas omega Henning [mailto:[EMAIL PROTECTED]] Subject: [PHP-DB] wildcard in mysql search with php Is there a way to use wildcards in search in a mySQL db? e.g. I have a dbase of over 24000 records and i can only search exact matches is there a way to search something like this : *admin* in mySQL? Or i have to do it by hand in PHP? Sure... you do it like this... search column_name from table_name where column_name like '%admin%' -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3016 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org // // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Sessions and Frames
The manual says... Remember that the header() function must be called before any actual output is sent, either by normal HTML tags blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that will output before header() is called. The same problem exists when using a single PHP/HTML file. So, an example of what it's complaining about below leads me to believe that you've already written some ouput to the browser which effectively ends any possibility to do any HTTP HEADERS. My guess is that something like this is happening html headtitletitle of page/title/head body ?php header(header-value-and-arguments); ? More HTML stuff here /body /html ... Whereas the following would be what is acceptable ... ?php header(header-value-and-arguments); ? html headtitletitle of page/title/head body More HTML stuff here /body /html -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3016 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org http://www.legion.org // // -Original Message- From: Dobromir Velev [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Thursday, October 18, 2001 3:50 AM To: TJayBelt; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Sessions and Frames Hi, Every different page in a framset is loaded separatly so the only thing you should be aware of is not to output anything before the session stuff. Also you can use the output control functions lie ob_start - check the PHP manual for more info. HTH Dobromir Velev -Original Message- From: TJayBelt [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Thursday, October 18, 2001 8:28 AM Subject: [PHP-DB] Sessions and Frames I have a site that is successfully using sessions and authentication. However, I am working on another site, and it uses Frames. The first site does not use frames, so including the unit that has the session stuff first works. But on the frames site, it gives the following error : 'Cannot add header information - headers already sent by ' I know that this is when something is trying to print before the session is started. I just don't know how to accomplish this if the page I am loading is inside a frame... so by the time the session stuff starts, html is already output to the browser. thanks for any help you can give. -- PHP Database Mailing List ( http://www.php.net/ http://www.php.net/ ) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List ( http://www.php.net/ http://www.php.net/ ) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Re: UPDATE table Problem
[*NOTE* - I sent this yesterday. Since I didn't receive a copy back from the listprocessor, I assumed that it was lost somewhere along the way. --TGN ] Hmm I'd first put a or die clause onto the clause... $updated = mysql_query($update_query); ..like this because I suspect that it's dying before it can execute ... $updated = mysql_query($update_query) or die (Invalid SQL [$update_query]); ... what I would currently suspect to find would be the 'times_visited' column is numeric instead of alphanumeric. When the update happens, it chokes at having the value your setting for 'times_visited' quoted with apostrophes Originally, it looks like this... $update_query = update guestbook set last_access=now(), times_visited='$times' where guest_id='$g_id'; .. if times_visited is numeric, I'd change it to ... $update_query = update guestbook ; $update_query .= set last_access=now(), ; $update_query .= times_visited = $times ; $update query .= where guest_id='$g_id'; As another note, if the column last_accessed is of a timestamp data type, then you can do the following update to cause it to automagically update with a now() value being put into it as well. $update_query = update guestbook ; $update_query .= set times_visited = $times ; $update query .= where guest_id='$g_id'; This works because timestamp column types that aren't mentioned directly in the update/insert query types are automatically set to the current system time (which would be a now()). -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3016 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org // // -Original Message- From: Thomas omega Henning [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 12:13 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: UPDATE table Problem Dear Sir George Liomis, But there is still the update command issue why didn't my update command work when i tryed it in my php source it didn;t work but in the mysql shell it updated it for me. Is it a bug in php 4.0.5? that it doesn;t send it 2 the server? Sir Thomas omega Henning George Lioumis [EMAIL PROTECTED] wrote in message news:003f01c156d7$f218e640$[EMAIL PROTECTED]... Dear Sirs!! I've ended up with a conclusion after MANY hours in front of my PC. The problem was not the query but the $guest_id. In a first query, I was getting the guest_id from the DB with the following statement: $get_guest_id_query = select guest_id from guestbook where username='$username' and password='$password'; $result = mysql_query($get_guest_id_query) or die (mysql_error()); The problem was that $result was not in fact what I wanted (ie: guest_id). So the following query refused to do its job! $update_query = update guestbook set last_access = now() where guest_id='$result'; $udated = mysql_query($update_query) or die (mysql_error()); Below, you can see the correct code: if ( ($submit== Login) and ($username != ) and ($password != ) ) { $guest_id = mysql_query(select guest_id from guestbook where username='$username' and password='$password') or die(mysql_error()); while ($row = mysql_fetch_array($guest_id)) { $g_id = $row[guest_id]; ///set $g_id as global (inter-page!!) variable. session_register('g_id'); } mysql_free_result($guest_id); if ($g_id = 1) ///user authenticated... { ///Find user's last access time... $prev_access_query = select name, mail, times_visited, last_access from guestbook where guest_id='$g_id'; $result=mysql_query($prev_access_query); while ($row=mysql_fetch_array($result)) -The correct way to get geust_id from the $results!!! { echo BGuest: /B; echo $row[name]; echo with mail: ; echo $row[mail]; echo BRentered this site in: ; echo $row[last_access]; echo .BRThis Guest has visited ; $times = $row[times_visited] + 1; echo $times; echo times this site.BRBR; } ///while $update_query = update guestbook set last_access=now(), times_visited='$times' where guest_id='$g_id'; $updated = mysql_query($update_query); if ($updated) { ? FONT SIZE=5BA HREF=main.phpENTER/A/B/FONTBRBR ?php } ///if($updated) } ///if($g_id) } ///if ($submit) Hope this helps a bit!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] date
depends on how you are entering data... if through a client, then you have to format it as MYSQL wants it. if you're going through PHP (afterall, this is a PHP DB list... ;-)), then accept it anyway you wanna, through a form on a web page, then your script will handle the convertion on how MYSQL wants it... and yes, the date thing going from PHP to MYSQL and visa versa was a toughie for me to grasp. then i read a chapter on a book that made sense... ax wrote: if i unput the values 10/10/2001 into mysql database, would mysql or php recognize that as a date?? i am a bit confused. i inserted few dates in the above format and asked mysql to list them by date and it does not seem to work. any suggestions?? please :) ax -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Storing HTML in database
Hello, I'm trying to store HTML (that is cut-n-paste from source) into a textarea field on a web page. As it's submitted to the php page that processes it, the database column that it ends up with strips the and out of the html so that it doesn't end up in the source. Example I can cut-n-paste... the following into a textarea... --original test html code ithis is supposed to be in italics/i bthis is supposed to be bold/b table tr td align=left valign=topColumn 1, Row 1/td td align=left valign=topColumn 2, Row 1/td /tr tr td align=left valign=topColumn 1, Row 2/td td align=left valign=topColumn 2, Row 2/td /tr /table - ... and process it with htmlentities() by the receiving php page as it will show... original code as received and displayed in php processing page-- ithis is supposed to be in italics/i bthis is supposed to be bold/b table tr td align=\left\ valign=\top\Column 1, Row 1/td td align=\left\ valign=\top\Column 2, Row 1/td /tr tr td align=\left\ valign=\top\Column 1, Row 2/td td align=\left\ valign=\top\Column 2, Row 2/td /tr /table - Which I can deal with easily enough... but when the same is posted, processed (w/ htmlentities), and retrieved from the MySQL database, I receive the following --original code as retrieved from database-- i this is supposed to be in italics /i b this is supposed to be bold /b table tr td align=\left\ valign=\top\ Column 1, Row 1 /td td align=\left\ valign=\top\ Column 2, Row 1 /td /tr tr td align=\left\ valign=\top\ Column 1, Row 2 /td td align=\left\ valign=\top\ Column 2, Row 2 /td /tr /table What am I doing wrong? This just can't be rocket science. There's probably something essential that I'm missing. Thanks much -- __ _Tyler Nally / /__ _(_)___ _ _ [EMAIL PROTECTED] / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/ 317-860-3009 / / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website /_/\___/\__, /_/\/_/ /_(_)/_/ \__, /http://www.legion.org // // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Check Boxes/UPDATE
Matt, Assuming that you have a variable number of records being displayed out of the database: As you write out the HTML, give each checkbox a name containing the ID# of the record that is being written out. Ex: input type=check name=chkAuthStatus_1203 checked input type=check name=chkAuthStatus_1204 checked input type=check name=chkAuthStatus_1205 checked Use code like the following to Write and Read the web form... ?php //Get the DB result $dbResult = mysql_query(SELECT id, authstatus, whatever, whatever2 FROM table WHERE whatever); //Get the row count $nRowCount = mysql_num_rows($dbResult); //Scan the result for($i=0; $i$nRowCount; $i++) { //Get the current row as an object $oRow = mysql_fetch_object($dbResult); //Format the checkbox name $sCheckName = chkAuthStatus_ . $oRow-id; //When Writing out the Web Form, use this $sChecked = ($oRow-authstatus ? ' checked' : ''); echo input type=\check\ name=\$sCheckName\$sChecked; //When Reading in the web form, use this //If the checkbox variable isset(checked) then set the authstatus=1 //Otherwise set the authstat= 0 $authstatus = (isset($$sCheckName) ? 1 : 0); //Update the database mysql_query(UPDATE table SET authstatus=$authstatus WHERE id=$oRow-id); } ? -Jason Garber www.IonZoft.com At 03:22 AM 10/3/2001 +0100, Matt C wrote: I have a page of jobs with AuthStatus set to 0. Basically I want to list each job title with a checkbox next to it. This I have done. What I really don't understand is how do I make it so that the rows in my table for all the different records when ticked are updated to 1? Please help. Matt _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] problem with WHILE loop
the mysql_query function returns a Result Identifier. For every row in the result (found by mysql_num_rows), you must call one of the the row retrieval functions (mysql_fetch_array, mysql_fetch_object, etc...) These functions automatically advance the row position in the Result. Replace the code with this: ?php $dbResult = mysql_query(select id,title from table1); $nRowCount = mysql_num_rows($dbResult); for($i=0; $i$nRowCount; $i++) { $aRow = mysql_fetch_array($dbResult); $title = $list_row[title]; echo($title br\n); } ? -Jason Garber www.ionzoft.com * I prefer mysql_fetch_object() personally... Replace the code with this: ?php $dbResult = mysql_query(select id,title from table1); $nRowCount = mysql_num_rows($dbResult); for($i=0; $i$nRowCount; $i++) { $oRow = mysql_fetch_object($dbResult); echo($oRow-title br\n); } ? At 08:32 PM 9/30/2001 -0500, you wrote: I have the following code on a page: ?php $list = mysql_query(select id,title from table1); $list_row = mysql_fetch_array($list); $title = $list_row[title]; while($list_row) { echo($title br\n); } ? For some reason, when I load the page, instead of a list of the titles from table1, I get the title from the first row of table1 repeated over and over. Obviously I'm doing something wrong, and it's probably something really dumb, right in front of my face... but I can't find it! help? Thanks, Eric Schwinder eric.AT.bergencomputing.DOT.com AT = @ DOT = (well... you know) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mysql_fetch_array() doesn't work
echo a href='$PHP_SELF?offset=$i*$step' target='_top' Missing end quote and semicolon on this line may be the reason... Try properly indenting and formatting your code. Also take advantage of going in and out of php mode to seperate your code from your display of content... Ex: instead of this: ? echo(td align=\center\ width=\$nWidth\$sContent/td); ? Try this: td align=center width=? echo($nWidth); ?? echo($sContent); ?/td Or even this: td align=center width=?=$nWidth??=$sContent?/td It makes it MUCH easier to read and maintain, and seperates the PHP code from the HTML content as much as possible. Any questions, please ask me. -Jason Garber Lead Programmer - www.pulseaday.com [EMAIL PROTECTED] At 12:48 PM 9/27/2001 +0800, you wrote: System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98 When PHP is running at the line: $arr=mysql_fetch_array($res); The IE always show info as below: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\apache group\apache\htdocs\web\site1\list.php on line --[the number of line] What's the problem wiht mysql_fetch_array() or other? What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean? THANKS Mike The full code below: ? $link=mysql_connect(localhost,,); if($link==false){ echo Failed linking to database.; exit(); } $handler=mysql_select_db(database1); if($handler==false) echo Failed linking to database.; $query=selct count(*) from users where sign=1; $res=mysql_query($query); $row=mysql_fetch_row($res); $all=$row[0]; $step=5; $pages=ceil($all/$step); /*the number of pages needed to listed */ if(empty($offset)) $offset=0; $query=select user_id, user_name, time, status, comment from users where sign=1 order by user_name limit $offset, $step; $res=mysql_query($query); echo tabletd align=centerUser/td td align=centerAdded time/tdtd align=centerStatus/td/tr; $num=mysql_num_rows($res); for($i=0; $i$num; $i++) { $arr=mysql_fetch_array($res); /* HERE is line where the error occurs!!! */ echo trtd align=centera href=\profile.php?id=$arr['user_id']\ target='_top' $arr['user_name']/a/td; echo td align=center$arr['time']/td; echo td align=center$arr['status']/td/tr; echo tr colspan=3td$arr['comment']/td/tr; } echo /tablebrbrbr; echo tabletrtd align='center'; /* show others in multi-pages */ for($i=0; $i$pages; $i++){ echo a href='$PHP_SELF?offset=$i*$step' target='_top' echo ($i+1)./a; echo nbsp;nbsp;; } echo /td/tr/table; ? - create table users ( user_id int not null auto_increment primary key, user_name varchar(30), time datetime, status tinyint(1), comment text, sign tinyint(1) default '1' ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]