[PHP-DB] Re: mcrypt, postgres, only returning half the data
John A second question to answer, it's not clear from your description --- is the encryption 'breaking' during en-cryption (before it stuffs the value into the database) so that all the data is not even getting into the database? -or- is ir breaking during de-cryption ? Sounds to me like it might be a control character is getting interpreted by PgSQL and cutting off the query. You don't mention - what type field to save the encrypted data??? If there's a blob or binary field type (I dunno about PgSQL) try using that field type for encoded data. And - try skipping the add slashes step - what happens??? Good luck, Tom Henry John Starkey wrote: Hello all I'm working on encoding some data going in and decrypting coming out of postgres. I'm adding slashes going in and stripping them coming out. Using BLOWFISH and I've tried several different modes. But each time the data comes out I'm only getting half-decrypted data, it seems to hang at a random spot. The same for each piece of data but random in terms of different for each entry (confusing the issue enough?). I'm using mcrypt_encrypt and mcrypt_decrypt. When I test it on the same page (without going through the database) it decrypts fine, perfect as a matter of fact. But coming out of the DB, the same data is trashed. Is there any special way to send (or abstract) encrypted data into (from) the DB? I've been through the archives and it doesn't look like anyone has posted a problem like this. Am I the only one :} Thanks, John -- 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] Re: Show abbreviated article
Try using MySQL to do that right in the query itself (and save the overhead of retreiving the whole blob then PHP'ing the blob too). From the MySQL Doc's ;-) RTFM once at least -- SUBSTRING(str,pos,len) SUBSTRING(str FROM pos FOR len) MID(str,pos,len) Returns a substring len characters long from string str, starting at position pos. The variant form that uses FROM is ANSI SQL92 syntax. mysql select SUBSTRING('Quadratically',5,6); - 'ratica' -- For your problem it might look like $sql = SELECT field1, field2, SUBSTRING(blobfieldname,0,160) FROM articles where ( BTW I usually assume prox 8 chars per word for something like this so 20 wds x 8 char = 160 chars total BUT you might have lots of esoterica in there and might want to adjust that ;-) ) HTH Tom Henry Cilfa wrote: Hi, On my website I want to display some articles, in Slashdot style. The main page should only display the first 20 words of the article, and users should be able to click on a link to view the entire article. The articles are stored in a MySQL database, the body of the article in a blob-field. My question is this: how can I select only those first 20 words in the PHP code? I hope somebody can help me with this. Cilfa -- 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] Re: trash last message ,this ones right I think
Perhaps you could consider using the webserver config (in Apache it would be the httpd.conf file) to do the dirty work. Create and alias (in the /util/ domain) for img that points to the /hdocs/www/img/ location - voila! YMMV HTH Tom Henry Ken Sommers wrote: Hello again, DOCUMENT_ROOT is.. /htdocs/www I have a php file ( showdatabases.php) in my subdomain area /htdocs/util/ it loads up just fine: and if you click it, you will see my database structure if you like..:) http://util.consumergrapevine.org/showdatabases.php I have images stored in /hdocs/www/img/ right now (of course i could move them, and fix all references to them) but I like them there because I can refer to images in pages in /www/ with background=img/bgpic.jpg...of course this works just fine becuz /img/ is just down from /www/. but now I have pages in subdomains as menitoned above like: /htdocs/util/showdatabases.php and of course I want to refer to images from those subdomain pages too,,and of course I don't want to have another dir with the same pics in them..something like... /htdocs/util/img/ becuz I already have the pics in /htdocs/www/img/ and if I make another sub domain called /htdocs/stuff , I don't want to have to copy the pics AGAIN into /htdocs/stuff/img right? So,,, (yes I may be getting to the end now..) how or where should I put my pics so the /www/ and /util/ and /stuff/ guys can use them as background pics? what would the body tag look like? body background=../www/img/background.jpg doesn;t work what will? body background=What?? thanks again, Ken -- 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]