Re: [PHP-DB] Getting PHP 5 w/mysqli to communicate with MySQL 5
Without some good information I'm going to take a stab in the dark here.. You are using the mysqli functions right? Not the older mysql ones for mysql4.x and older?? If you only compiled php with the mysqli libraries then you need to use them You "can" connect in some fashions to mysql5 db's with mysql_ functions and the older libmysql4 libraries but the authentication method needs to be worked into it [newer mysql password function is different to mysql4 and older password function] otherwise though I compiled both libraries mysql and mysqli into my php: http://aries.the-spectrum.org/phpinfo.php and use a mySQL 5 engine but only using mysql_ functions currently due to backwards compatibility of old sites and old code. What exactly are you have troubles with? A code snippet or version examples would be good. Also is your database mysql5 engine I take it? Regards, Julien Bonastre [aside] I'll try and be VERY precise from now on in this list so people don't interrogate my help and advice and construe it as definitive BIBLE like answers. I'm only trying to help. I am barely 21 and I am non-qualified academically. Doesn't mean I don't know what I'm talking about. Fear my wrath, or my wife, equally dangerous I assure you haha. [/aside] - Original Message - From: "Allen Schultz" <[EMAIL PROTECTED]> To: Sent: Friday, January 20, 2006 10:16 AM Subject: [PHP-DB] Getting PHP 5 w/mysqli to communicate with MySQL 5 Hi, all: I having trouble getting my php to communicate with my MySQL database. I have it where I can connect, but afterwards, it sees nothing for information after being connected. Any suggestions will help. Thanks, Allen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.21/235 - Release Date: 19/01/2006 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.21/235 - Release Date: 19/01/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Getting PHP 5 w/mysqli to communicate with MySQL 5
code versions of mysql and any error messages would help too bastien From: Allen Schultz <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Getting PHP 5 w/mysqli to communicate with MySQL 5 Date: Thu, 19 Jan 2006 17:16:03 -0700 Hi, all: I having trouble getting my php to communicate with my MySQL database. I have it where I can connect, but afterwards, it sees nothing for information after being connected. Any suggestions will help. Thanks, Allen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How can I solve this?
Thank you, In fact, its called busy-ness, and I tend to believe I have quite a prowess in the was of Regular Expressions. Reason I have the character class? You betchya! So I could do exactly what your friend did. Reason I completely forgot? I'm an idiot and was too busy replying to 3 emails at once whilst on a phone call. My fault? Completely ;-) Yes, see its called impulsive reasoning, hence the reason I added the character class without needing it, embedding a character class predicate such as \w inside a character class enclosure alone is well.. Stupid and reduntant at best.. Therefore there was some sub-concious reasoning to my madness I can presume. And yes, I also know that that \w class wouldn't cover all the characters I needed in a possible filename, again, I was careless and quick As for the compatibility of the \w character class within sed and awk: I am well aware that this implementation works on Perl-Compatible Regular Expression patterns, and is not a necessarily supported by all regular expression standards BUT WHO GIVES A FLYING FUCK? But this is a PHP-DB list, he is asking a PHP related question and I even specifically stated in my response: preg_replace() which is a PCRE function using the PCRE pattern modifiers. And finally this is a mailing list, not a kindergarten room. We're here to help, assist, and suggest advice. Not to wipe their bottoms. I posted a suggestive solution to a problem. Thats all SURE theres going to be different methods of approaching it, SURE it could not be the most perfect pattern, but its a suggestion where to head for the correct solution. HELL it wouldn't work with .asp files either. Or if your files were named .php4 or .phtml Do I give a damn about that? No. Are you a tech support officer Jeremy? Do you need to help them digest their baby jelly food? Actually, enough of the hostility, I am honoured actually to think you went to the effort of sending off my 10 second quick drafted suggestive PCRE pattern off to Eric Pement of MBI.. Wow, touched. Imagine if I gave you guys some REAL PCRE patterns that I use!!! Now that you'd honour me for wouldn't you! I can just picture you two drooling at the mouth now. So is this Eric friend of yours some RegEx guru? I respect him if so, no harm intended, but I do think my suggestive help posting to this list was 'fit for purpose' He never asked anyone to spoon feed him, and if you want to be a real world developer you better learn to use your resources and reference manuals. I've had enough now. Adios and cya later mate! P.S. You (Jeremy) and Eric are Americans right?? :-) Just curious. ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: "Jeremy Peterson" <[EMAIL PROTECTED]> To: Sent: Friday, January 20, 2006 8:09 AM Subject: Re: [PHP-DB] How can I solve this? A friend of mine updated your regular expression... Check it out if your interested. Jeremy Dear Jeremy, Thanks for writing! > I saw this regular expression and thought you might like it... :) > >preg_replace("/^\/?(.*)\/[\w]+\.php$/","$1",$PHP_SELF) > > > >that strips that leading forward slash too ;-) \w is a PCRE (Perl-Compatible Regular Expression) that matches any word character: a-z, A-Z, 0-9 and the underscore "_". sed and awk do not support \w, although ssed (super-sed) supports \w if an -R switch is added on the command line. Back to PHP and \w : Putting \w by itself inside a character class "[...]" does absolutely nothing, just as "[a]" and "[9]" does nothing special. It could be more efficiently written as: /^\/?(.*)\/\w+\.php$/ One additional problem is that the characters defined by \w does not include the hyphen, the pound sign, or other punctuation marks that sometimes find their way into filenames, like: four-to-go.php page#10.php convert$toDM.php so in this case, a character set should be used: /^\/?(.*)\/[EMAIL PROTECTED]&*+=-]+\.php$/ Keep 'em coming! -- Eric Pement - [EMAIL PROTECTED] Educational Technical Services, MBI Jeremy Peterson, MACS Automation Systems Administrator Crowell Library Moody Bible Institute 820 N. LaSalle Drive Chicago, IL, 60610 Email: [EMAIL PROTECTED] Phone: 312.329.8081 Fax:312.329.8959 No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.21/235 - Release Date: 19/01/2006 -- No virus found in this outgoi
[PHP-DB] Getting PHP 5 w/mysqli to communicate with MySQL 5
Hi, all: I having trouble getting my php to communicate with my MySQL database. I have it where I can connect, but afterwards, it sees nothing for information after being connected. Any suggestions will help. Thanks, Allen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing money values in MySQL
Me again, Sorry for the rtfm stuff, I googled around and found this: http://bugs.mysql.com/bug.php?id=10719 and another thing, maybe worth a try; MySQL stores decimal numbers as strings...did you try to input decimals as string? I mean not: UPDATE SomeTable SET AmtOwed = 10.74 but: UPDATE SomeTable SET AmtOwed = '10.74' Bye, Balazs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing money values in MySQL
Hi, from the MySQL 4.1 manual: --- The DECIMAL and NUMERIC data types are used to store exact numeric data values. In MySQL, NUMERIC is implemented as DECIMAL. These types are used to store values for which it is important to preserve exact precision, for example with monetary data. --- and there is lot more there at http://dev.mysql.com/doc/refman/4.1/en/numeric-types.html , check it out, hope it helped. Balazs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Storing money values in MySQL
Again.. your forgiveness. This is a MySQL question. If the MySQL mailing lists would include a [MySQL Help] tag in their subject lines, I'd use them. What I receive from them is difficult to distinguish from spam half the time so I gave up. We had a problem a few months ago and now I can't find my notes relating to it. The problem we had involved storing money data as either float or decimal and having the 'cents' round improperly. And it wasn't just a matter of 10.05 becoming 10.06, it was something along the lines of 10.05 becoming 10.12. This was when just a straight UPDATE was performed. I remember doing it manually, not even through PHP, using absolutely no math functions, just a totally straight: UPDATE SomeTable SET AmtOwed = 10.74 Someone made a recommendation of "never use SOMETYPE for money.. you should use SOMEOTHERTYPE instead". I've spent the better part of the afternoon trying to find my notes, recreate the bug in our database, search online for the discussion I had then or other information about this. So far I'm coming up empty. We're retooling some of our database and trying to make it more efficient and accurate and this is on the list of things to doublecheck. If anyone has any comments, criticisms, information, etc... I'd love to hear them. We're running MySQL 4.1.11-standard. Thanks! -TG ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date & Time 90 minutes ago
Bastien's example is probably the quickest and easiest. I just wanted to point out that you can use math within the mktime() function as well in case the relative date/time you need isn't "right now". $month = 1; $day = 19; $year = 2006; $hour = 17; $minute = 08; $second = 05; echo date("Y-m-d H:i:s", mktime($hour, $minute - 90, $second, $month, $day, $year)); It will even adjust for leap years I believe. You can add/subtract/etc any of those items and it's smart enough to figure out what the correct resulting date/time would be. -TG = = = Original message = = = bastien >From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: PHP DB >Subject: [PHP-DB] Date & Time 90 minutes ago >Date: Thu, 19 Jan 2006 16:57:33 -0500 > >Would someone be able to help me with the DATE command syntax to know >what the date and time was 90 minutes ago? I am trying to assign these >values into two variables: > >$date_90_minutes_ago >$time_90_minutes_ago > >I am not sure how to handle midnight where if the time is 00:10:00 >ninety minutes earlier is a day before. Thanks. Ron > >-- >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 ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How can I solve this?
A friend of mine updated your regular expression... Check it out if your interested. Jeremy Dear Jeremy, Thanks for writing! > I saw this regular expression and thought you might like it... :) > >preg_replace("/^\/?(.*)\/[\w]+\.php$/","$1",$PHP_SELF) > > > >that strips that leading forward slash too ;-) \w is a PCRE (Perl-Compatible Regular Expression) that matches any word character: a-z, A-Z, 0-9 and the underscore "_". sed and awk do not support \w, although ssed (super-sed) supports \w if an -R switch is added on the command line. Back to PHP and \w : Putting \w by itself inside a character class "[...]" does absolutely nothing, just as "[a]" and "[9]" does nothing special. It could be more efficiently written as: /^\/?(.*)\/\w+\.php$/ One additional problem is that the characters defined by \w does not include the hyphen, the pound sign, or other punctuation marks that sometimes find their way into filenames, like: four-to-go.php page#10.php convert$toDM.php so in this case, a character set should be used: /^\/?(.*)\/[EMAIL PROTECTED]&*+=-]+\.php$/ Keep 'em coming! -- Eric Pement - [EMAIL PROTECTED] Educational Technical Services, MBI Jeremy Peterson, MACS Automation Systems Administrator Crowell Library Moody Bible Institute 820 N. LaSalle Drive Chicago, IL, 60610 Email: [EMAIL PROTECTED] Phone: 312.329.8081 Fax:312.329.8959
Re: [PHP-DB] Date & Time 90 minutes ago
$date_90_minutes_ago = date('m/d/Y',mktime()-(60*90)); $time_90_minutes_ago = date('h:i:s',mktime()-(60*90)); 60 seconds * 90 minutes. =C= | | Cal Evans | http://www.calevans.com | | We get our best customers from referrals. | We would appreciate you referring any of your | friends or co-workers that need web hosting. | | Ron Piggott (PHP) wrote: Would someone be able to help me with the DATE command syntax to know what the date and time was 90 minutes ago? I am trying to assign these values into two variables: $date_90_minutes_ago $time_90_minutes_ago I am not sure how to handle midnight where if the time is 00:10:00 ninety minutes earlier is a day before. Thanks. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date & Time 90 minutes ago
bastien From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: PHP DB Subject: [PHP-DB] Date & Time 90 minutes ago Date: Thu, 19 Jan 2006 16:57:33 -0500 Would someone be able to help me with the DATE command syntax to know what the date and time was 90 minutes ago? I am trying to assign these values into two variables: $date_90_minutes_ago $time_90_minutes_ago I am not sure how to handle midnight where if the time is 00:10:00 ninety minutes earlier is a day before. Thanks. Ron -- 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] Date & Time 90 minutes ago
Would someone be able to help me with the DATE command syntax to know what the date and time was 90 minutes ago? I am trying to assign these values into two variables: $date_90_minutes_ago $time_90_minutes_ago I am not sure how to handle midnight where if the time is 00:10:00 ninety minutes earlier is a day before. Thanks. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Add or Subtract
Thats not even a docs question.. Thats a "have you ever even sat down at a single teaching of SQL principles or read ANY basic SQL material at all" question. Really man. UPDATE is one of the four most common SQL standard functions you will and should know quite well. SELECT, INSERT, UPDATE, DELETE I'm not having a go here, but maybe you should checkout like a basics of mysql e-book or something, I've landed on some goodies in the past and they're just fantastic, I've ended up mastering SQL query construction like spelling my name now. All shapes sizes, constraints of queries and where and how to use certain functions, where to use what, aggregate functions, stats, subqueries, multiple tables,transactional locking, etc etc etc its so exciting, really. Enjoy!! ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: "David Robley" <[EMAIL PROTECTED]> To: Sent: Thursday, January 19, 2006 10:36 PM Subject: Re: [PHP-DB] Add or Subtract On Thu, 19 Jan 2006 22:55, Ed wrote: I've been considering doing a little project for my community site which allow people to sell and buy players ... They would have a limit of 2,000,000 upon sign up .. However i'm not sure how i'd update this figure Say player sells for example Alan Shearer for £300,000 he'd then have 2,300,000 how would i make it add to whats in the db already? same goes for if he was sold and it went down to 1,700,000. Ed You haven't read the mysql docs much, I guess. Assuming you are storing your limit as an integer: UPDATE table SET value = value + $newamount WHERE [something to identify the record to be updated] where $newamount is the positive or negative value of the increase passed in from wherever. Cheers -- David Robley Press any key to continue or any other key to quit... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.20/234 - Release Date: 18/01/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Add or Subtract
On Thu, 19 Jan 2006 22:55, Ed wrote: > I've been considering doing a little project for my community site > which allow people to sell and buy players ... They would have a limit > of 2,000,000 upon sign up .. However i'm not sure how i'd update this > figure > > Say player sells for example Alan Shearer for £300,000 he'd then have > 2,300,000 how would i make it add to whats in the db already? same goes > for if he was sold and it went down to 1,700,000. > > Ed You haven't read the mysql docs much, I guess. Assuming you are storing your limit as an integer: UPDATE table SET value = value + $newamount WHERE [something to identify the record to be updated] where $newamount is the positive or negative value of the increase passed in from wherever. Cheers -- David Robley Press any key to continue or any other key to quit... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Add or Subtract
I've been considering doing a little project for my community site which allow people to sell and buy players ... They would have a limit of 2,000,000 upon sign up .. However i'm not sure how i'd update this figure Say player sells for example Alan Shearer for £300,000 he'd then have 2,300,000 how would i make it add to whats in the db already? same goes for if he was sold and it went down to 1,700,000. Ed -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php