Re: [PHP-DB] Storing Image Location in MySQL

2009-02-23 Thread Joao Gomes Madeira
Sashi, pls read the following chapter

http://www.php.net/manual/en/book.image.php

Cheers
JP

-Original Message-
From: Sashikanth Gurram sashi...@vt.edu
To: Joao Gomes Madeira jpcg@gmail.com
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Storing Image Location in MySQL
Date: Sun, 22 Feb 2009 22:56:55 -0500

Hi JP,

Can you please let me know what is a GD? I have not installed Apache 
separately. I am using the WAMP server currently. Do I have to install 
any additional stuff  before I can retrieve the image location from the 
db and display it in my browser?

-Sashi

Joao Gomes Madeira wrote:
 Hey Sashi

 You want something similar to this:
 (you must have GD installed on Apache)

 you can have this working by doing something like this in HTML:

 img src=picture.php?qry=123

 and having as picture.php:

 ?php
 ... get the record from the database using query string and then ...

 $err=1;
 if ($img = file_get_contents('/yourpath/yourfile.jpg', FILE_BINARY)) {
   if ($img = imagecreatefromstring($img)) $err = 0;
 }}
 if ($err) {
   header('Content-Type: text/html');
   echo 'htmlbodyp style=font-size:9pxError getting
 image.../p/body/html'; 
 } else {
   header('Content-Type: image/jpeg');
   imagejpeg($img);
   imagedestroy($img);
 }
 ...

 Cheers
 JP


 -Original Message-
 From: Sashikanth Gurram sashi...@vt.edu
 To: php-db@lists.php.net
 Subject: [PHP-DB] Storing Image Location in MySQL
 Date: Sun, 22 Feb 2009 03:43:06 -0500

 Dear All,

 I am trying to store the location of a image into MySQL database, so 
 that I can call it back from PHP to display it in a browser. For this 
 purpose, I have created a table with two columns (BuildingCode, 
 Location), where building is the primary key and location is the 
 location where my picture is stored on my PC. My image is stored at  
 /C:\Users\Sashikanth\Desktop\burruss.jpg/ on my PC.
 The following table is an output from MySQL.
 +--+-+
 | BuildingCode   | Location|
 +--+-+
 | 176 | c:/users/sashikanth/desktop/burruss.jpg   |
 +--+-+

 Considering my original Image Location on my PC, will the above table be 
 of any help if I try to retrieve the image using PHP? Is there any 
 mistake in what I have done till now?
 I know that this may be a very basic question and i have searched 
 through the internet quite extensively but could not find a solid 
 answer. Would appreciate it greatly if anyone can help.

 Thanks,
 Sashi

   




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PDO buffered query problem

2009-02-23 Thread Stewart Duncan

Hi there,

I'm having some serious problems with the PHP Data Object functions. I'm 
trying to loop through a sizeable result set (~60k rows, ~1gig) using a 
buffered query to avoid fetching the whole set.


No matter what I do, the script just hangs on the PDO::query() - it 
seems the query is running unbuffered (why else would the change in 
result set size 'fix' the issue?). Here is my code to reproduce the problem:


?php
$Database = new PDO(
'mysql:host=localhost;port=3306;dbname=mydatabase',
'root',
'',
array(
PDO::ATTR_ERRMODE = PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY = true
)
);

$rQuery = $Database-query('SELECT id FROM mytable');

// This is never reached because the result set is too large
echo 'Made it through.';

foreach($rQuery as $aRow) {
print_r($aRow);
}
?

If I limit the query with some reasonable number, it works fine:

$rQuery = $Database-query('SELECT id FROM mytable LIMIT 10');

I have tried playing with PDO::MYSQL_ATTR_MAX_BUFFER_SIZE and using the 
PDO::prepare() and PDO::execute() as well (though there are no 
parameters in the above query), both to no avail.


Any help would be appreciated,

Stewart

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Not Valid URL

