AW: [PHP] Read Text Content from PDF file
Any other ideas? Von: Bastien Koert [mailto:phps...@gmail.com] Gesendet: 20 March 2009 15:49 An: Andrei Bintintan Cc: php-general@lists.php.net Betreff: Re: [PHP] Read Text Content from PDF file On Fri, Mar 20, 2009 at 10:23 AM, Andrei Bintintan wrote: Could you be more precise? I'm looking at that class, but I can't see any function that does that. Andy. Von: Bastien Koert [mailto:phps...@gmail.com] Gesendet: 20 March 2009 14:57 An: Andrei Bintintan Cc: php-general@lists.php.net Betreff: Re: [PHP] Read Text Content from PDF file On Fri, Mar 20, 2009 at 9:48 AM, Andrei Bintintan wrote: Hi to all, I have to read the texts from PDF documents with PHP. A solution would be to use http://www.foolabs.com/xpdf, but it is not installed on the server that I work with and it is not wanted to be installed. So I have to look for another solution. Is there a possibility, PHP library, something with which I can READ the texts from a PDF document with PHP? Thanks a lot, Andy. http://www.setasign.de/products/pdf-php-solutions/fpdi FPDI makes it possible. -- Bastien Cat, the other other white meat http://www.setasign.de/support/manuals/fpdi/ that is what a manual is for -- Bastien Cat, the other other white meat
Re: AW: [PHP] Read Text Content from PDF file
Andrei Bintintan wrote: Any other ideas? I believe there is a windows binary called pdf2txt.exe out there somewhere. I doubt you will find any solution that does not require installation of a binary on the server, so if you can't install xpdf on the server then you probably will have to send the file to another machine for reading. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Read Text Content from PDF file
Andrei Bintintan wrote: Any other ideas? Also - I believe the commercial (full) version of PDFlib can - in fact, I believe you can do it with the pecl-pdflib library if you have the full version of pdflib installed. I seem to remember there work on a clibpdf php wrapper back when php 4 was new, I don't know if it ever amounted to anything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cygwin - compilation of PHP extension
Hi, I am totally new in compiling under cygwin. I need to compile an PHP extension, and this is what I figured so far: gcc -c extension_name.c (that's the only *.c file in that extension directory) ERROR: php.h: No such file... So, I changed the env PATH: PATH=$PATH:/usr/local/src/php-5.2.9/main (downloaded directly from PHP.net, unchanged, no make or install commands) And checked: printenv PATH OK. Ran again, but it shows still the same error: php.h not found. I appreciate your help, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] time() TIMER in seconds or just numbers
what does time(); $t1 = time(); { do something } $t2 = time(); $end_time = $t2 - $t1; echo $end_time; what does $end_time represent? how do you determine the next 5 mins? -- Best Wishes willandy.co.uk
Re: [PHP] time() TIMER in seconds or just numbers
2009/3/30 Andrew Williams : > what does time(); > > $t1 = time(); > > { > > do something > } > $t2 = time(); > > $end_time = $t2 - $t1; > echo $end_time; > > what does $end_time represent? The number of seconds it took to "do something". > how do you determine the next 5 mins? Assuming you mean "what will time() return in 5 minutes time?"... $five_minutes_time = time() + 300; // 300 seconds in 5 minutes If you mean something else please try rephrasing the question. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cygwin - compilation of PHP extension
Martin Zvarík napsal(a): Per Jessen napsal(a): Martin Zvarík wrote: Hi, I am totally new in compiling under cygwin. I need to compile an PHP extension, and this is what I figured so far: I wouldn't expect cygwin to be that different to a real Linux environment - how about: untar the extension cd dir phpize ./configure make make install Hmm, it seemed all working, but... $ make ...created 4 files: /usr/local/src/extension/.libs/extension.a, extension.la.lnk, extension.o (280 kB, the other 3 had few bytes, *.a, *.la, *.lai) $ make install ... created: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ one file *.a (8 bytes "!") So, I did: $ gcc -shared -o extname.dll extension.o (the 280 kB file) And it showed 100's of errors like "undefined reference to '_php_printf' Can you help? I searched, but I am helpless. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cygwin - compilation of PHP extension
Martin Zvarík wrote: > Hmm, it seemed all working, but... > > $ make > ...created 4 files: > > /usr/local/src/extension/.libs/extension.a, extension.la.lnk, > extension.o (280 kB, the other 3 had few bytes, *.a, *.la, *.lai) > > $ make install > ... created: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ > one file *.a (8 bytes "!") > I installed the mailparse extension a couple of times just this weekend - the make install step copied the mailparse.so file into /usr/lib/php5/extensions. I don't know if php extensions are normally meant to cope with cygwin, but if the dll wasn't created /Per -- Per Jessen, Zürich (6.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fpdf adding font error
If you want to use UTF-8 fonts with FPDF then switch to TCPDF (www.tcpdf.org) Thanks Tony I think that it will do what I really need. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LOAD INFILE
Hi I want to upload a .csv file from my local pc to a mysql server. My local machine is XP2. I have used the following but the file does not upload. When using php MyAdmin it returns the error 'file not found'. Can anyone help? ". mysql_error()); } // Select the database $db_select=mysql_select_db($db_database); if (!$db_select) { die ("Could not select the database: ". mysql_error()); } // Import new avaiability data from local CSV file $sql2 = 'LOAD DATA LOCAL INFILE \'C:EXPORT.CSV\' INTO TABLE `availability` FIELDS TERMINATED BY \';\' ENCLOSED BY \'"\' ESCAPED BY \'\' LINES TERMINATED BY \'\\r\\n\''; // echo $sql2; mysql_query($sql2); echo ''; mysql_query($sql0); printf("Records added: %d\n", mysql_affected_rows()); echo 'UPDATE COMPLETE'; ?> -- John UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP + MySQL - Load last inserts
Hello :) I have some troubles with php and mysql. I have a normal MySQL Query and this returns X > 3 rows. Now i want to get the last 3 inserted values. For Example i've inserted A, B, C, D, E I want to get the last inserted values, e.g. E D C (in reversed order) So how to do this? I already searched the web and the whole php.net site but i don't see any workaround. Thanks in advance Sebastian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
Sebastian Muszytowski wrote: > Hello :) > > I have some troubles with php and mysql. I have a normal MySQL Query > and this returns X > 3 rows. > Now i want to get the last 3 inserted values. For Example i've inserted > > A, B, C, D, E > > I want to get the last inserted values, e.g. E D C (in reversed order) > > So how to do this? I already searched the web and the whole php.net site > but i don't see any workaround. > > Thanks in advance > > Sebastian > > It's not really a PHP question. But here goes : SELECT column FROM `table` ORDER BY column DESC LIMIT 3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
>I have some troubles with php and mysql. I have a normal MySQL Query >and this returns X > 3 rows. >Now i want to get the last 3 inserted values. For Example i've inserted > >A, B, C, D, E > >I want to get the last inserted values, e.g. E D C (in reversed order) > >So how to do this? I already searched the web and the whole php.net site >but i don't see any workaround. I guess you have a numeric primary key with auto_increment activated. Then just order your select by that primary key in descending order and limit the output to 3. For instance: SELECT * FROM table ORDER BY primary_key DESC LIMIT 0, 3; Greetins from Germany Marc -- Sync and share your files over the web for free http://bithub.net My Twitter feed http://www.twitter.com/MarcSteinert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cygwin - compilation of PHP extension
Per Jessen napsal(a): Martin Zvarík wrote: Hi, I am totally new in compiling under cygwin. I need to compile an PHP extension, and this is what I figured so far: I wouldn't expect cygwin to be that different to a real Linux environment - how about: untar the extension cd dir phpize ./configure make make install you're the man, phpize did the job thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
Thijs Lensselink schrieb: Sebastian Muszytowski wrote: Hello :) I have some troubles with php and mysql. I have a normal MySQL Query and this returns X > 3 rows. Now i want to get the last 3 inserted values. For Example i've inserted A, B, C, D, E I want to get the last inserted values, e.g. E D C (in reversed order) So how to do this? I already searched the web and the whole php.net site but i don't see any workaround. Thanks in advance Sebastian It's not really a PHP question. But here goes : SELECT column FROM `table` ORDER BY column DESC LIMIT 3 Oh okay thank you very much :) I thought I must do this with php and some sort of mysql_fetch_asssoc or something like this -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LOAD INFILE
John Boy wrote: > Hi > > I want to upload a .csv file from my local pc to a mysql server. My local > machine is XP2. I have used the following but the file does not upload. When > using php MyAdmin it returns the error 'file not found'. Can anyone help? > > // Include our login information > include('db_login_master.php'); > // Connect - note: 'false' is 'no new link use existing' parameter and '128' > enables LOAD DATA > $connection = mysql_connect($db_host, $db_username, $db_password,false,128); > if (!$connection){ > die ("Could not connect to the database: > ". mysql_error()); > } > // Select the database > $db_select=mysql_select_db($db_database); > if (!$db_select) > { >die ("Could not select the database: > ". mysql_error()); > } > // Import new avaiability data from local CSV file > $sql2 = 'LOAD DATA LOCAL INFILE \'C:EXPORT.CSV\' INTO TABLE > `availability` > FIELDS TERMINATED BY \';\' ENCLOSED BY \'"\' ESCAPED BY \'\' > LINES TERMINATED BY \'\\r\\n\''; > // echo $sql2; > mysql_query($sql2); > echo ''; > mysql_query($sql0); > printf("Records added: %d\n", mysql_affected_rows()); > > echo 'UPDATE COMPLETE'; > > ?> > > Are you only passing the path to the "C:EXPORT.CSV" local file inside the query? You first need to upload the file. Either through a form or bu using FTP, SSH or something similar. More info about uploading files with PHP: http://php.net/manual/en/features.file-upload.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cygwin - compilation of PHP extension
Martin Zvarík wrote: > Hi, > > I am totally new in compiling under cygwin. > I need to compile an PHP extension, and this is what I figured so far: > I wouldn't expect cygwin to be that different to a real Linux environment - how about: untar the extension cd dir phpize ./configure make make install -- Per Jessen, Zürich (5.7°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
2009/3/30 Andrew Williams : > what does time(); > > $t1 = time(); > > { > > do something > } > $t2 = time(); > > $end_time = $t2 - $t1; > echo $end_time; > > what does $end_time represent? $end_time is not a great name for it: it's the time (number of seconds) it took to go from $t1 to $t2. $duration might be better. > how do you determine the next 5 mins? Eh? time() + 300 is five minutes from now. -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated March 14th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mac OS X + Apache2 + Dynamic Libraries
I've been wrestling with mac os x + php 5.2.6 off and on for a few months to get it to load the memcache.so and imagick.so extensions. When I executed php on the command line `php -i | grep imagick` or `php -i | grep memcache` the output shows that imagick and memcache are both being loaded successfully, and I can successfully use both libraries..from the command line. However, when I restart apache, the logs show that both extensions can not be loaded: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so' - (null) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/imagick.so' - (null) in Unknown on line 0 Both files are obviously there (as they are being loaded via the CLI execution of php). I've checked, both apache and php-cli are using the same php.ini configuration. I've thought it was some kind of permission or environment issue for the _www user, but i've managed to change my env information to the same as the _www user's (or, at least, as well as I know how) and I am still able to execute php from the CLI and have successfully loaded imagick and memcache. Again, I'm using OS X Leopard, and PHP 5.2.6, and Apache 2.2.9 Any help would be much appreciated. Thanks! stutter.
Re: [PHP] time() TIMER in seconds or just numbers
When someone does that, it means the execution time between $t1 and $t2... Att, Igor Escobar systems analyst & interface designer www . igorescobar . com On Mon, Mar 30, 2009 at 7:38 AM, Richard Heyes wrote: > 2009/3/30 Andrew Williams : > > what does time(); > > > > $t1 = time(); > > > > { > > > > do something > > } > > $t2 = time(); > > > > $end_time = $t2 - $t1; > > echo $end_time; > > > > what does $end_time represent? > > $end_time is not a great name for it: it's the time (number of > seconds) it took to go from $t1 to $t2. $duration might be better. > > > how do you determine the next 5 mins? > > Eh? time() + 300 is five minutes from now. > > -- > Richard Heyes > > HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: > http://www.rgraph.net (Updated March 14th) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] foreach and form submission.
Try this... $_POST = array_map('stri_tags', $_POST); Igor Escobar systems analyst & interface designer www . igorescobar . com On Sat, Mar 28, 2009 at 6:21 PM, Angus Mann wrote: > Thanks Ashley...that did the trick. > After reading about the limitations of strip_tags I decided to just replace > the bad bits as below... > It still uses your "foreach" suggestion but replaces "<" and ">" with "(" > and ")" instead of stripping tags. > > I think I will extend the good and bad arrays to deal with magic quotes > also ! > > $bad = array('<','<','<', '>', '>', '>'); > $good = array('(', '(', '(', ')', ')', ')'); > foreach ($_POST as $key => $value) { > $_POST[$key] = str_ireplace($bad, $good, $value); > > } > > > > > > I'd do something like this, so as to preserve the original post data >> array: >> >> $data = Array(); >> foreach($_POST as $key => $value) >> { >> $data[$key] = strip_tags($value); >> } >> >> Note that strip_tags() will not be able to decently clean up messy code >> (i.e. code where the opening or closing tags themselves aren't formed >> properly) >> >> >> Ash >> www.ashleysheridan.co.uk >> >> >> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] Security Support
On Sun, Mar 29, 2009 at 22:07, abdulazeez alugo wrote: >> Yea, dude, well me GED says I kin git it dun wit less wastid time. >> >> -- > No be only una get pidgin English ooo. Me sef fit do am sharp sharp no be say > them say. Is there any particular reason you guys totally trashed this thread? It's fine if you don't want to apply, but please don't go out of your way to try to make someone with a legitimate and properly-formatted request look like a moron because it backfires and reflects poorly on your own professionalism. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Read Text Content from PDF file
On Mon, Mar 30, 2009 at 3:16 AM, Michael A. Peters wrote: > Andrei Bintintan wrote: >> >> Any other ideas? >> >> > > Also - I believe the commercial (full) version of PDFlib can - in fact, I > believe you can do it with the pecl-pdflib library if you have the full > version of pdflib installed. > > I seem to remember there work on a clibpdf php wrapper back when php 4 was > new, I don't know if it ever amounted to anything. It may be worth your time to look into Adobe's IFilters. I know they've got class libraries for C# and other .NET languages--those COM DLLs could either be leveraged for PHP or there may be a "native" PHP implementation. Not in the mood to Google, -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
On Mon, Mar 30, 2009 at 7:55 AM, Sebastian Muszytowski wrote: > Thijs Lensselink schrieb: >> >> Sebastian Muszytowski wrote: >> >>> >>> Hello :) >>> >>> I have some troubles with php and mysql. I have a normal MySQL Query >>> and this returns X > 3 rows. >>> Now i want to get the last 3 inserted values. For Example i've inserted >>> >>> A, B, C, D, E >>> >>> I want to get the last inserted values, e.g. E D C (in reversed order) >>> >>> So how to do this? I already searched the web and the whole php.net site >>> but i don't see any workaround. >>> >>> Thanks in advance >>> >>> Sebastian >>> >>> >>> >> >> It's not really a PHP question. But here goes : >> >> SELECT column FROM `table` ORDER BY column DESC LIMIT 3 >> > > Oh okay thank you very much :) > > I thought I must do this with php and some sort of mysql_fetch_asssoc or > something like this Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a better way than grabbing rows in descending order based on the auto_increment value. Are you doing the inserts one at a time? If so, why not just use code to remember what you put in the DB? -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
haliphax schrieb: [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a better way than grabbing rows in descending order based on the auto_increment value. Are you doing the inserts one at a time? If so, why not just use code to remember what you put in the DB? I do the inserts one at a time, i could use code to remember but i think it would be very slow when i have too much users. The second thing that aware me from doing this is, why use/build ressources when you could use others? i think why should i use and add another system? I work with mysql already and when php+mysql have the function i need it's better and i don't waste ressources :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security Support
I agree with you Daniel Regards, Igor Escobar systems analyst & interface designer www . igorescobar . com On Mon, Mar 30, 2009 at 10:58 AM, Daniel Brown wrote: > On Sun, Mar 29, 2009 at 22:07, abdulazeez alugo > wrote: > >> Yea, dude, well me GED says I kin git it dun wit less wastid time. > >> > >> -- > > No be only una get pidgin English ooo. Me sef fit do am sharp sharp no be > say them say. > > Is there any particular reason you guys totally trashed this > thread? It's fine if you don't want to apply, but please don't go out > of your way to try to make someone with a legitimate and > properly-formatted request look like a moron because it backfires > and reflects poorly on your own professionalism. > > -- > > daniel.br...@parasane.net || danbr...@php.net > http://www.parasane.net/ || http://www.pilotpig.net/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: AW: [PHP] Read Text Content from PDF file
haliphax wrote: On Mon, Mar 30, 2009 at 3:16 AM, Michael A. Peters wrote: Andrei Bintintan wrote: Any other ideas? Also - I believe the commercial (full) version of PDFlib can - in fact, I believe you can do it with the pecl-pdflib library if you have the full version of pdflib installed. I seem to remember there work on a clibpdf php wrapper back when php 4 was new, I don't know if it ever amounted to anything. It may be worth your time to look into Adobe's IFilters. I know they've got class libraries for C# and other .NET languages--those COM DLLs could either be leveraged for PHP or there may be a "native" PHP implementation. Not in the mood to Google, Just a note - It looks overpriced for me but may be of value to corporate users, pdflib has a program called tet that can eat a pdf file and spit out an xml file with all kinds of groovy info about the pdf in it. Wish I had a spare grand just to play with it (since I'm Linux only, even at home, the server license is only possibility for me). It looks like tet would be superior way to grab info from pdf files for database/etc storage. I wonder if xpdf/poppler-utils could be extended to do something similar under a FOSS license. But that's off topic for this list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach and form submission.
That would be correct. but two things I have to add: * it's called bad style to re-write (override) predefined vars like _POST, _GET, _SERVER ... * using strip_tags() to clean user-input for safe output ist not O.K.! use htmlspecialchars(), at least. Regards, 2009/3/28 Virgilio Quilario : >> Hi all. >> >> I'm writing a script that accepts several different forms with different >> content. Depending on what data is sent with the form the script will do one >> or the other think. >> >> Before the form data is processed I'd like to scrub it of HTML tags. >> >> I can do this manually as below but the form may have dozens of items of >> data so I'd like to automate it. >> >> $_POST['name'] = strip_tags($_POST['name']); >> $_POST['address'] = strip_tags($_POST['address']); >> $_POST['phone'] = strip_tags($_POST['phone']); >> >> I saw a few lines of code once that used "foreach" on the $_POST array >> elements and it did not seem to matter how many or what names the elements >> had. >> >> Conceptually like this >> >> foreach ($_POST - element) { >> $_POST-element = strip_tags($_POST-element) >> } >> >> Any ideas please ? >> >> Thanks. >> > > here, > > foreach ($_POST as $key => $value) { > $_POST[$key] = strip_tags($value); > } > > good luck. > > virgil > http://www.jampmark.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP + MySQL - Load last inserts
> Date: Mon, 30 Mar 2009 14:55:08 +0200 > From: s.muszytow...@googlemail.com > To: p...@addmissions.nl > CC: php-general@lists.php.net > Subject: Re: [PHP] PHP + MySQL - Load last inserts > > Thijs Lensselink schrieb: > > Sebastian Muszytowski wrote: > > > >> Hello :) > >> > >> I have some troubles with php and mysql. I have a normal MySQL Query > >> and this returns X > 3 rows. > >> Now i want to get the last 3 inserted values. For Example i've inserted > >> > >> A, B, C, D, E > >> > >> I want to get the last inserted values, e.g. E D C (in reversed order) > >> > >> So how to do this? I already searched the web and the whole php.net site > >> but i don't see any workaround. > >> > >> Thanks in advance > >> > >> Sebastian > >> > >> > >> > > It's not really a PHP question. But here goes : > > > > SELECT column FROM `table` ORDER BY column DESC LIMIT 3 > > > Oh okay thank you very much :) > > I thought I must do this with php and some sort of mysql_fetch_asssoc or > something like this > Hey Dude, I'm sure you don't wanna complicate issues for yourself. You've been given two correct ways to go about it. I think you should try those. Ciao. _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
[PHP] php bug from 2003 still alive?!
Hello, I am experiencing problems with utf-8 and php. There seems to be a problem with BOM. Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Is this still necessary with the newest php build? If yes, do you believe I will run into trouble on sites that are saved in ansi? Thank you for any hint. Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
> When someone does that, it means the execution time between $t1 and $t2... Is that for my benefit? Believe it or not, I do know the arcane art of subtraction... -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated March 14th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server document root change
Hi All, My production server has facing disk full problem. Actually my server has the following drives mounted: /var - 10 GB /home - 200 GB etc... Now i want to change the document root of apache server from /var to /home. Is there any problem if i change this? Please suggest. Regards, Manoj
Re: [PHP] Server document root change
On Mon, Mar 30, 2009 at 11:59, Manoj Singh wrote: > Hi All, > > My production server has facing disk full problem. Actually my server has > the following drives mounted: > /var - 10 GB > /home - 200 GB > etc... > > Now i want to change the document root of apache server from /var to /home. > > Is there any problem if i change this? Please do not cross-post on lists, Manoj. The Apache folks will be able to guide you through this. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
On Mon, Mar 30, 2009 at 9:13 AM, Sebastian Muszytowski wrote: > haliphax schrieb: >>> >>> [..cut...] >> >> Except when your primary key value rolls over, or fills a gap between >> two other rows that was left when a row was deleted/moved/etc... there >> has got to be a better way than grabbing rows in descending order >> based on the auto_increment value. >> >> Are you doing the inserts one at a time? If so, why not just use code >> to remember what you put in the DB? >> > > I do the inserts one at a time, i could use code to remember but i think it > would be very slow when i have too much users. > > The second thing that aware me from doing this is, why use/build ressources > when you could use others? i think why should i use and add another system? > I work with mysql already and when php+mysql have the function i need it's > better and i don't waste ressources :) Insert 100 records. Delete 50 of them at random. Now do your "grab the last few records and sort them in descending order" trick and see where it gets you. Not trying to be rude, it just doesn't seem like you read any of what I wrote in my last message. Also--if you're already doing the inserts one at a time, you're not going to lose any noticeable speed by tracking the last 5 inserted rows or so. You are not working with an embedded system--this is a high-level programming language. Why is everybody always so concerned about adding two or three lines of code like it's going to slow their system to a crawl? Unless you're messing with file IO, chewing up gigantic amounts of RAM, or performing cryptography/compression, you don't need to be quite so frugal with your methods. I'm not saying you should be sloppy--just that you shouldn't completely disregard an option because it adds 1 term (NOT magnitude) to your project's Big-O Notation measure. My 2c. Go with ORDER BY asdf_id DESC if it suits your fancy. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes wrote: >> When someone does that, it means the execution time between $t1 and $t2... > > Is that for my benefit? Believe it or not, I do know the arcane art of > subtraction... I would subtract more often, but sacrificial farm animals and black candles are so hard to come by these days... -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac OS X + Apache2 + Dynamic Libraries
Stutter Stutters wrote: I've been wrestling with mac os x + php 5.2.6 off and on for a few months to get it to load the memcache.so and imagick.so extensions. When I executed php on the command line `php -i | grep imagick` or `php -i | grep memcache` the output shows that imagick and memcache are both being loaded successfully, and I can successfully use both libraries..from the command line. However, when I restart apache, the logs show that both extensions can not be loaded: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so' - (null) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/imagick.so' - (null) in Unknown on line 0 Both files are obviously there (as they are being loaded via the CLI execution of php). I've checked, both apache and php-cli are using the same php.ini configuration. I've thought it was some kind of permission or environment issue for the _www user, but i've managed to change my env information to the same as the _www user's (or, at least, as well as I know how) and I am still able to execute php from the CLI and have successfully loaded imagick and memcache. Again, I'm using OS X Leopard, and PHP 5.2.6, and Apache 2.2.9 Any help would be much appreciated. Thanks! I believe leopard has a custom PHP build (universal build) that runs in 64bit by default. Is there a bit architecture incompatibility issue with the libraries? Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o D. BROOKE EUCA Design Center WebDNA Software Corp. WEB:> http://www.euca.us | http://www.webdna.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php bug from 2003 still alive?! - UTF8 BOM
Hello everybody, has anybody an idea on how to fix this? Is it really necessary to recomplile for utf-8 BOM support? Regards, Merlin Merlin Morgenstern wrote: Hello, I am experiencing problems with utf-8 and php. There seems to be a problem with BOM. Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Is this still necessary with the newest php build? If yes, do you believe I will run into trouble on sites that are saved in ansi? Thank you for any hint. Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php bug from 2003 still alive?!
On Mon, Mar 30, 2009 at 12:42 PM, Merlin Morgenstern wrote: > Some postings say that I have to compile php with --enable-zend-multibyte. > HOwever those postings are very old (2003!). > http://bugs.php.net/bug.php?id=22108 Did you see what Derick said abut this in the last comment? * [22 Aug 2005 6:35pm UTC] der...@php.net* This will come with Unicode support in PHP 6.0 > Is this still necessary with the newest php build? Looks like it. > If yes, do you believe I will run into trouble on sites that are saved in > ansi? > I'm not sure, you should probably wait for someone else to reply :) Regards, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com
[PHP] Help figuring out an uploading script problem...
I have this script that is no longer working to upload files, it goes thru the motions and says the file is uploaded but then there is NO file in the ArtWork folder any ideas? if ($_FILES) { for ($x=0; $x < 15; $x++) { if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) { $ImageExt = strtolower(end(explode('.', $_FILES['Artwork']['name'][$x]))); $ImageName = $_FILES['Artwork']['name'][$x]; $ImageSize = $_FILES['Artwork']['size'][$x]; list($width, $height, $type, $attr) = getimagesize($_FILES['Artwork']['tmp_name'][$x]); $sql = "INSERT INTO images (ImageDate, ArtID, AdminID, ImageName, ImageType, ImageType2, ImageSize, ImageHeight, "; $sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(), '$ArtID', '$AdminID', '$ImageName', '$ImageExt',"; $sql .= " '$type', '$ImageSize', '$height', '$width', '$attr', '$Notes2')"; mysql_query ($sql); $ImageID = mysql_insert_id(); $uploadfile = "../../Artwork/". $ArtID ."_". $ImageID .".". $ImageExt; move_uploaded_file($_FILES['Artwork']['tmp_name'][$x], $uploadfile); chmod($uploadfile, 0666); } } } Thanks Terion Happy Freecycling Free the List !! www.freecycle.org Over Moderation of Freecycle List Prevents Post Timeliness. Report Moderator Abuse Here: http://www.freecycle.org/faq/faq/contact-info Or Email Your Complaint to: f...@freecycle.org or i...@freecycle.org Twitter? http://twitter.com/terionmiller Facebook: http://www.facebook.com/people/Terion-Miller/1542024891"; title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0 alt="Terion Miller's Facebook profile">
Re: [PHP] php bug from 2003 still alive?!
Yes I was reading about this. However, try to do a search on this: http://www.google.de/search?hl=de&q=enable-zend-multibyte&btnG=Google-Suche&meta= Loads of postings that do not look that good. What are all the chinese sites do? It is strange that there is no official description on php.net regarding this support. Thiago H. Pojda wrote: On Mon, Mar 30, 2009 at 12:42 PM, Merlin Morgenstern wrote: Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Did you see what Derick said abut this in the last comment? * [22 Aug 2005 6:35pm UTC] der...@php.net* This will come with Unicode support in PHP 6.0 Is this still necessary with the newest php build? Looks like it. If yes, do you believe I will run into trouble on sites that are saved in ansi? I'm not sure, you should probably wait for someone else to reply :) Regards, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-INSTALL] Mac OS X + Apache2 + Dynamic Libraries
On Mar 30, 2009, at 09:22 AM, Stutter Stutters wrote: I've been wrestling with mac os x + php 5.2.6 off and on for a few months to get it to load the memcache.so and imagick.so extensions. When I executed php on the command line `php -i | grep imagick` or `php -i | grep memcache` the output shows that imagick and memcache are both being loaded successfully, and I can successfully use both libraries..from the command line. However, when I restart apache, the logs show that both extensions can not be loaded: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/ php/extensions/no-debug-non-zts-20060613/memcache.so' - (null) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/ php/extensions/no-debug-non-zts-20060613/imagick.so' - (null) in Unknown on line 0 Let me take a wild guess, you built the modules and they don't include the x86_64 architecture? The following command will show the available architectures: file /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so The good news is you can rebuild all of your dependent libraries for multi architecture and rebuild all of your modules to be multi architecture and you will have solved your problem. Both files are obviously there (as they are being loaded via the CLI execution of php). I've checked, both apache and php-cli are using the same php.ini configuration. I've thought it was some kind of permission or environment issue for the _www user, but i've managed to change my env information to the same as the _www user's (or, at least, as well as I know how) and I am still able to execute php from the CLI and have successfully loaded imagick and memcache. Again, I'm using OS X Leopard, and PHP 5.2.6, and Apache 2.2.9 Any help would be much appreciated. Thanks! stutter. -- BuildSmart PGP.sig Description: This is a digitally signed message part
Re: [PHP] Help figuring out an uploading script problem...
On Mon, 2009-03-30 at 11:44 -0500, Terion Miller wrote: > I have this script that is no longer working to upload files, it goes thru > the motions and says the file is uploaded but then there is NO file in the > ArtWork folder > > any ideas? > if ($_FILES) { > for ($x=0; $x < 15; $x++) { > if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) { > $ImageExt = strtolower(end(explode('.', > $_FILES['Artwork']['name'][$x]))); > $ImageName = $_FILES['Artwork']['name'][$x]; > $ImageSize = $_FILES['Artwork']['size'][$x]; > list($width, $height, $type, $attr) = > getimagesize($_FILES['Artwork']['tmp_name'][$x]); > > $sql = "INSERT INTO images (ImageDate, ArtID, AdminID, > ImageName, ImageType, ImageType2, ImageSize, ImageHeight, "; > $sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(), > '$ArtID', '$AdminID', '$ImageName', '$ImageExt',"; > $sql .= " '$type', '$ImageSize', '$height', '$width', > '$attr', '$Notes2')"; > mysql_query ($sql); > $ImageID = mysql_insert_id(); > > $uploadfile = "../../Artwork/". $ArtID ."_". $ImageID .".". > $ImageExt; > move_uploaded_file($_FILES['Artwork']['tmp_name'][$x], > $uploadfile); > chmod($uploadfile, 0666); > } > } > } > > Thanks > Terion > > Happy Freecycling > Free the List !! > www.freecycle.org > Over Moderation of Freecycle List Prevents Post Timeliness. > Report Moderator Abuse Here: > http://www.freecycle.org/faq/faq/contact-info > Or Email Your Complaint to: > f...@freecycle.org or i...@freecycle.org > > Twitter? > http://twitter.com/terionmiller > > Facebook: > http://www.facebook.com/people/Terion-Miller/1542024891"; > title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0 > alt="Terion Miller's Facebook profile"> Well, there are many reasons this could fail, but you need to diagnose what is the actual problem. First, is it no longer working at all, or after a certain number of files are uploaded? I see you are trying to upload up to 15 files this way, are you sure that the combined file size is not greater than what your PHP setup can handle for a single post? Are the database inserts being performed correctly? If not, then PHP may be having problems seeing the uploaded files. Are there any error messages from this piece of code? Does the location to where you are attempting to move the files exist, and if so, does it have the correct permissions? Is there enough space on the drive/partition you are trying to move the files to? Lastly, the snippet of code you gave does not show where $ArtID was defined. Can you print out the query to see what it is actually doing? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help figuring out an uploading script problem...
2009/3/30 Terion Miller > I have this script that is no longer working to upload files, it goes thru > the motions and says the file is uploaded but then there is NO file in the > ArtWork folder > > any ideas? >if ($_FILES) { >for ($x=0; $x < 15; $x++) { >if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) { >$ImageExt = strtolower(end(explode('.', > $_FILES['Artwork']['name'][$x]))); >$ImageName = $_FILES['Artwork']['name'][$x]; >$ImageSize = $_FILES['Artwork']['size'][$x]; >list($width, $height, $type, $attr) = > getimagesize($_FILES['Artwork']['tmp_name'][$x]); > >$sql = "INSERT INTO images (ImageDate, ArtID, AdminID, > ImageName, ImageType, ImageType2, ImageSize, ImageHeight, "; >$sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(), > '$ArtID', '$AdminID', '$ImageName', '$ImageExt',"; >$sql .= " '$type', '$ImageSize', '$height', '$width', > '$attr', '$Notes2')"; >mysql_query ($sql); >$ImageID = mysql_insert_id(); > >$uploadfile = "../../Artwork/". $ArtID ."_". $ImageID .".". > $ImageExt; >move_uploaded_file($_FILES['Artwork']['tmp_name'][$x], > $uploadfile); >chmod($uploadfile, 0666); >} >} >} > > Thanks > Terion > > Happy Freecycling > Free the List !! > www.freecycle.org > Over Moderation of Freecycle List Prevents Post Timeliness. > Report Moderator Abuse Here: > http://www.freecycle.org/faq/faq/contact-info > Or Email Your Complaint to: > f...@freecycle.org or i...@freecycle.org > > Twitter? > http://twitter.com/terionmiller > > Facebook: > http://www.facebook.com/people/Terion-Miller/1542024891"; > title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0 > alt="Terion Miller's Facebook profile"> > Perchance did the permissions change on the folder or has the ini changed to limit the uploaded data? Is the folder full to disk capacity of the OS? -- Bastien Cat, the other other white meat
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 12:05 PM, haliphax wrote: > On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes wrote: > >> When someone does that, it means the execution time between $t1 and > $t2... > > > > Is that for my benefit? Believe it or not, I do know the arcane art of > > subtraction... > > I would subtract more often, but sacrificial farm animals and black > candles are so hard to come by these days... > > > -- > // Todd > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I have a couple of managers you can have...they bleat like sheep most of the time any way and don't provide much other than dung... -- Bastien Cat, the other other white meat
[PHP] UTF 8 support - enable-zend-multibyte ( was Re: [PHP] php bug from 2003 still alive?! - )
HI there, I now compiled php with zend multibyte. The trouble with the extra characters is now gone, but all special characters are now replaced with a questionmark! The document type shows utf-8, but somehow php seems not to pars the content OK. Does nobody have the same problem? Regards, Merlin Merlin Morgenstern wrote: Yes I was reading about this. However, try to do a search on this: http://www.google.de/search?hl=de&q=enable-zend-multibyte&btnG=Google-Suche&meta= Loads of postings that do not look that good. What are all the chinese sites do? It is strange that there is no official description on php.net regarding this support. Thiago H. Pojda wrote: On Mon, Mar 30, 2009 at 12:42 PM, Merlin Morgenstern wrote: Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Did you see what Derick said abut this in the last comment? * [22 Aug 2005 6:35pm UTC] der...@php.net* This will come with Unicode support in PHP 6.0 Is this still necessary with the newest php build? Looks like it. If yes, do you believe I will run into trouble on sites that are saved in ansi? I'm not sure, you should probably wait for someone else to reply :) Regards, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help figuring out an uploading script problem...
On Mon, Mar 30, 2009 at 1:11 PM, Ashley Sheridan wrote: > On Mon, 2009-03-30 at 11:44 -0500, Terion Miller wrote: > > I have this script that is no longer working to upload files, it goes > thru > > the motions and says the file is uploaded but then there is NO file in > the > > ArtWork folder > > > > any ideas? > > if ($_FILES) { > > for ($x=0; $x < 15; $x++) { > > if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) { > > $ImageExt = strtolower(end(explode('.', > > $_FILES['Artwork']['name'][$x]))); > > $ImageName = $_FILES['Artwork']['name'][$x]; > > $ImageSize = $_FILES['Artwork']['size'][$x]; > > list($width, $height, $type, $attr) = > > getimagesize($_FILES['Artwork']['tmp_name'][$x]); > > > > $sql = "INSERT INTO images (ImageDate, ArtID, AdminID, > > ImageName, ImageType, ImageType2, ImageSize, ImageHeight, "; > > $sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(), > > '$ArtID', '$AdminID', '$ImageName', '$ImageExt',"; > > $sql .= " '$type', '$ImageSize', '$height', '$width', > > '$attr', '$Notes2')"; > > mysql_query ($sql); > > $ImageID = mysql_insert_id(); > > > > $uploadfile = "../../Artwork/". $ArtID ."_". $ImageID > .".". > > $ImageExt; > > move_uploaded_file($_FILES['Artwork']['tmp_name'][$x], > > $uploadfile); > > chmod($uploadfile, 0666); > > } > > } > > } > > > > Thanks > > Terion > > > > Happy Freecycling > > Free the List !! > > www.freecycle.org > > Over Moderation of Freecycle List Prevents Post Timeliness. > > Report Moderator Abuse Here: > > http://www.freecycle.org/faq/faq/contact-info > > Or Email Your Complaint to: > > f...@freecycle.org or i...@freecycle.org > > > > Twitter? > > http://twitter.com/terionmiller > > > > Facebook: > > http://www.facebook.com/people/Terion-Miller/1542024891"; > > title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0 > > alt="Terion Miller's Facebook profile"> > > Well, there are many reasons this could fail, but you need to diagnose > what is the actual problem. First, is it no longer working at all, or > after a certain number of files are uploaded? I see you are trying to > upload up to 15 files this way, are you sure that the combined file size > is not greater than what your PHP setup can handle for a single post? > > Are the database inserts being performed correctly? If not, then PHP may > be having problems seeing the uploaded files. Are there any error > messages from this piece of code? Does the location to where you are > attempting to move the files exist, and if so, does it have the correct > permissions? Is there enough space on the drive/partition you are trying > to move the files to? > > Lastly, the snippet of code you gave does not show where $ArtID was > defined. Can you print out the query to see what it is actually doing? > > > Ash > www.ashleysheridan.co.uk > > Sorry guys I often forget to make sure I have clicked reply to ALL..and end up replying to just one of you: Thanks for the suggestions, the db inserts are working, all the info goes in, the only thing not working is there is no file in the Artwork file directory where the image is supposed to get moved. I will make sure the permissions are correct on the directory perhaps the hosting changed them? I thought the chmod command in the script would insure that the directory is writable.- Show quoted text - On Mon, Mar 30, 2009 at 12:09 PM, Bastien Koert wrote: > > > 2009/3/30 Terion Miller > >> I have this script that is no longer working to upload files, it goes thru >> the motions and says the file is uploaded but then there is NO file in the >> ArtWork folder >> >> any ideas? >>if ($_FILES) { >>for ($x=0; $x < 15; $x++) { >>if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) { >>$ImageExt = strtolower(end(explode('.', >> $_FILES['Artwork']['name'][$x]))); >>$ImageName = $_FILES['Artwork']['name'][$x]; >>$ImageSize = $_FILES['Artwork']['size'][$x]; >>list($width, $height, $type, $attr) = >> getimagesize($_FILES['Artwork']['tmp_name'][$x]); >> >>$sql = "INSERT INTO images (ImageDate, ArtID, AdminID, >> ImageName, ImageType, ImageType2, ImageSize, ImageHeight, "; >>$sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(), >> '$ArtID', '$AdminID', '$ImageName', '$ImageExt',"; >>$sql .= " '$type', '$ImageSize', '$height', '$width', >> '$attr', '$Notes2')"; >>mysql_query ($sql); >>$ImageID = mysql_insert_id(); >> >>$uploadfile = "../../Artwork/". $ArtID ."_". $ImageID .".
Re: [PHP] Help figuring out an uploading script problem...
On Mon, 2009-03-30 at 12:47 -0500, Terion Miller wrote: > On Mon, Mar 30, 2009 at 1:11 PM, Ashley Sheridan > wrote: > > > On Mon, 2009-03-30 at 11:44 -0500, Terion Miller wrote: > > > I have this script that is no longer working to upload files, it goes > > thru > > > the motions and says the file is uploaded but then there is NO file in > > the > > > ArtWork folder > > > > > > any ideas? > > > if ($_FILES) { > > > for ($x=0; $x < 15; $x++) { > > > if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) { > > > $ImageExt = strtolower(end(explode('.', > > > $_FILES['Artwork']['name'][$x]))); > > > $ImageName = $_FILES['Artwork']['name'][$x]; > > > $ImageSize = $_FILES['Artwork']['size'][$x]; > > > list($width, $height, $type, $attr) = > > > getimagesize($_FILES['Artwork']['tmp_name'][$x]); > > > > > > $sql = "INSERT INTO images (ImageDate, ArtID, AdminID, > > > ImageName, ImageType, ImageType2, ImageSize, ImageHeight, "; > > > $sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(), > > > '$ArtID', '$AdminID', '$ImageName', '$ImageExt',"; > > > $sql .= " '$type', '$ImageSize', '$height', '$width', > > > '$attr', '$Notes2')"; > > > mysql_query ($sql); > > > $ImageID = mysql_insert_id(); > > > > > > $uploadfile = "../../Artwork/". $ArtID ."_". $ImageID > > .".". > > > $ImageExt; > > > move_uploaded_file($_FILES['Artwork']['tmp_name'][$x], > > > $uploadfile); > > > chmod($uploadfile, 0666); > > > } > > > } > > > } > > > > > > Thanks > > > Terion > > > > > > Happy Freecycling > > > Free the List !! > > > www.freecycle.org > > > Over Moderation of Freecycle List Prevents Post Timeliness. > > > Report Moderator Abuse Here: > > > http://www.freecycle.org/faq/faq/contact-info > > > Or Email Your Complaint to: > > > f...@freecycle.org or i...@freecycle.org > > > > > > Twitter? > > > http://twitter.com/terionmiller > > > > > > Facebook: > > > http://www.facebook.com/people/Terion-Miller/1542024891"; > > > title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0 > > > alt="Terion Miller's Facebook profile"> > > > > Well, there are many reasons this could fail, but you need to diagnose > > what is the actual problem. First, is it no longer working at all, or > > after a certain number of files are uploaded? I see you are trying to > > upload up to 15 files this way, are you sure that the combined file size > > is not greater than what your PHP setup can handle for a single post? > > > > Are the database inserts being performed correctly? If not, then PHP may > > be having problems seeing the uploaded files. Are there any error > > messages from this piece of code? Does the location to where you are > > attempting to move the files exist, and if so, does it have the correct > > permissions? Is there enough space on the drive/partition you are trying > > to move the files to? > > > > Lastly, the snippet of code you gave does not show where $ArtID was > > defined. Can you print out the query to see what it is actually doing? > > > > > > Ash > > www.ashleysheridan.co.uk > > > > Sorry guys I often forget to make sure I have clicked reply to ALL..and end > up replying to just one of you: > Thanks for the suggestions, the db inserts are working, all the info goes > in, the only thing not working is there is no file in the Artwork file > directory where the image is supposed to get moved. > I will make sure the permissions are correct on the directory perhaps the > hosting changed them? I thought the chmod command in the script would insure > that the directory is writable.- Show quoted text - > > > > > > On Mon, Mar 30, 2009 at 12:09 PM, Bastien Koert wrote: > > > > > > > 2009/3/30 Terion Miller > > > >> I have this script that is no longer working to upload files, it goes thru > >> the motions and says the file is uploaded but then there is NO file in the > >> ArtWork folder > >> > >> any ideas? > >>if ($_FILES) { > >>for ($x=0; $x < 15; $x++) { > >>if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) { > >>$ImageExt = strtolower(end(explode('.', > >> $_FILES['Artwork']['name'][$x]))); > >>$ImageName = $_FILES['Artwork']['name'][$x]; > >>$ImageSize = $_FILES['Artwork']['size'][$x]; > >>list($width, $height, $type, $attr) = > >> getimagesize($_FILES['Artwork']['tmp_name'][$x]); > >> > >>$sql = "INSERT INTO images (ImageDate, ArtID, AdminID, > >> ImageName, ImageType, ImageType2, ImageSize, ImageHeight, "; > >>$sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(), > >> '$ArtID', '$AdminID'
[PHP] Re: [PHP-INSTALL] Mac OS X + Apache2 + Dynamic Libraries
I used Pecl to install memcache and imagick, I ran the command you mentioned and this was the output: $ file /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so: Mach-O bundle i386 I don't see anything regarding x86_64, so I assume it's not built with 64 bit support. Sounds like an awesome time to fix. Especially, since I don't know where to begin :( Any pointers? -Stutter On Mon, Mar 30, 2009 at 1:05 PM, BuildSmart wrote: > On Mar 30, 2009, at 09:22 AM, Stutter Stutters wrote: > > I've been wrestling with mac os x + php 5.2.6 off and on for a few months to > get it to load the memcache.so and imagick.so extensions. When I executed > php on the command line `php -i | grep imagick` or `php -i | grep memcache` > the output shows that imagick and memcache are both being loaded > successfully, and I can successfully use both libraries..from the command > line. > > However, when I restart apache, the logs show that both extensions can not > be loaded: > > PHP Warning: PHP Startup: Unable to load dynamic library > '/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so' - (null) in > Unknown on line 0 > PHP Warning: PHP Startup: Unable to load dynamic library > '/usr/lib/php/extensions/no-debug-non-zts-20060613/imagick.so' - (null) in > Unknown on line 0 > > Let me take a wild guess, you built the modules and they don't include the > x86_64 architecture? > The following command will show the available architectures: > file /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so > The good news is you can rebuild all of your dependent libraries for multi > architecture and rebuild all of your modules to be multi architecture and > you will have solved your problem. > > Both files are obviously there (as they are being loaded via the CLI > execution of php). I've checked, both apache and php-cli are using the same > php.ini configuration. I've thought it was some kind of permission or > environment issue for the _www user, but i've managed to change my env > information to the same as the _www user's (or, at least, as well as I know > how) and I am still able to execute php from the CLI and have successfully > loaded imagick and memcache. > > Again, I'm using OS X Leopard, and PHP 5.2.6, and Apache 2.2.9 > > Any help would be much appreciated. > > Thanks! > > stutter. > > -- BuildSmart > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 11:37 AM, Igor Escobar wrote: > The people use that to measure performance. > > If you're intersted about that read > http://www.igorescobar.com/blog/2009/03/05/benchmarking-de-desempenho-no-php/ > (in portuguese, sorry) > > Regards, > Igor Escobar > > On Mon, Mar 30, 2009 at 1:05 PM, haliphax wrote: >> >> On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes wrote: >> >> When someone does that, it means the execution time between $t1 and >> >> $t2... >> > >> > Is that for my benefit? Believe it or not, I do know the arcane art of >> > subtraction... >> >> I would subtract more often, but sacrificial farm animals and black >> candles are so hard to come by these days... Oh, I'm fully aware of what it's for. FYI, microtime() is probably more appropriate, since 1 full second in computer terms is a loong time. ...and I don't speak a lick of Portuguese. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF 8 support - enable-zend-multibyte ( was Re: [PHP] php bug from 2003 still alive?! - )
On Mon, Mar 30, 2009 at 12:34 PM, Merlin Morgenstern wrote: > HI there, > > I now compiled php with zend multibyte. The trouble with the extra > characters is now gone, but all special characters are now replaced with a > questionmark! The document type shows utf-8, but somehow php seems not to > pars the content OK. > > Does nobody have the same problem? > > Regards, Merlin Please stop top-posting. Anyway, are you using a META tag codepage to tell the web browser what to do with those special characters? I'm not certain a DOCTYPE is going to handle everything. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
Okey, but you understand the purpouse of it? Igor Escobar systems analyst & interface designer www . igorescobar . com On Mon, Mar 30, 2009 at 3:42 PM, haliphax wrote: > On Mon, Mar 30, 2009 at 11:37 AM, Igor Escobar > wrote: > > The people use that to measure performance. > > > > If you're intersted about that read > > > http://www.igorescobar.com/blog/2009/03/05/benchmarking-de-desempenho-no-php/ > > (in portuguese, sorry) > > > > Regards, > > Igor Escobar > > > > On Mon, Mar 30, 2009 at 1:05 PM, haliphax wrote: > >> > >> On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes > wrote: > >> >> When someone does that, it means the execution time between $t1 and > >> >> $t2... > >> > > >> > Is that for my benefit? Believe it or not, I do know the arcane art of > >> > subtraction... > >> > >> I would subtract more often, but sacrificial farm animals and black > >> candles are so hard to come by these days... > > Oh, I'm fully aware of what it's for. FYI, microtime() is probably > more appropriate, since 1 full second in computer terms is a loong > time. > > ...and I don't speak a lick of Portuguese. > > > -- > // Todd >
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 1:51 PM, Igor Escobar wrote: > Okey, but you understand the purpouse of it? > > On Mon, Mar 30, 2009 at 3:42 PM, haliphax wrote: >> >> On Mon, Mar 30, 2009 at 11:37 AM, Igor Escobar >> wrote: >> > The people use that to measure performance. >> > >> > If you're intersted about that read >> > >> > http://www.igorescobar.com/blog/2009/03/05/benchmarking-de-desempenho-no-php/ >> > (in portuguese, sorry) >> > >> > Regards, >> > Igor Escobar >> > >> > On Mon, Mar 30, 2009 at 1:05 PM, haliphax wrote: >> >> >> >> On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes >> >> wrote: >> >> >> When someone does that, it means the execution time between $t1 and >> >> >> $t2... >> >> > >> >> > Is that for my benefit? Believe it or not, I do know the arcane art >> >> > of >> >> > subtraction... >> >> >> >> I would subtract more often, but sacrificial farm animals and black >> >> candles are so hard to come by these days... >> >> Oh, I'm fully aware of what it's for. FYI, microtime() is probably >> more appropriate, since 1 full second in computer terms is a loong >> time. >> >> ...and I don't speak a lick of Portuguese. Please stop top-posting. "I'm fully aware of what it's for" == "I am aware of its purpose". My point was that time() gives you seconds since the UNIX epoch, whereas microtime(true) will give you more accurate results if you are looking to benchmark a script. If your script takes a few minutes and you don't really care about measuring those milli/micro seconds, then time() should suit your needs just fine. However, if your script can perform an iteration in less than one second, you have already eliminated the usefulness of time() for benchmarks. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with header();
Hi guys, probably everybody goes think: "its the same problem ever" HTML before header() functions ... but it is not. I has working on a project and this are a running in "Windows" (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening "Warning: Cannot modify *header* information - headers already sent by" On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the fuck is happening? Regards, Igor Escobar systems analyst & interface designer www . igorescobar . com
Re: [PHP] Re: [PHP-INSTALL] Mac OS X + Apache2 + Dynamic Libraries
Stutter Stutters wrote: I used Pecl to install memcache and imagick, I ran the command you mentioned and this was the output: $ file /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so: Mach-O bundle i386 I don't see anything regarding x86_64, so I assume it's not built with 64 bit support. Sounds like an awesome time to fix. Especially, since I don't know where to begin :( Any pointers? -Stutter One option: it may be better to run your entire web system in 32 bit mode. It's more compatible than 64bit and you really don't lose anything regarding performance. The default Leopard PHP mod will run in 32bit mode. To do this, you'd need to 'thin' your apache build using a command-line called lipo. Use your google fu: lipo thin httpd i386 (make sure to do a backup of your httpd file and call it something like: httpdFat.bu. This way you can always revert back if compatibility is not the issue.) HTH, Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o D. BROOKE EUCA Design Center WebDNA Software Corp. WEB:> http://www.euca.us | http://www.webdna.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header();
2009/3/30 Igor Escobar : > Hi guys, probably everybody goes think: "its the same problem ever" HTML > before header() functions ... but it is not. > > I has working on a project and this are a running in "Windows" (shame on > me). > Recently i migrate to *Ubuntu *and some problems occurred and that > specifically i can't understand WHY this rappening > > "Warning: Cannot modify *header* information - headers already sent by" > > On my web server on the internet it's OK > On my local web server on my work it's OK > On my loca web server on my notebook it's the problem. Chances are good that php.ini on your notebook has output buffers switched off. Google it if you don't know what they are. > This error occurs only in my notebook (recently that I migrate to linux and > it does not already). > > Please, someone have any idea what the is happening? Please refrain from using language like that on this list. It's unnecessary inappropriate. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF 8 support - enable-zend-multibyte ( was Re: [PHP] php bug from 2003 still alive?! - )
haliphax wrote: On Mon, Mar 30, 2009 at 12:34 PM, Merlin Morgenstern wrote: HI there, I now compiled php with zend multibyte. The trouble with the extra characters is now gone, but all special characters are now replaced with a questionmark! The document type shows utf-8, but somehow php seems not to pars the content OK. Does nobody have the same problem? Regards, Merlin Please stop top-posting. Anyway, are you using a META tag codepage to tell the web browser what to do with those special characters? I'm not certain a DOCTYPE is going to handle everything. HI, I am using a meta tag: I have also configured apache: AddDefaultCharset utf-8 Also php: header('content-type: text/html; charset=utf-8'); Header: HTTP/1.x 200 OK Date: Mon, 30 Mar 2009 19:14:22 GMT Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.9 X-Powered-By: PHP/5.2.9 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 The chinese characters which come directly out of the database are shown corretly. The chinese chars that are saved in a text file show up as a question mark. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help figuring out an uploading script problem...
> > The chmod in the script just ensures that the file you uploaded is given > the correct permissions. Turn on all errors and warnings for the script > so you can see where the problem is. > > > Ash > www.ashleysheridan.co.uk > > Thanks everyone, I figured it out, it was the directory permissions ...now it's working fine. Monday isn't so bad after all today!!
Re: [PHP] Security Support
- Original Message - From: "Michael A. Peters" To: "Grant Peel" Cc: Sent: Sunday, March 29, 2009 10:00 PM Subject: Re: [PHP] Security Support Grant Peel wrote: Good Morning / Afternoon, We run several of our own servers: - Dell Power Edge 1U, Pentium, - FreeBSD (6.x soon to be 7.x) - along with all the standard Web Application installation (PHP Apache Exim, Pop3, Proftp, MySQL etc etc). What I am asking here, is if any one in this community has the knowledge to act as a security consultant in an occasional, as required basis. Anyone interested should have expience with Apache, PHP, Perl on the FreeBSD platform. No experience with FreeBSD and probably not enough with Perl - but whoever you hire, make sure they suggest your php build is hardened by suhosin - both the core php patch and the loadable module. Hi Again all, I am not sure what to make of all the chatter on this post To date, I have not recieved any sincere replies, which is a bit suprising. I am thinking that this job would be easy money for someone who already knows the ins and outs of php/Apache from a secuirty standpoint. I already have sohosin patch applied (it is applied as part of the default FreeBSD - php port). Anyways, the offer is still out there if anyone is interested. -Grant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
Andrew Williams wrote: > what does time(); > > $t1 = time(); > > { > > do something > } > $t2 = time(); > > $end_time = $t2 - $t1; > echo $end_time; > > what does $end_time represent? > > how do you determine the next 5 mins? So if you haven't deduced the answer from other replies, this would probably be more readable: $start_time = time(); //or microtime() //do something $end_time = time(); //or microtime() $duration = $end_time - $start_time; echo $duration; -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 3:35 PM, Shawn McKenzie wrote: > Andrew Williams wrote: >> what does time(); >> >> $t1 = time(); >> >> { >> >> do something >> } >> $t2 = time(); >> >> $end_time = $t2 - $t1; >> echo $end_time; >> >> what does $end_time represent? >> >> how do you determine the next 5 mins? > > So if you haven't deduced the answer from other replies, this would > probably be more readable: > > $start_time = time(); //or microtime() > //do something > $end_time = time(); //or microtime() > > $duration = $end_time - $start_time; > echo $duration; Don't forget--microtime() without the boolean "true" as an argument will split the result into two parts. Using "true" as the argument (minus quotes, of course) gives you a floating-point representation of seconds/milliseconds/etc. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security Support
Grant Peel wrote: - Original Message - From: "Michael A. Peters" To: "Grant Peel" Cc: Sent: Sunday, March 29, 2009 10:00 PM Subject: Re: [PHP] Security Support Grant Peel wrote: Good Morning / Afternoon, We run several of our own servers: - Dell Power Edge 1U, Pentium, - FreeBSD (6.x soon to be 7.x) - along with all the standard Web Application installation (PHP Apache Exim, Pop3, Proftp, MySQL etc etc). What I am asking here, is if any one in this community has the knowledge to act as a security consultant in an occasional, as required basis. Anyone interested should have expience with Apache, PHP, Perl on the FreeBSD platform. No experience with FreeBSD and probably not enough with Perl - but whoever you hire, make sure they suggest your php build is hardened by suhosin - both the core php patch and the loadable module. Hi Again all, I am not sure what to make of all the chatter on this post To date, I have not recieved any sincere replies, which is a bit suprising. I am thinking that this job would be easy money for someone who already knows the ins and outs of php/Apache from a secuirty standpoint. I already have sohosin patch applied (it is applied as part of the default FreeBSD - php port). Anyways, the offer is still out there if anyone is interested. Nobody might have the right mix of skills you require (where-as going for a company if one person doesn't have the skills, someone else can take over). Probably quite a few people here could do the php and bsd but not the perl, or could do the php/perl but no idea about bsd (I fit into that category). -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LOAD INFILE
Thijs Lensselink wrote: John Boy wrote: Hi I want to upload a .csv file from my local pc to a mysql server. My local machine is XP2. I have used the following but the file does not upload. When using php MyAdmin it returns the error 'file not found'. Can anyone help? Why not just use phpmyadmin to import it? It can read csv files. // Connect - note: 'false' is 'no new link use existing' parameter and '128' enables LOAD DATA $connection = mysql_connect($db_host, $db_username, $db_password,false,128); if (!$connection){ die ("Could not connect to the database: ". mysql_error()); } // Select the database $db_select=mysql_select_db($db_database); if (!$db_select) { die ("Could not select the database: ". mysql_error()); } // Import new avaiability data from local CSV file $sql2 = 'LOAD DATA LOCAL INFILE \'C:EXPORT.CSV\' INTO TABLE `availability` FIELDS TERMINATED BY \';\' ENCLOSED BY \'"\' ESCAPED BY \'\' LINES TERMINATED BY \'\\r\\n\''; // echo $sql2; mysql_query($sql2); echo ''; mysql_query($sql0); printf("Records added: %d\n", mysql_affected_rows()); echo 'UPDATE COMPLETE'; ?> Are you only passing the path to the "C:EXPORT.CSV" local file inside the query? You first need to upload the file. Either through a form or bu using FTP, SSH or something similar. To expand on that, LOAD DATA reads the file from the database server, not from your computer or any other server. Once you've uploaded it, put the right path in (eg /home/username/export.csv) and it should work. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
haliphax wrote: On Mon, Mar 30, 2009 at 9:13 AM, Sebastian Muszytowski wrote: haliphax schrieb: [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a better way than grabbing rows in descending order based on the auto_increment value. Are you doing the inserts one at a time? If so, why not just use code to remember what you put in the DB? I do the inserts one at a time, i could use code to remember but i think it would be very slow when i have too much users. The second thing that aware me from doing this is, why use/build ressources when you could use others? i think why should i use and add another system? I work with mysql already and when php+mysql have the function i need it's better and i don't waste ressources :) Insert 100 records. Delete 50 of them at random. Now do your "grab the last few records and sort them in descending order" trick and see where it gets you. Mysql does not re-use id's (nor does any other db as far as I'm aware, and nor should it). I don't know where you got that idea from. mysql> create table test (id int auto_increment not null primary key, name text); Query OK, 0 rows affected (0.12 sec) mysql> insert into test(name) values ('one'),('two'),('three'),('four'),('five'),('six'),('seven'),('eight'),('nine'),('ten'); Query OK, 10 rows affected (0.00 sec) Records: 10 Duplicates: 0 Warnings: 0 mysql> select * from test; ++---+ | id | name | ++---+ | 1 | one | | 2 | two | | 3 | three | | 4 | four | | 5 | five | | 6 | six | | 7 | seven | | 8 | eight | | 9 | nine | | 10 | ten | ++---+ 10 rows in set (0.00 sec) mysql> delete from test where id in (1,3,7); Query OK, 3 rows affected (0.00 sec) mysql> insert into test(name) values('eleven'); Query OK, 1 row affected (0.00 sec) mysql> select * from test; +++ | id | name | +++ | 2 | two| | 4 | four | | 5 | five | | 6 | six| | 11 | eleven | | 8 | eight | | 9 | nine | | 10 | ten| +++ 8 rows in set (0.00 sec) The physical order of the rows changed (as you can see) but it does not re-use the id's that were deleted. Ordering by the id will get you the last bunch inserted. If you're using innodb you'll have to be aware it's transaction specific, if you're using myisam it will be system wide. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
On Mon, Mar 30, 2009 at 5:10 PM, Chris wrote: > haliphax wrote: >> >> On Mon, Mar 30, 2009 at 9:13 AM, Sebastian Muszytowski >> wrote: >>> >>> haliphax schrieb: > > [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a better way than grabbing rows in descending order based on the auto_increment value. Are you doing the inserts one at a time? If so, why not just use code to remember what you put in the DB? >>> I do the inserts one at a time, i could use code to remember but i think >>> it >>> would be very slow when i have too much users. >>> >>> The second thing that aware me from doing this is, why use/build >>> ressources >>> when you could use others? i think why should i use and add another >>> system? >>> I work with mysql already and when php+mysql have the function i need >>> it's >>> better and i don't waste ressources :) >> >> Insert 100 records. Delete 50 of them at random. Now do your "grab the >> last few records and sort them in descending order" trick and see >> where it gets you. > > Mysql does not re-use id's (nor does any other db as far as I'm aware, and > nor should it). I don't know where you got that idea from. > > mysql> create table test (id int auto_increment not null primary key, name > text); > Query OK, 0 rows affected (0.12 sec) > > mysql> insert into test(name) values > ('one'),('two'),('three'),('four'),('five'),('six'),('seven'),('eight'),('nine'),('ten'); > Query OK, 10 rows affected (0.00 sec) > Records: 10 Duplicates: 0 Warnings: 0 > > mysql> select * from test; > ++---+ > | id | name | > ++---+ > | 1 | one | > | 2 | two | > | 3 | three | > | 4 | four | > | 5 | five | > | 6 | six | > | 7 | seven | > | 8 | eight | > | 9 | nine | > | 10 | ten | > ++---+ > 10 rows in set (0.00 sec) > > mysql> delete from test where id in (1,3,7); > Query OK, 3 rows affected (0.00 sec) > > mysql> insert into test(name) values('eleven'); > Query OK, 1 row affected (0.00 sec) > > mysql> select * from test; > +++ > | id | name | > +++ > | 2 | two | > | 4 | four | > | 5 | five | > | 6 | six | > | 11 | eleven | > | 8 | eight | > | 9 | nine | > | 10 | ten | > +++ > 8 rows in set (0.00 sec) > > The physical order of the rows changed (as you can see) but it does not > re-use the id's that were deleted. > > Ordering by the id will get you the last bunch inserted. > > If you're using innodb you'll have to be aware it's transaction specific, if > you're using myisam it will be system wide. I'll have to check my DBs then, because the exact situation I described happened to me a few years back when I was first getting into the DB scene. Regardless, I'm fairly certain the MSSQL box we have at work behaves this way. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + MySQL - Load last inserts
The physical order of the rows changed (as you can see) but it does not re-use the id's that were deleted. Ordering by the id will get you the last bunch inserted. If you're using innodb you'll have to be aware it's transaction specific, if you're using myisam it will be system wide. I'll have to check my DBs then, because the exact situation I described happened to me a few years back when I was first getting into the DB scene. Regardless, I'm fairly certain the MSSQL box we have at work behaves this way. Maybe it's a version thing, that test was done on mysql 5 (I'm sure it'll work on mysql 4.0/4.1 as well). No idea about ones before that. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] formulate nested select
I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example "SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID && b.id = c.bookID $Auth = A echoes as A var_dump returns boolean false and I get a warning - mysql_num_rows(): supplied argument is not valid It is obvious that the syntax is ok, but there is something here that I do not understand. It would appear that this should be something very simple, but I don't see logic working here since I can not do this either "SELECT * FROM book b, book_authors c, author a WHERE c.authID = (SELECT a.id WHERE LEFT(a.last_name) = $Auth) && b.id = c.bookID ... I would really appreciate some help & clarification. TIA -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example "SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID && b.id = c.bookID Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') ); -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 5.2.9 changes - phpwiki
Hello all, Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9. After the upgrade, phpwiki (1.3.14) started spitting out the following two errors, both of which are basically leaving the wiki dead in the water: [30-Mar-2009 22:01:23] PHP Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : eval()'d code on line 2 [30-Mar-2009 22:01:23] PHP Fatal error: Class 'WikiDB_backend_PearDB_PearDB' not found in /usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25 Looking at the changelog, I'm simply not seeing anything that would cause this. Snippets of both files are below. Looking for any pointers - I need to get the wiki up and running again and phpwiki releases are few and far between. Thanks, Charles first error is in this block: /** * safe php4 definition for clone. * php5 copies objects by reference, but we need to clone "deep copy" in some places. * (BlockParser) * We need to eval it as workaround for the php5 parser. * See http://www.acko.net/node/54 */ if (!check_php_version(5)) { eval(' function clone($object) { return $object; } '); } And the second error is in here: function WikiDB_SQL ($dbparams) { $backend = 'PearDB'; if (is_array($dbparams['dsn'])) $backend = $dbparams['dsn']['phptype']; elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m)) $backend = $m[1]; if ($backend == 'postgres7') { // ADODB cross-compatiblity hack (for uni t testing) $backend = 'pgsql'; if (is_string($dbparams['dsn'])) $dbparams['dsn'] = $backend . ':' . substr($dbparams['dsn'], 10) ; } include_once ("lib/WikiDB/backend/PearDB_".$backend.".php"); $backend_class = "WikiDB_backend_PearDB_".$backend; $backend = & new $backend_class($dbparams); if (DB::isError($backend->_dbh)) return; $this->WikiDB($backend, $dbparams); } The variable "$backend" is getting futzed up somewhere... Not much to go on, I know... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header();
Output buffering turned off? Bastien Sent from my iPod On Mar 30, 2009, at 15:03, Igor Escobar wrote: Hi guys, probably everybody goes think: "its the same problem ever" HTML before header() functions ... but it is not. I has working on a project and this are a running in "Windows" (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening "Warning: Cannot modify *header* information - headers already sent by" On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the fuck is happening? Regards, Igor Escobar systems analyst & interface designer www . igorescobar . com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example "SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID && b.id = c.bookID Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example "SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID && b.id = c.bookID Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? Probably, I didn't look at the doco - I (stupidly I know) assumed it was correct in the original example. Thanks for the correction. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Working in UTF-8 - BOM trouble
Hi there, I am having trouble to switch with an i18n project to utf-8. The problem is, that php has trouble with files that are saved in UTF-8 with BOM. It is causing strange bahavior like adding extra headers. On the other hand most editors only save UTF-8 with BOM. Has somebody experienced the same problem? How did you overcome it? Regards, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 5.2.9 changes - phpwiki
Charles Sprickman wrote: Hello all, Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9. After the upgrade, phpwiki (1.3.14) started spitting out the following two errors, both of which are basically leaving the wiki dead in the water: [30-Mar-2009 22:01:23] PHP Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : eval()'d code on line 2 [30-Mar-2009 22:01:23] PHP Fatal error: Class 'WikiDB_backend_PearDB_PearDB' not found in /usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25 first error is in this block: /** * safe php4 definition for clone. * php5 copies objects by reference, but we need to clone "deep copy" in some places. * (BlockParser) * We need to eval it as workaround for the php5 parser. * See http://www.acko.net/node/54 */ if (!check_php_version(5)) { eval(' function clone($object) { return $object; } '); } I know nothing about phpwiki - but it looks like check_php_version() is a function they have defined? Because reading the code, if check_php_version(5) is support to return true for php 5 then the eval should only be triggered if the version of php is not 5 - in which case, where phpwiki is broken is in the check_php_version() function. What happens when you run of course you'll need to copy their check_php version() function into your page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php