Re: [PHP] download not working
On Wed, Dec 28, 2005 at 01:03:55PM -, Ross wrote: > The pdf is fine, there are no errors . All I get is a small (130byte) pdf > file which is corrupt when I try and open it. Open the file in notepad and look at the 130 bytes, it probably will give you a clue. > > Thanks, > > R. > > "Jochem Maas" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > are people supposed to smell what is not working? > > do you get any errors? is it possible the PDF was corrupt > > when you uploaded it? > > > > Ross wrote: > >> working form this example > >> > >> http://www.php-mysql-tutorial.com/php-mysql-upload.php > >> > >> > >> my code is as follows, all I get is a corrupt pdf file. > >> > >> $query= "SELECT * FROM publications WHERE alphabet='a'"; > >> ... > >> echo $content; > >> -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error: Process limit exceeded for uid 10337 [25 >= 24]
On Wed, Dec 28, 2005 at 08:33:58AM -0500, Cesar Cruz wrote: > This error happens in my Web http://www.millonarios.com.co/ > > Process limit exceeded for uid 10337 [25 >= 24] > > as it can be the cause? This sounds like some sort of OS error, probably due to your uid not being able to go over a certain nubmer of processes running, by the login class you belong to. You my want to contact your server admin about this. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO & pdo_odbc
On Wed, Dec 28, 2005 at 02:14:43PM +0100, Markus Fischer wrote: > Hi, > > I'm using the following code in a PHP 5.1, Windows CLI environment: > > $p = new PDO('odbc:driver={Microsoft Access Driver > (*.mdb)};Dbq=beispieldatenbank.mdb'); > $s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)'); > $s->execute(array('test1', 'test2')); > ... Just out of curiosity, how does this perform: $p->exec('INSERT ... VALUES('test1', 'test2')); > ... > but which all resulted in a row being inserted but the values were just > empty. > > When I tried something like this: > $s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)'); > $val1 = 'test1'; > $val2 = 'test2'; > $s->bindParam(1, $val1); > $s->bindParam(2, $val2); > $s->execute(); > > I even get a crash. yeah a crash is bad. I'm not familiar with windows installs so I dont really know if it is a bad install or related to php's pdo_odbc driver. > > Am I doing something conceptual wrong? The code looks like it should perform as you have it. Although if this is just for one insert statment i would use the $dbh->exec() method instead. The prepare/execute method is more for batching a bunch of queries: $stmt = $dbh->prepare('insert into foo(value) values(?)'); for($i=0; $i < 10; $i++) { $stmt->execute(array($i)); } But then again it should be working either way. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Reader
Is there any easy php script to run to view an xml file such as new headlines like so: http://news.google.com/?output=rss or can anyone point me in the right direction for good online tutorials or books.
Re: [PHP] Location ....
On Wed, Dec 28, 2005 at 03:15:09PM +0100, Christian Ista wrote: > Hello, > > Could you tell me a efficient solution for change page (new location) in > PHP? I tried this code : header("Location: mypage.php"); > > But in some case, I have error message "heade already send". Then I use a > javascript solution : window.location.href="mypage.php"; If you look at the error message it tells you exactly what line the headers were sent at. I'm to tired to explain what do do once you find that hopefully you'll see the problem. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pdo_informix
On Wed, Dec 28, 2005 at 04:56:31PM +0200, Aleksander wrote: > Hi, > > How do I install pdo_informix? Some information on installtion is here: http://php.net/pdo_informix This is a basic pecl installation, the general process goes something like: 1) get latest release (or if daring cvs checkout) 2) extract into folder (assuming pdo_informix/) 3) cd pdo_informix 4) phpize 5) ./configure (with options) 6) make 7) su; make install 8) edit php.ini and enable the extension 9) restart web server (not a graceful) 10) exit There are some docs that should probably go in more depth than that at: http://us3.php.net/install.pecl > > There's not much info on it's homepage > http://pecl.php.net/package-changelog.php?package=PDO_INFORMIX and it's > not yet in cvs php-src. Although it's in the root of cvs ( > http://cvs.php.net/viewcvs.cgi/pecl/pdo_informix/ ). Keep in mind that php-src is the current version of php 6, php 5.1.x has a cvs tag associated with it (PHP_5_1). > > I'd like to add it to the stable 5.1.1, but a newer version would do for > testing. > > Any ideas, with which version of php stable will pdo_informix be included? I do know that informix was added just recently (hence not in 5.1.1). The only sugestion i could make is to contact the author of the extension. Since the extension is marked as stable, i wouldn't see any issues of it being included in 5.1.2. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables and Strings
On Wed, Dec 28, 2005 at 10:30:04PM -0500, PHP Superman wrote: > Hey everyone, is there a way to return all the variables from a string into > an array, for example > $Var1="Yo"; > $Var2="Man"; > $SQL="SELECT * FROM tblname WHERE 4=$Var1 AND WHERE 3=$Var2"; > $AllVars=MySpecialFunction($SQL); > print_r($AllVars); I'm not sure what your trying to do but well, var_dump($Var1, $Var2, $AllVars); Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Symbolic Folders and Content Translation
On Wed, Dec 28, 2005 at 09:43:19PM -0600, Dan Jallits wrote: > I want to be able to determine the browser language and > redirect to the correct web folder. However, I want this folder to be > symbolic, since I do not want multiple copies of the same information. > Then the next step would be to pass the browser language to a service > like Google Translate! The first thing to look at is the var: $_SERVER['HTTP_ACCEPT_LANGUAGE'] HTTP_ACCEPT_CHARSET, might come in handy as well pending the lanuage. I would read the specs on how these vars should be used. Second, i would take a look at the gettext extension in php http://php.net/gettext This allows you to build a language dictionary for what ever language you want to support. and you have one code base that just looks like: setlocale(LC_ALL', 'de_DE'); bindtext('myappname', '/path/to/dictionary'); textdomain('myappname'); echo _('This string will get translated if there is a german dictionary of this string'); Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysqli module in php 4
On Wed, Dec 28, 2005 at 11:58:02AM -0500, John Nichel wrote: > M. Sokolewicz wrote: > >John Nichel wrote: > > > >>M. Sokolewicz wrote: > >> > >>>Bagus Nugroho wrote: > >>> > Hi All, > > Is mysqli module enable by default on php 4 as mysql module. > >>> > >>> > >>> > >>>no > >>> > If not enable by default, where I can get this module(hopefully a > direct link to download) > >>> > >>> > >>> > >>>you can't, it *requires* PHP 5 > >> > >> > >> > >>I've been running mysqli on 4.3.x and 4.4 > >> > >according to CVS it has a dependency on PHP 5 > > > > Undocumented 'feature'. ;) Please do tell how you even got it working.. % cd php44/ext/mysqli php44/ext/mysqli: No such file or directory. % cd pecl/mysqli pecl/mysqli: No such file or directory. The only thing I can think that perhaps might be done is: % cd php5x/ext/mysqli % phpize #php4 version of phpize % ./configure --with-mysqli=/usr/local/mysql/ % make Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Symbolic Folders and Content Translation
I want to be able to determine the browser language and redirect to the correct web folder. However, I want this folder to be symbolic, since I do not want multiple copies of the same information. Then the next step would be to pass the browser language to a service like Google Translate! -- Best regards, Daniel C. Jallits 100 E. Oneida Avenue Elmhurst, Illinois 60126-4465 United States of America T: 630.279.2798 | M: 630.670.3775 Email - [EMAIL PROTECTED] Weblog - http://jallits.wordpress.com Del.icio.us - http://del.icio.us/rss/jallits Technorati - http://www.technorati.com/profile/jallits
[PHP] Variables and Strings
Hey everyone, is there a way to return all the variables from a string into an array, for example $Var1="Yo"; $Var2="Man"; $SQL="SELECT * FROM tblname WHERE 4=$Var1 AND WHERE 3=$Var2"; $AllVars=MySpecialFunction($SQL); print_r($AllVars); would ideally print an array like: { array $Var1="Yo" $Var2="Man" } i think i should use an ereg or preg replace but I don't know much about them or how to use them, thanks in advance
RE: [PHP] a quick one, self submitting jump menu
While not PHP, this is a JS question.. My Account Sign Up! function jump_page() { with ( document.JumpForm ) { if ( JumpItem.value != "" ) document.location = JumpItem.value; } } //jump_page() > -Original Message- > From: Ross [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 22, 2005 3:02 AM > To: php-general@lists.php.net > Subject: [PHP] a quick one, self submitting jump menu > > > How can I self submit a page whne registered globals are off. > Is there a way > to use $_SERVER? > > What I am ultimately trying to do is use values from a jump menu... > > > > option1 > option2 > > > > > > to self submit and use the submitted values in a if-else or > CASE statement. > This is all on the same page. > > > Ross > > -- > 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] mysqli class not found
you are not missing anything, you are actually adding to much. Using "new" is for making objects, if you take away the "new" in the $result variable declaration it should work fine. On 12/28/05, Erik Saline <[EMAIL PROTECTED]> wrote: > > > - Original Message - > From: Erik Saline > To: php-general@lists.php.net > Sent: Wednesday, December 28, 2005 1:08 PM > > > I installed Apache, PHP, and Mysql during the Fedora Core 4 installation. > > PHP 5.0.4 > MYSQL 4.1.14 > > I used php -i to show that mysql and mysqli were installed. > Configure Command => './configure' '--build=i386-redhat-linux' > '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' ' > > Here is the code. > > $result = new mysqli_connect('localhost', 'nobody', 'test', 'godisdead'); > > Here is the error. > > PHP Fatal error: Class 'mysqli' not found in > /var/www/cgi-bin/db_connect.php on line 4, > > > > What am I missing? > > > > Erik > > -- Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!
[PHP] mysqli class not found
- Original Message - From: Erik Saline To: php-general@lists.php.net Sent: Wednesday, December 28, 2005 1:08 PM I installed Apache, PHP, and Mysql during the Fedora Core 4 installation. PHP 5.0.4 MYSQL 4.1.14 I used php -i to show that mysql and mysqli were installed. Configure Command => './configure' '--build=i386-redhat-linux' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' ' Here is the code. $result = new mysqli_connect('localhost', 'nobody', 'test', 'godisdead'); Here is the error. PHP Fatal error: Class 'mysqli' not found in /var/www/cgi-bin/db_connect.php on line 4, What am I missing? Erik
Re: [PHP] operators
$xml->Result[$i] - a method call for object $xml $key=>$value - array notation Henry Krinkle wrote: I have some experience with PHP, but not with these operators: -> => Can someone explain how they are working in this snippet from Yahoo's search API foreach($xml->Result[$i] as $key=>$value) I don't see anything about them in the "Array Operators" documentation.. Thanks - Yahoo! for Good - Make a difference this year. -- life is a game... so have fun. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Earlier versions hurt PHP 5
Here is a PHP5 hosting company: http://www.a2hosting.com/ (Please try Google to find more PHP5 hosting companies.) Please don't make comments like removing older versions of PHP from the download page. We have delivered solutions to clients that run on PHP4. Those clients need the ability to conveniently download PHP4 in order to run our code. Happy New Year!!! -- Anas Mughal On 12/19/05, PHPDiscuss - PHP Newsgroups and mailing lists < [EMAIL PROTECTED]> wrote: > > > > As a developer, I would love to use PHP 5+ for applications but I am > afraid to do so because 90% of web hosting companies do not offer it. The > biggest reason that that they do not offer it is because there is little > demand for it. The reason why there is little demand for it is that > developers do not use it because webhosts do not support it. A classic > catch 22 situation! > > I think that continuing to offer prominent download links for PHP 4 > versions on the same page as download links for php 5 on the php.net and > Zend sites is a major contributor to this problem. To get PHP 5 accepted, > links to download earlier versions should be hidden away in some obsure > area. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Anas Mughal
[PHP] Re: operators
please read http://www.php.net/manual/en/language.oop.php explaining what Objects are exactly (since it's looping over an object property which just so happens to be an array) http://www.php.net/manual/en/control-structures.foreach.php explains what => is (part of foreach()) - tul Henry Krinkle wrote: I have some experience with PHP, but not with these operators: -> => Can someone explain how they are working in this snippet from Yahoo's search API foreach($xml->Result[$i] as $key=>$value) I don't see anything about them in the "Array Operators" documentation.. Thanks - Yahoo! for Good - Make a difference this year. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] operators
I have some experience with PHP, but not with these operators: -> => Can someone explain how they are working in this snippet from Yahoo's search API foreach($xml->Result[$i] as $key=>$value) I don't see anything about them in the "Array Operators" documentation.. Thanks - Yahoo! for Good - Make a difference this year.
Re: [PHP] Earlier versions hurt PHP 5
On 12/28/05, PHP Superman <[EMAIL PROTECTED]> wrote: > > I agree with Greg, if you guys don't care about new versions lets all > downgrade to Pentium 1 computers using dial up, if we don't move from PHP 4 > to PHP 5 now, then when PHP 6 comes with a truckload of new features and > changes to programming standard people who use PHP 4 will have a lot of > problems with their PHP 4 compatible code. I'm not trying to be harsh to you > guys because it's really the web hosting company's fault but we should all > upgrade to PHP 5 unless you are using PHP-Nuke or something like that. > > On 12/19/05, Greg Donald <[EMAIL PROTECTED]> wrote: > > > > On 12/19/05, PHPDiscuss - PHP Newsgroups and mailing lists > > < [EMAIL PROTECTED]> wrote: > > > As a developer, I would love to use PHP 5+ for applications but I am > > > afraid to do so because 90% of web hosting companies do not offer it. > > The > > > biggest reason that that they do not offer it is because there is > > little > > > demand for it. The reason why there is little demand for it is that > > > developers do not use it because webhosts do not support it. A classic > > > catch 22 situation! > > > > I fail to see what this has to do with a 1961 novel. Do you mean > > chicken-egg perhaps? There's nothing keeping _you_ from using one of > > those 10% who are supporting PHP5. If you aren't part of the > > solution.. > > > > > I think that continuing to offer prominent download links for PHP 4 > > > versions on the same page as download links for php 5 on the php.netand > > > Zend sites is a major contributor to this problem. > > > > Doubtful. I gotta think most people who use PHP do not install it > > themselves. Those who do install it themselves are probably smart > > enough to find the older versions no matter where you hide them on the > > site. > > > > > To get PHP 5 accepted, > > > links to download earlier versions should be hidden away in some > > obsure > > > area. > > > > PHP4 does what most people need it to do. No reason to upgrade. You > > can't really fix that since there's nothing broken. > > > > What is in PHP5 that you _need_ exactly? If it's OO then there are > > much, much better places to get your OO fix. Not to mention I have > > never once had a client ask for PHP specifically, much less PHP5. I > > use PHP 5 because I want to stay current with my skills, not because I > > need language functionality that's missing in PHP4. Same with Apache > > 2, PostgreSQL 8, and MySQL 5. > > > > > > -- > > Greg Donald > > Zend Certified Engineer > > MySQL Core Certification > > http://destiney.com/ > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now! -- Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!
Re: [PHP] ODBC question
Jeremy Schreckhise wrote: I have an Openlink Single Tier Driver on an XP pro machine with windows installed on drive f: because I have a dual boot with Red Hat. Database is Progress 8.3c on a SCO Unixware 7.1.4 Dell Server. I can connect to all progress databases and pull data utilizing a System DSN via Openlink, however when I try to connect via PHP I get the following error: Warning: odbc_connect(): SQL error: [OpenLink][ODBC]Unable to allocate server handle, SQL state S1000 in SQLConnect Any suggestions? I know the code is fine, because it works on another box with a similar set up, but with windows installed on drive c: Thanks in advance, Jeremy Schreckhise I did a search on that error + OpenLink and came up with this: http://support.openlinksw.com/support/print_opie_article.vsp?OP_ID=299 I did this once a long time ago (PHP/ODBC/Progress), but I don't see that error in my notes. The only thing I can offer is that I had trouble making sure the proper Progress environment variables ($DLC and the like) were set and accessible to PHP/Apache. If that doesn't help, try the OpenLink people. I had to place a support request with them before, and they were pretty helpful. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ODBC question
I have an Openlink Single Tier Driver on an XP pro machine with windows installed on drive f: because I have a dual boot with Red Hat. Database is Progress 8.3c on a SCO Unixware 7.1.4 Dell Server. I can connect to all progress databases and pull data utilizing a System DSN via Openlink, however when I try to connect via PHP I get the following error: Warning: odbc_connect(): SQL error: [OpenLink][ODBC]Unable to allocate server handle, SQL state S1000 in SQLConnect Any suggestions? I know the code is fine, because it works on another box with a similar set up, but with windows installed on drive c: Thanks in advance, Jeremy Schreckhise -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysqli module in php 4
John Nichel wrote: M. Sokolewicz wrote: Bagus Nugroho wrote: Hi All, Is mysqli module enable by default on php 4 as mysql module. no If not enable by default, where I can get this module(hopefully a direct link to download) you can't, it *requires* PHP 5 I've been running mysqli on 4.3.x and 4.4 according to CVS it has a dependency on PHP 5 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysqli module in php 4
M. Sokolewicz wrote: John Nichel wrote: M. Sokolewicz wrote: Bagus Nugroho wrote: Hi All, Is mysqli module enable by default on php 4 as mysql module. no If not enable by default, where I can get this module(hopefully a direct link to download) you can't, it *requires* PHP 5 I've been running mysqli on 4.3.x and 4.4 according to CVS it has a dependency on PHP 5 Undocumented 'feature'. ;) Seriously though, I had no problem getting 4.x to compile with mysqli. Where I did run into trouble was getting both mysql and mysqli running together, happily. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location ....
[snip] Ok but there is something more strange. I use "header location" in a switch/case. An header location by case. I don't understand at the end of the case, the header location don't work and I go through the others cases. Any idea why ? [/snip] Not without seeing code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location ....
> From: Jay Blanchard [mailto:[EMAIL PROTECTED] > Header is a good solution, and is the only one available in PHP for > redirects. It requires that you do not send anything else out to the > browsers before sending the redirect, which is what is causing your error. > You can always use the output buffer functions to assist with that. Ok but there is something more strange. I use "header location" in a switch/case. An header location by case. I don't understand at the end of the case, the header location don't work and I go through the others cases. Any idea why ? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pdo_informix
Hi, How do I install pdo_informix? There's not much info on it's homepage http://pecl.php.net/package-changelog.php?package=PDO_INFORMIX and it's not yet in cvs php-src. Although it's in the root of cvs ( http://cvs.php.net/viewcvs.cgi/pecl/pdo_informix/ ). I'd like to add it to the stable 5.1.1, but a newer version would do for testing. Any ideas, with which version of php stable will pdo_informix be included? Any other pdo informix related information appreciated. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Location ....
Christian Ista wrote: > Hello, > > Could you tell me a efficient solution for change page (new location) in > PHP? I tried this code : header("Location: mypage.php"); > note: HTTP/1.1 requires an absolute URI http://php.net/header > But in some case, I have error message "heade already send". Then I use a > javascript solution : window.location.href="mypage.php"; > > Is there a good solution in php ? > Check out 'headers_sent', you can choose how to redirect ('header' or JavaScript) depending on whether you have sent the headers or not. http://php.net/headers_sent HTH, cheers Silvio -- tradeOver | http://www.tradeover.net ...ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Location ....
[snip] Could you tell me a efficient solution for change page (new location) in PHP? I tried this code : header("Location: mypage.php"); But in some case, I have error message "heade already send". Then I use a javascript solution : window.location.href="mypage.php"; Is there a good solution in php ? [/snip] Header is a good solution, and is the only one available in PHP for redirects. It requires that you do not send anything else out to the browsers before sending the redirect, which is what is causing your error. You can always use the output buffer functions to assist with that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Location ....
Hello, Could you tell me a efficient solution for change page (new location) in PHP? I tried this code : header("Location: mypage.php"); But in some case, I have error message "heade already send". Then I use a javascript solution : window.location.href="mypage.php"; Is there a good solution in php ? Thanks, C. ___ Christian Ista http://www.cista.be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysqli module in php 4
M. Sokolewicz wrote: Bagus Nugroho wrote: Hi All, Is mysqli module enable by default on php 4 as mysql module. no If not enable by default, where I can get this module(hopefully a direct link to download) you can't, it *requires* PHP 5 I've been running mysqli on 4.3.x and 4.4 -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] download not working
> Ross wrote: >> $query= "SELECT * FROM publications WHERE alphabet='a'"; >> >> $result= mysql_query($query); >>while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ >> >> $row['pdf_size'] = $row['pdf_size']/ 1024; >> $row['pdf_size']= number_format($row['pdf_size'], 0); >> $size= $row['pdf_size']; >> $name = str_replace("_", " ", $row['pdf_name']); >> $name = str_replace(".pdf", "", $name); >> $link= $row['content']; >> >> echo "$name"; >> echo " "; >> echo "($size kb)"; >> //ross >> ?> >> download is here.. >> link You need to make sure that the code above doesn't output anything when isset($_GET['id']). >> > >> if(isset($_GET['id'])) >> { >> echo "id is this"; You should not have any output before you send your headers and file content. >> $id= $_GET['id']; >> $query = "SELECT * FROM publications WHERE id = '$id'"; >> >> $result = mysql_query($query) or die('Error, query failed'); >> >> $pdf_size=$row['pdf_size']; >> $pdf_type=$row['pdf_type']; >> $pdf_name=$row['pdf_name']; Where does $row come from? >> ob_clean(); >> header("Content-length: $pdf_size"); >> header("Content-type: $pdf_type"); >> header("Content-Disposition: attachment; filename=$pdf_name"); >> echo $content; Where does $content come from? -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.8/215 - Release Date: 2005/12/27 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] download not working
Ross wrote: > The pdf is fine, there are no errors . All I get is a small (130byte) pdf > file which is corrupt when I try and open it. >From the code I gather you are saving the uploaded file in the database. 1 - What field type are you using for this? 2 - Are you using some form of encoding (eg base64_encode()) before writing it database and decoding when reading it from the database? 3 - Why not save the file to disk with a reference to the correct filename in the database? It will most probably solve your issue. I have tried this saving the file into the database before and could only get it to work reliably by: - base64_encode() on the content of the file - keeping the files below 100kbyte (It was way back with MySQL 3.x and it seemed that MySQL couldn’t save such large amounts of data in a blob or text field I ended up uploading it to disk into a directory not accessible to someone from the outside but accessible by the user Apache was running as. Then by reading the content from the file with PHP and outputting in a similar method as you are using. Hope it helps Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.8/215 - Release Date: 2005/12/27 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDO & pdo_odbc
Hi, I'm using the following code in a PHP 5.1, Windows CLI environment: $p = new PDO('odbc:driver={Microsoft Access Driver (*.mdb)};Dbq=beispieldatenbank.mdb'); $s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)'); $s->execute(array('test1', 'test2')); I'm always getting the last value of the array passed to execute in all the fields which have markers in the prepare statement, like I would have written: INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES('test2', 'test2') I also tried bindValue like this $s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)'); $s->bindValue(1, 'test1'); $s->bindValue(2, 'test2'); $s->execute(); or name values: $s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(:a, :b)'); $s->bindValue(':a', 'test1'); $s->bindValue(':b', 'test2'); $s->execute(); but which all resulted in a row being inserted but the values were just empty. When I tried something like this: $s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)'); $val1 = 'test1'; $val2 = 'test2'; $s->bindParam(1, $val1); $s->bindParam(2, $val2); $s->execute(); I even get a crash. Am I doing something conceptual wrong? thanks for any pointers, - Markus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] download not working
The pdf is fine, there are no errors . All I get is a small (130byte) pdf file which is corrupt when I try and open it. Thanks, R. "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > are people supposed to smell what is not working? > do you get any errors? is it possible the PDF was corrupt > when you uploaded it? > > Ross wrote: >> working form this example >> >> http://www.php-mysql-tutorial.com/php-mysql-upload.php >> >> >> my code is as follows, all I get is a corrupt pdf file. >> >> $query= "SELECT * FROM publications WHERE alphabet='a'"; >> >> $result= mysql_query($query); >>while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ >> >> $row['pdf_size'] = $row['pdf_size']/ 1024; >> $row['pdf_size']= number_format($row['pdf_size'], 0); >> $size= $row['pdf_size']; >> $name = str_replace("_", " ", $row['pdf_name']); >> $name = str_replace(".pdf", "", $name); >> $link= $row['content']; >> >> echo "$name"; >> echo " "; >> echo "($size kb)"; >> //ross >> ?> >> download is here.. >> link >> > >> if(isset($_GET['id'])) >> { >> echo "id is this"; >> $id= $_GET['id']; >> $query = "SELECT * FROM publications WHERE id = '$id'"; >> >> $result = mysql_query($query) or die('Error, query failed'); >> >> $pdf_size=$row['pdf_size']; >> $pdf_type=$row['pdf_type']; >> $pdf_name=$row['pdf_name']; >> ob_clean(); >> header("Content-length: $pdf_size"); >> header("Content-type: $pdf_type"); >> header("Content-Disposition: attachment; filename=$pdf_name"); >> echo $content; >> >> >> exit; >> } >> } >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] download not working
are people supposed to smell what is not working? do you get any errors? is it possible the PDF was corrupt when you uploaded it? Ross wrote: working form this example http://www.php-mysql-tutorial.com/php-mysql-upload.php my code is as follows, all I get is a corrupt pdf file. $query= "SELECT * FROM publications WHERE alphabet='a'"; $result= mysql_query($query); while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ $row['pdf_size'] = $row['pdf_size']/ 1024; $row['pdf_size']= number_format($row['pdf_size'], 0); $size= $row['pdf_size']; $name = str_replace("_", " ", $row['pdf_name']); $name = str_replace(".pdf", "", $name); $link= $row['content']; echo "$name"; echo " "; echo "($size kb)"; //ross ?> download is here.. link -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] download not working
working form this example http://www.php-mysql-tutorial.com/php-mysql-upload.php my code is as follows, all I get is a corrupt pdf file. $query= "SELECT * FROM publications WHERE alphabet='a'"; $result= mysql_query($query); while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ $row['pdf_size'] = $row['pdf_size']/ 1024; $row['pdf_size']= number_format($row['pdf_size'], 0); $size= $row['pdf_size']; $name = str_replace("_", " ", $row['pdf_name']); $name = str_replace(".pdf", "", $name); $link= $row['content']; echo "$name"; echo " "; echo "($size kb)"; //ross ?> download is here.. link http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT?
Hi, As there are only 500 rows, there is not any harm in fetching all records through one query and then do the update between while loop $query="select * from table"; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { $newquery="update YOUR STATEMENT where uniquefield like $row['uniquefield']"; mysql_query($newquery); } if you really need to fetch only one record at a time, you can use the LIMIT keyword in your SQL statement, and can create the script as needed. Zareef Ahmed - Original Message - From: "Christian Ista" <[EMAIL PROTECTED]> To: "'William Stokes'" <[EMAIL PROTECTED]>; Sent: Wednesday, December 28, 2005 3:57 AM Subject: RE: [PHP] SELECT? > > From: William Stokes [mailto:[EMAIL PROTECTED] > > I have one MySQL table with about 500 rows. I need to read the table one > > row at a time, make some changes to data in one field and then store the > > changed data to another table. > > 1. May be add a column, CHANGED_FL with default value N. > 2. Select to find the ID minimum with a select CHANGED_FL is N > 3. Select the row with the ID found above and make you business > 4. Make change and change CHANGED_FL to Y > > Repeat operation 2 to 4 > > C. > PHP Expert Consultancy in Development http://www.indiaphp.com Yahoo! : consultant_php MSN : [EMAIL PROTECTED] > -- > 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] list a query
Ross wrote: What does 'list' do in a php query? there is no such thing a php query (unless you count asking a pph related question). list() is a language construct an explanation of it can be found in the manual http://php.net/list please always read/search the manual before asking question. $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); found it in this example... http://www.php-mysql-tutorial.com/php-mysql-upload.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] list a query
What does 'list' do in a php query? $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); found it in this example... http://www.php-mysql-tutorial.com/php-mysql-upload.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT?
On 12/28/05, William Stokes <[EMAIL PROTECTED]> wrote: > I have one MySQL table with about 500 rows. I need to read the table one row > at a > time, make some changes to data in one field and then store the changed data > to another table. > > I'm using PHP to change the data but I have no idea how to select one row at > a time from the DB table. There's one auto-increment id field in the table > but the id's doesn't start from 1 and are not sequential. > > Any ideas or help is much appreciated! Can you not just fetch all the data at once like so: $result = mysql_query("SELECT * FROM mytable"); then iterate over the results: while ( $row = mysql_fetch_assoc($result) ) { mysql_query("INSERT INTO othertable (column1) VALUES (" . $row['column_x'] . "); } The only thing you'd have to be careful with is the maximum execution time settings if you're running this script over the web, as opposed to on the command line. If you're only making changes to 500 rows though it shouldn't take too long - I've restored thousands of rows to a database before and that took less than a second. Paul -- Data Circle http://datacircle.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xmlspecialchars
Richard Lynch wrote: I'm creating some XML data, but not using any of the built-in PHP XML functions, as they are not necessarily available on all servers. I need to encode Data (CDATA) such as URLs etc. htmlspecialchars() works on all my test cases so far, but is it "right"?... I don't think so - not completely - actually this is shaky ground for me but one I'm very interested in (encoding/charsets/etc). I'm pretty sure you can do this for example: now I don't think that an XML parser will care if the href attribute's value is encoded properly (e.g. the '&' given as '&') because the whole CDATA block is just a string (UTF8 is the default everywhere I have played with XML, so beware that if you don't specify your character encoding that ti might cause hiccups). so in the case above wether you entity encoding the url or not is pureluy a matter of how valid do you want the HTML that one can extract from the CDATA block inside the tag. the following urls might throw some light on the issue for you: http://xmlrpc-epi.sourceforge.net/main.php?t=samples http://blogs.law.harvard.edu/tech/encodingDescriptions Please cc: me on replies -- I'm way behind on PHP General reading... :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli module in php 4
On 12/28/05, Bagus Nugroho <[EMAIL PROTECTED]> wrote: > Is mysqli module enable by default on php 4 as mysql module. No, because it's a PHP5 module (if you look at the documentation for it, all the php.ini settings for it have only been available since 5.0.0). > If not enable by default, where I can get this module(hopefully a direct > link to download) I've heard rumours of people getting it installed/running under PHP 4, but I'm not sure if you really can or not. There is no direct download, the installation section of the mysqli extension page tells you how to get it to work: http://www.php.net/mysqli Paul -- Data Circle http://datacircle.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysqli module in php 4
Bagus Nugroho wrote: Hi All, Is mysqli module enable by default on php 4 as mysql module. no If not enable by default, where I can get this module(hopefully a direct link to download) you can't, it *requires* PHP 5 Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT?
William Stokes wrote: I have one MySQL table with about 500 rows. I need to read the table one row at a time, make some changes to data in one field and then store the changed data to another table. I'm using PHP to change the data but I have no idea how to select one row at a time from the DB table. A couple of possible options, depending on your specific situation: 1. Use INSERT...SELECT syntax. If you're doing a regular transformation on all selected rows that can be handled by MySQL function(s), this would be easiest and fastest. e.g. (table_b.id is an auto-incremented primary key): INSERT INTO table_b (id, table_a_id, transformed_value) SELECT NULL, id, SOME_FUNCTION(mycolumn) FROM table_a 2. Depending on the size of the records, you might want to just read all 500 rows into a two-dimensional array and use an array fn such as array_walk to apply a function to change the relevant data and insert into your new table. To get all rows into an array, you set an array variable and iterate over the MySQL result set to build the members of the array. If you need details on how to do *that*, you'll need to indicate which version of PHP you're using and whether you're using an abstraction layer for database access. For an example in PHP 4, you might have: $db_cursor = mysql_query("SELECT * FROM my_table", $db); //check for errors [omitted] //count the records $recordcount = mysql_num_rows($db_cursor); //assemble the recordset array $recordset = array(); for($i=0;$i<$recordcount; $i++) { $recordset[] = mysql_fetch_assoc($db_cursor); } //clean up, etc. [omitted] Then use array_walk() or similar... HTH -- Max Schwanekamp http://www.neptunewebworks.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SELECT?
> From: William Stokes [mailto:[EMAIL PROTECTED] > I have one MySQL table with about 500 rows. I need to read the table one > row at a time, make some changes to data in one field and then store the > changed data to another table. 1. May be add a column, CHANGED_FL with default value N. 2. Select to find the ID minimum with a select CHANGED_FL is N 3. Select the row with the ID found above and make you business 4. Make change and change CHANGED_FL to Y Repeat operation 2 to 4 C. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SELECT?
Hello, I have one MySQL table with about 500 rows. I need to read the table one row at a time, make some changes to data in one field and then store the changed data to another table. I'm using PHP to change the data but I have no idea how to select one row at a time from the DB table. There's one auto-increment id field in the table but the id's doesn't start from 1 and are not sequential. Any ideas or help is much appreciated! Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Frameworks
Script Head wrote: Nobody has mentioned Fusebox (www.fusebox.org). I have been using it to develop PHP applications for about 2 years. It has proven to be extremely flexible when a large number of developers collaborate on one project. jedit :) Love macros and plugins! http://www.jedit.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php