2009-02-23 Thread Kamil Walas

Hi,

I stuck with something like this. I have two file test.html with  only 
'a href=../index.phpaaa/a' and main.php with

'?php
  
   echo file_get_contents('test.html').'br';

   echo 'a href=../index.phpaaa/a';

?'
The problem is tak this two links are different.
First is http://localhost/game/php/%5C%22../index.php%5C%22
Second is http://localhost/game/index.php

Paste from FireFox:
aaa http://localhost/game/php/%5C%22../index.php%5C%22
aaa http://localhost/game/index.php

I copy file to remote serwer at work and school and both are the same. 
Problem is somewhere in my computer. I think in my php configuration, 
but I don't know where to look.

Would appreciate it greatly if anyone can help.

Regards,
Kamil Walas


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Not Valid URL

2009-02-23 Thread Niel Archer
 Hi,
 
 I stuck with something like this. I have two file test.html with  only 
 'a href=../index.phpaaa/a' and main.php with
 '?php

 echo file_get_contents('test.html').'br';
 echo 'a href=../index.phpaaa/a';
 
 ?'
 The problem is tak this two links are different.
 First is http://localhost/game/php/%5C%22../index.php%5C%22
 Second is http://localhost/game/index.php
 
 Paste from FireFox:
 aaa http://localhost/game/php/%5C%22../index.php%5C%22
 aaa http://localhost/game/index.php
 
 I copy file to remote serwer at work and school and both are the same. 
 Problem is somewhere in my computer. I think in my php configuration, 
 but I don't know where to look.
 Would appreciate it greatly if anyone can help.
 
 Regards,
 Kamil Walas

Check the file containing the first link again.   '%5c%22' is the
characters '\'.  Seems you have escaped the double quotes in a single
quoted string


 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

--
Niel Archer



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: [PHP] PDO buffered query problem

2009-02-23 Thread Chris

Stewart Duncan wrote:

Hi there,

I'm having some serious problems with the PHP Data Object functions. I'm 
trying to loop through a sizeable result set (~60k rows, ~1gig) using a 
buffered query to avoid fetching the whole set.


No matter what I do, the script just hangs on the PDO::query() - it 
seems the query is running unbuffered (why else would the change in 
result set size 'fix' the issue?). Here is my code to reproduce the 
problem:


?php
$Database = new PDO(
'mysql:host=localhost;port=3306;dbname=mydatabase',
'root',
'',
array(
PDO::ATTR_ERRMODE = PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY = true
)
);


Don't you want it the other way around? You want it unbuffered so it 
doesn't get retrieved in mysql, send the whole result set to php then 
you can use it.


You want to start using it immediately - so make it unbuffered.

--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Not Valid URL

2009-02-23 Thread Kamil Walas
Yes, it is \. But in my file i have only  a 
href=../index.phpaaa/a. There is no '. I figured out that:

echo stripslashes( file_get_contents('test.html') );
works for the link but it didn't work when I try to print entire website.

So I'm stuck, again.

Regards,
Kamil Walas


Niel Archer pisze:

Hi,

I stuck with something like this. I have two file test.html with  only 
'a href=../index.phpaaa/a' and main.php with

'?php
   
echo file_get_contents('test.html').'br';

echo 'a href=../index.phpaaa/a';

?'
The problem is tak this two links are different.
First is http://localhost/game/php/%5C%22../index.php%5C%22
Second is http://localhost/game/index.php

Paste from FireFox:
aaa http://localhost/game/php/%5C%22../index.php%5C%22
aaa http://localhost/game/index.php

I copy file to remote serwer at work and school and both are the same. 
Problem is somewhere in my computer. I think in my php configuration, 
but I don't know where to look.

Would appreciate it greatly if anyone can help.

Regards,
Kamil Walas



Check the file containing the first link again.   '%5c%22' is the
characters '\'.  Seems you have escaped the double quotes in a single
quoted string


  

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Niel Archer



  



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php