Re: [PHP] MSSqlServer table/field information
Chris Boget wrote: Is there a way to programatically get information about a specific table and/or field? And also any constraints that a field has? thnx, Chris sp_help @objname='{tablename}' This will actually return several recordsets which are probably available individually in the other responses I've seen to this message. I just wanted to make the list of options more complete. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reverse MD5 ???
William Stokes wrote: Hello, I have a system that uses certain id info. This info is stored in a session cookie in MD5 format. At certain parts of the code I need to update or insert to MySQL DB with that id info value in cleartext. Is this possible? If so, how to put this to a sql query? $sqlquery = "insert into x_table (team_id,number,) values ('$team_id','$number') $team_id is the MD5 formatted cookie value and I need to put it to the x_table column team_id in cleartext. Thanks a lot -Will MD5 values are hashes, not encryptions. There's nothing to "decrypt". It's good for storing the results of some value and than when the person sends the MD5 back at a later point you can make sure it still matches the desired value by re-hashing the original value again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing password in cookie
Richard Lynch wrote: On Sat, April 9, 2005 11:51 am, [EMAIL PROTECTED] said: *WHY* would you not store some kind of hash of the user ID?! setcookie('remember_me', md5($username)); . . . select username from users where md5(username) = $_SESSION['remember_me'] Is that really any harder? It's very hard on the database. With no other where clauses to restrict the results set, the database will have to run the md5 routines on every username in the table. For better performance, you should also store something like a record id that you can use... select username from users where recid = $_SESSION['userid'] and md5(username) = $_SESSION['remember_me'] Any query optimizer worth its salt will first filter based on the record ID and then only apply the md5 function to the remaining (1 in this case) usernames. -- D. Wokan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Smarty and PEAR DB
Matthew Weier O'Phinney wrote: * Reynier Perez Mira <[EMAIL PROTECTED]>: I'm using PEAR DB and Smarty. The case is that I have to pass a value = from a query result to a Smarty var. I try to paginate results. See the = code below: /= SmartyPaginate::connect(); SmartyPaginate::setLimit(5); $gbresult =3D $database->query("SELECT * FROM libro_de_visitas LIMIT " . = SmartyPaginate::getCurrentIndex() . "," . SmartyPaginate::getLimit()); $gbtotal =3D $database->query("SELECT COUNT(*) AS total FROM = libro_de_visitas"); $gbtotal->fetchRow(); SmartyPaginate::setTotal($gbtotal['total']); /= As you can see I need the COUNT value but I not know how get it from = query using PEAR. Some body can help me? You'll need to do two different queries, one that counts the number of total results for the criteria, and one that pulls the set with a LIMIT statement. That is definitely not a Good Thing. I did that with an employer's site and database performance suffered having to always count and recount the records in question. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math weirdness with doubles...
They are not the same amount. They each got a different rounding error. Double values only display a small number of decimal places (relatively speaking). If you look at the difference you're getting, it's 0.0142108547152 (I may be off by a zero or two), so given you're working with a currency, I'd say you can safely round to about 4 or 8 decimal places to get a reasonably accurate result. I typically use 4 since most money types I've seen only go out 4 decimal places to begin with. -- D. Wokan (Sorry for the double reply, Jon. Didn't realise this list doesn't set the reply-to until it was too late.) jon roig wrote: Ok... It's Friday and maybe my brain is dead, but I'm having a weird problem with some basic math. Here's a little snippet of the code I'm working with: --- echo "Current:$currentAmount:".gettype($currentAmount)." - Paid:$paidAmount:".gettype($paidAmount).""; $currentAmount = $currentAmount-$paidAmount; echo "Final Current: $currentAmount"; - Straightforward... Yeah? Here's a sample of the output: Current:97.6:double - Paid:97.6:double Final Current: 1.42108547152E-014 Now if both $currentAmount and $paidAmount are doubles, subtracting them should yield a zero, shouldn't it? -- jon --- jon roig web developer email: [EMAIL PROTECTED] phone: 888.230.7557 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php