Re: [PHP] math in PHP
?php $var = 1+1+1+1; eval(echo $var;); // return 4 // OR eval(\$res = $var;); echo $res; // return 4 also ... ? -Hatem - Original Message - From: Whitehawk Stormchaser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, September 18, 2004 11:15 PM Subject: [PHP] math in PHP Hi! I have been trying to make some sort of calculator in PHP, but I have stumbled on a problem... I have been make some kind of dynamical calculator, unlike most I have seen, that had $value1 [math operator] $value2 strict, but a calculator, that can calculate basically anything ( even something like (5*(8-3)+2*(4-1))^3 ), and can be put in as string variable... I have tried things like this: $var = 1+1+1+1; echo $var + 0; //returns 1 or $var = 1+1+1+1; echo eval(\$var;); //returns blank or $var = 1+1+1+1; echo (int) $var; //returns 1 things like that... Now my question is: is it possible to calculate the value of the string somehow? Thanks. Stormy. -- 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
[PHP] PHP.net broken
Greetings, it's from PHP.net : Parse error: parse error, expecting `')'' in /local/Web/sites/phpweb/include/layout.inc on line 29 Fatal error: Call to undefined function: make_image() in /local/Web/sites/phpweb/index.php on line 117 Regards, Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: PHP forever ;)
Hey all, just to inform u that the choice for baccalaureat 2003 website in tunisia was PHP and redhat (www.bac.tn) http://193.95.69.17/ the 1st year it was using oracle, windows, then windows 2000 in load balancing and now redhat linux !! this is what i call the good choice ;) Cheers, Hatem
[PHP] one corrupted image and imagecreatefromjpeg
Hey all, I have one corrupted image in a list of thoughsand of images, and the program stop with this message Corrupt JPEG data: bad huffman code Any idea to ignore this image and continue ? i cannot detect which image is corrupted and imagecreatefromjpeg return true thank you, Hatem
[PHP] Vars inside an sql query [Regular expression question]
Greetings all, I got a headache doing this, i need to get vars inside an sql query. For example : $query = select * FROM `table` where id='$value' order by name; preg_match_all(/^('\$(.*)')/si, $query,$matches); any help plz ? Thanks, Hatem
Re: [PHP] Re: Vars inside an sql query [Regular expression question]
Oh, ok this is how i want to do it exactly : query.php ?php $query = select * FROM `table` where id='$value' order by name; ? parse.php ?php $fcontents = join('' , file('query.php')); preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); print_r($matches) ? Thanks Chris Hayes [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] At 13:54 12-6-03, you wrote: I got a headache doing this, i need to get vars inside an sql query. For example : $query = select * FROM `table` where id='$value' order by name; preg_match_all(/^('\$(.*)')/si, $query,$matches); That doesn't work as the new string already is like select * FROM `table` where id='2' order by name assuming $value was 2... True, so try using $query = select * FROM `table` where id='__VALUE__' order by name; if you insist on doing it this way. If you decide to keep trying with the $value, you need to know that variables inside double quotes are entered on the spot, while not so with 'single quotes'. Also it is nice to know that the $ has a special position in preg_matching, i kept this mail from a post from december in this list: such as $, you must escape it twice. For example: $matchme = \$example; if (preg_match(/\$example/, $matchme)) { will not be matched because PHP interprets the \$ and passes it as $. Instead, you must do this: if (preg_match(/\\\$example/, $matchme)) { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Vars inside an sql query [Regular expression question]
Sorry this is more correct : -- starting query.php select * FROM `table` where id='$value' order by name -- ending query.php Hatem Ben [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Oh, ok this is how i want to do it exactly : query.php ?php $query = select * FROM `table` where id='$value' order by name; ? parse.php ?php $fcontents = join('' , file('query.php')); preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); print_r($matches) ? Thanks Chris Hayes [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] At 13:54 12-6-03, you wrote: I got a headache doing this, i need to get vars inside an sql query. For example : $query = select * FROM `table` where id='$value' order by name; preg_match_all(/^('\$(.*)')/si, $query,$matches); That doesn't work as the new string already is like select * FROM `table` where id='2' order by name assuming $value was 2... True, so try using $query = select * FROM `table` where id='__VALUE__' order by name; if you insist on doing it this way. If you decide to keep trying with the $value, you need to know that variables inside double quotes are entered on the spot, while not so with 'single quotes'. Also it is nice to know that the $ has a special position in preg_matching, i kept this mail from a post from december in this list: such as $, you must escape it twice. For example: $matchme = \$example; if (preg_match(/\$example/, $matchme)) { will not be matched because PHP interprets the \$ and passes it as $. Instead, you must do this: if (preg_match(/\\\$example/, $matchme)) { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Vars inside an sql query [Regular expression question]
I agree with you Jay, but those cases are already done, and i got no problem with RE there Thanks anyway Hatem - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Monu Ogbe [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 3:17 PM Subject: RE: [PHP] Re: Vars inside an sql query [Regular expression question] [snip] $string = select * FROM `table` where id='$value' order by name; [/snip] I know it ain't pretty, but the coding style we have accepted is this $string = select * FROM `table` where id = ' . $value . ' order by name ; or (we requite caps on reserved words)... $string = SELECT * ; $string .= FROM `table` ; $string .= WHERE id = ' . $value . ' ; $string .= ORDER BY name ; No ambiguity and cleaner on longer queries. It's all in preference I suppose. Jay -- 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
[PHP] Vars inside an sql query [Regular expression question] - Again
I'm asking again the same question, coz i guess my question wasn't clear. i just need to retreive vars inside query.txt, my regular expression seems to be correct for me, but i don't find why it doesn't wrk -- Starting query.txt select * FROM `table` where id='$value' order by name -- Ending query.txt -- Starting parse.php ?php $fcontents = join('' , file('query.txt')); preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); print_r($matches) ? - Ending parse.php rewriting query is another question, that i agree also. Thanks Hatem
Re: [PHP] Vars inside an sql query [Regular expression question] - Again
It's not working also - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Hatem Ben [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 5:23 PM Subject: Re: [PHP] Vars inside an sql query [Regular expression question] - Again preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); ^^ you don't allow any character between start of the string and single quote. preg_match_all(/^.*('\$(.*)')/si, $fcontents,$matches); Hatem Ben wrote: I'm asking again the same question, coz i guess my question wasn't clear. i just need to retreive vars inside query.txt, my regular expression seems to be correct for me, but i don't find why it doesn't wrk -- Starting query.txt select * FROM `table` where id='$value' order by name -- Ending query.txt -- Starting parse.php ?php $fcontents = join('' , file('query.txt')); preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); print_r($matches) ? - Ending parse.php rewriting query is another question, that i agree also. Thanks Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Vars inside an sql query [Regular expression question] - Again
Well, it's finally working, but still very confusing ... thanks all ?php $fcontents = join('' , file('query.txt')); preg_match_all('/(\'\$(.*)\')/si', $fcontents,$matches); print_r($matches) ? Regards, Hatem - Original Message - From: Hatem Ben [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Marek Kilimajer [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 4:35 PM Subject: Re: [PHP] Vars inside an sql query [Regular expression question] - Again It's not working also - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Hatem Ben [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 12, 2003 5:23 PM Subject: Re: [PHP] Vars inside an sql query [Regular expression question] - Again preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); ^^ you don't allow any character between start of the string and single quote. preg_match_all(/^.*('\$(.*)')/si, $fcontents,$matches); Hatem Ben wrote: I'm asking again the same question, coz i guess my question wasn't clear. i just need to retreive vars inside query.txt, my regular expression seems to be correct for me, but i don't find why it doesn't wrk -- Starting query.txt select * FROM `table` where id='$value' order by name -- Ending query.txt -- Starting parse.php ?php $fcontents = join('' , file('query.txt')); preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); print_r($matches) ? - Ending parse.php rewriting query is another question, that i agree also. Thanks Hatem -- 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] Humour in programming?
hehe and the good news, ppl don't have to upgrade to the latest PHP 2.0.2 ... coz the php 2.0.1 don't seems to be seriously buggy ;-) Cheers, Hatem - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 10:40 PM Subject: RE: [PHP] Humour in programming? Yeah, same thing happened to me last year. I was freaking out, thought my box had been hacked. Then it hit me...April Fools day... -Original Message- From: Aaron Gould [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 3:37 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Humour in programming? Hehe, I though something was wrong with my machine when I checked out phpinfo() on one of my boxes today. It didn't even occur to me that it might be related to April Fools. I know it's usually the PHP logo, but how is that picture generated anyway? -- Aaron Gould Web Developer Parts Canada - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 3:32 PM Subject: RE: [PHP] Humour in programming? Yeah...check out the phpinfo() function on your machine ? phpinfo(); ? -Original Message- From: Liam Gibbs [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 3:36 PM To: php list Subject: [PHP] Humour in programming? Sorry if this is OT, but... heheheh... has anyone taken a look at the PHP site? Check out the upper-left corner. Who is that? Nice to know the guys at PHP can have a laugh. -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] where is cookie limitation on php ?
Greetings all, Can someone tell me where is the limitation on the number/size of cookies that could be used ? Assuming we have : ?php $table = array(a,b,c,d); $table = array_pad($table, 20,e); while (list($key, $value) = each ($table)) { setcookie( DX_A[$key], $value ); } setcookie( DX_B, test 1 ); setcookie( DX_C, test 2 ); setcookie( DX_D, test 3 ); setcookie( DX_E, test 4 ); print_r($_COOKIE); ? This is what php return : Array ( [DX_A] = Array ( [4] = e [5] = e [6] = e [7] = e [8] = e [9] = e [10] = e [11] = e [12] = e [13] = e [14] = e [15] = e [16] = e [17] = e [18] = e [19] = e ) [DX_B] = test 1 [DX_C] = test 2 [DX_D] = test 3 [DX_E] = test 4 ) The first values are truncated ! Thanks, Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MIME Decoding Class
http://sourceforge.net/projects/phpmimeclass Jonathan Chum [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I'm looking through Google for MIME decoding classes, one developed by Richard Heyes used in Pear and a few others. What I'm curious is how complete are these classes or if there is one you recommend that completely decodes emails from Outlook, Hotmail, Eudora, etc. based emails. I've looked at solutions written in C and they are about 800 KB source code in size compared to classes written in apps like Squirrel Mail which is 90KB. Does anyone know of any complete decoding classes in PHP either free or commercial. Command line are also fine. If there are C, C++, or C# libraries, those are okay as well if you know of any. I just couldn't come across any that are well coded to perform the task of complete MIME decoding. -- 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
[PHP] create executable from php script
heya all, I remember that some developers started a project to create stand-alone application from php script, can someone guide me to find it again ? I haven't found any url talking about it. Regards, Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create executable from php script
nop, not the php-gtk , but something that can create binary executable code from any php script. Do you mean gtk.php.net? Hatem Ben wrote: heya all, I remember that some developers started a project to create stand-alone application from php script, can someone guide me to find it again ? I haven't found any url talking about it. Regards, Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create executable from php script
I know it also, still related with php-gtk. Thanks anyway Hatem - Original Message - From: Chris Shiflett [EMAIL PROTECTED] To: Hatem Ben [EMAIL PROTECTED]; Marek Kilimajer [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, January 22, 2003 4:42 PM Subject: Re: [PHP] create executable from php script --- Hatem Ben [EMAIL PROTECTED] wrote: something that can create binary executable code from any php script. See if this can fulfill your needs: http://pear.php.net/package-info.php?pacid=95 Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class inside class
Assuming you have class WebPage { var $property1; function get_property1() { return $this-$property1; } } class Sample extends WebPage{ } To access $property1 from your WebPage class just do $page = new Sample; $prop1 = $page-get_property1(); Otherwise try to send a snippets of code to see exactly what's you'r doing :) Regards, Hatem - Original Message - From: Michael Hall [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 13, 2003 7:19 AM Subject: [PHP] class inside class -- G'day: I am using a 'wrapper' class to create all the boilerplate HTML on a website, plus do stuff like authentication and print menus etc according to properties set dynamically within the class. The actual content of each page is generated by seperate 'content' classes. These classes are 'embedded' within and instantiated within the wrapper class, but are otherwise independent of it. This system allows for something approaching a PHP object publishing application, which is where I'm heading. My problem is that now I need to get at the values of some wrapper class properties from within a content class: in other words, I need to access the dynamically assigned values of the properties of one class, from inside another class (which is embedded within the first, though I'm not sure that really matters). I can't use the $this- mechanism because the value is inside a different class. I can't use the first class's handle (eg $page , from $page = new WebPage()) because the embedded class doesn't know about it. I have been playing around with declaring globals, and with PHP's class/object functions, but have got nowhere yet. Is this possible, and if so, does anyone have any pointers? Hope my description of the problem makes sense. TIA Mick MICHAEL HALL Web Development Officer Batchelor Institute of Indigenous Tertiary Education W: [EMAIL PROTECTED](08) 8951 8352 H: [EMAIL PROTECTED](08) 8953 1442 -- 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
[PHP] highlight keywords issue
Heya all, I'm trying to highlight search keywords in a string, everything work expect when this keyword is inside a tag like this : keyword (php) : a href=?go=phpphp/a img src=php.gif border=0 alt=php.net will be highlighted to : a href=?go=b style=color: black; background-color: #66php/bb style=color: black; background-color: #66php/b/a img src=b style=color: black; background-color: #66php/b.gif border=0 alt=b style=color: black; background-color: #66php/b.net I have tryed to separate text from html, then highlight it then join html/text again, but this will be very long and not really usefull ! I'm using preg_replace : preg_replace('|\b('.quotemeta($keyword).')\b|iU', 'b style=color: black; background-color: #66\\1/b', $content); Any help to fix that ? Thanks; Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] highlight keywords issue
I have find this code very helpfull : - Original Message - From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] To: 'Hatem Ben' [EMAIL PROTECTED]; 'PHP List' [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 2:28 PM Subject: RE: [PHP] highlight keywords issue You will need to break apart the entire document then process each area inside of the tags and to be very careful for nested tags. The simplest way around I have found to do with is to add to tags that have been processed with attributes that are ignored by the browser renderer eg... a href=/page.html done=yesPHP/a as you can see the a href has been processed because I have added in a extra attribute then continue to process the entire page from my preg matches. Nested tags are going to be your biggest issue. Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: Hatem Ben [mailto:[EMAIL PROTECTED]] Sent: Sunday, 12 January 2003 7:24 PM To: PHP List Subject: [PHP] highlight keywords issue Heya all, I'm trying to highlight search keywords in a string, everything work expect when this keyword is inside a tag like this : keyword (php) : a href=?go=phpphp/a img src=php.gif border=0 alt=php.net will be highlighted to : a href=?go=b style=color: black; background-color: #66php/bb style=color: black; background-color: #66php/b/a img src=b style=color: black; background-color: #66php/b.gif border=0 alt=b style=color: black; background-color: #66php/b.net I have tryed to separate text from html, then highlight it then join html/text again, but this will be very long and not really usefull ! I'm using preg_replace : preg_replace('|\b('.quotemeta($keyword).')\b|iU', 'b style=color: black; background-color: #66\\1/b', $content); Any help to fix that ? Thanks; Hatem -- 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] highlight keywords issue
I have find this very helpfull : preg_match_all(|[^]+(.*)/[^]+|, $haystack, $out, PREG_SET_ORDER); It's almost done, only if i can restrict the regexp to a and img tags only ... :( I need to look for Mastering Regular Expressions book tomorrow :D it's really boring without good docs - Original Message - From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] To: 'Hatem Ben' [EMAIL PROTECTED]; 'PHP List' [EMAIL PROTECTED] Sent: Sunday, January 12, 2003 2:28 PM Subject: RE: [PHP] highlight keywords issue You will need to break apart the entire document then process each area inside of the tags and to be very careful for nested tags. The simplest way around I have found to do with is to add to tags that have been processed with attributes that are ignored by the browser renderer eg... a href=/page.html done=yesPHP/a as you can see the a href has been processed because I have added in a extra attribute then continue to process the entire page from my preg matches. Nested tags are going to be your biggest issue. Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: Hatem Ben [mailto:[EMAIL PROTECTED]] Sent: Sunday, 12 January 2003 7:24 PM To: PHP List Subject: [PHP] highlight keywords issue Heya all, I'm trying to highlight search keywords in a string, everything work expect when this keyword is inside a tag like this : keyword (php) : a href=?go=phpphp/a img src=php.gif border=0 alt=php.net will be highlighted to : a href=?go=b style=color: black; background-color: #66php/bb style=color: black; background-color: #66php/b/a img src=b style=color: black; background-color: #66php/b.gif border=0 alt=b style=color: black; background-color: #66php/b.net I have tryed to separate text from html, then highlight it then join html/text again, but this will be very long and not really usefull ! I'm using preg_replace : preg_replace('|\b('.quotemeta($keyword).')\b|iU', 'b style=color: black; background-color: #66\\1/b', $content); Any help to fix that ? Thanks; Hatem -- 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
[PHP] how could a php script return a dns error ?
Hello all, I got a strange problem, a wrong php script was upladed in my hosting server and make my website return a dns error ! i've discoverd after one day that my index.php was a wrong one ! normally it should return another error related to script not to dns ! can someone explain me this ? Is this caused by server configuration or something else ? this is the correct script url : http://www.dynamix-tn.com/ and this is the wrong script url : http://www.dynamix-tn.com/index-old.php in localhost the index-old.php return this error, wich i think should be the correct error message (at least i can understand that my script is wrong): Warning: fopen(tmp/sample.htm, r) - No such file or directory in tmp.class.php on line 43 Warning: Supplied argument is not a valid File-Handle resource in tmp.class.php on line 44 Warning: Supplied argument is not a valid File-Handle resource in tmp.class.php on line 45 Thanks, Hatem
Re: [PHP] how could a php script return a dns error ?
I don't get a dns error on this I get - 'zero sized reply' can someone explain me this ? Is this caused by server configuration or something else ? I would say that a php error cannot directly cause dns problems - so the error message may be wrong ! (what is generating the message ?) This is what i get exactly : error The page cannot be displayed The page you are looking for is currently unavailable; The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings. /error The same message i got when a website experience dns problem ! anyway, i got this problem accidently. this is the correct script url : http://www.dynamix-tn.com/ and this is the wrong script url : http://www.dynamix-tn.com/index-old.php in localhost the index-old.php return this error, wich i think should be the correct error message at least i can understand that my script is wrong): Warning: fopen(tmp/sample.htm, r) - No such file or directory in tmp.class.php on line 43 Warning: Supplied argument is not a valid File-Handle resource in tmp.class.php on line 44 Warning: Supplied argument is not a valid File-Handle resource in tmp.class.php on line 45 on your test system - are these error messages the first thing outputed Yes On my test system these are the first thing outputed (system configured to report all errors). if the hosting setup is configured not to report error messages - you may just be getting an error and no output. you may be able to override the error reporting on a per-script basis http://www.php.net/manual/en/function.error-reporting.php also you could check that the file exists before opening it. -- Sean maybe this is what happened, and our national gateway return me this as a dns error message. Thanks, Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how could a php script return a dns error ?
it's not an IE specefic :)) netscape or opera or whatever will return the same error message. - Original Message - From: Paul Reed [EMAIL PROTECTED] To: 'Hatem Ben' [EMAIL PROTECTED] Sent: Saturday, December 28, 2002 10:19 PM Subject: RE: [PHP] how could a php script return a dns error ? It's not really a dns error, that the general error that MS Internet Explorer spits out when it can't find the file, as opposed to showing you the erro 404 file not found ... PHP cannot give a dns error, looks like your just linking to a file that doesn't exist and that's IE's friendly way of telling you so ... yes .. a bit confusing to the developer. (Thanks again MS...) Try it with netscape, and I bet you'll get a 'file not found' error instead... Paul. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how could a php script return a dns error ?
Ok, this is Netscape shots http://www.dynamix-tn.com/28dec2002/Image1.png If you want with lynx i'll do it, it's always the same. Better, i can do this : $sockhandle = @fsockopen(http://www.dynamix-tn.com/index-old.php;, 80, $errno, $errstr); if(!$sockhandle) { echo centerh5server dynamix-tn.com not available!: $errno : $errstr/h5/center; } else { echo centerh5server dynamix-tn.com is available!: $errno : $errstr/h5/center; } and run it from here, it return server not available. - Original Message - From: Leif K-Brooks To: Hatem Ben Cc: [EMAIL PROTECTED] Sent: Saturday, December 28, 2002 10:49 PM Subject: Re: [PHP] how could a php script return a dns error ? No, it is IE specific. It's IE's general error message, which means the document contains no data in this case. Hatem Ben wrote: it's not an IE specefic :)) netscape or opera or whatever will return the same error message. - Original Message - From: Paul Reed [EMAIL PROTECTED] To: 'Hatem Ben' [EMAIL PROTECTED] Sent: Saturday, December 28, 2002 10:19 PM Subject: RE: [PHP] how could a php script return a dns error ? It's not really a dns error, that the general error that MS Internet Explorer spits out when it can't find the file, as opposed to showing you the erro 404 file not found ... PHP cannot give a dns error, looks like your just linking to a file that doesn't exist and that's IE's friendly way of telling you so ... yes .. a bit confusing to the developer. (Thanks again MS...) Try it with netscape, and I bet you'll get a 'file not found' error instead... Paul. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] how could a php script return a dns error ?
- Original Message - From: Sean Burlington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, December 28, 2002 9:24 PM Subject: Re: [PHP] how could a php script return a dns error ? Hatem Ben wrote: This is what i get exactly : error The page cannot be displayed The page you are looking for is currently unavailable; The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings. /error The same message i got when a website experience dns problem ! anyway, i got this problem accidently. well thats not a dns error it's exactly what it says it is... the website is experiencing technical difficulties... Yep, this make a confusion for me, and a stupid error that could be solved in one minute, was done in one day. if the hosting setup is configured not to report error messages - you may just be getting an error and no output. you may be able to override the error reporting on a per-script basis http://www.php.net/manual/en/function.error-reporting.php also you could check that the file exists before opening it. maybe this is what happened, and our national gateway return me this as a dns error message. it can be awkward to debug when you get a one-size-fits-all error message set_error_handler() is anonther function you may find usefull http://www.php.net/manual/en/function.set-error-handler.php in fact there are all sorts of things you can do to help debugging - even if you don't want error messages apearing on the live site ! -- Sean :-) In conclusion our ISP is blocking such websites (an internet censorship system) and returned that message. I have said dns error, coz for dns error we got same message (maybe the server is assumed in all cases down), the original dns error is always blocked and we got that message inspite. Thanks, Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE : [PHP] how could a php script return a dns error ?
- Original Message - From: Michael J. Pawlowsky [EMAIL PROTECTED] To: Hatem Ben [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, December 28, 2002 11:20 PM Subject: Re: [PHP] how could a php script return a dns error ? The problem is that it can mean a bunch of things When I telnet to the server and request the document I get: !DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN HTMLHEAD TITLE404 Not Found/TITLE /HEADBODY H1Not Found/H1 The requested URL /index-old.php was not found on this server.P HR ADDRESSApache/1.3.20 Server at www.vgates.com Port 80/ADDRESS /BODY/HTML I am probably getting that because the server is using virtual hosts. yeah it's using vhost. the original adress is this one (http://www.vgates.com/~a5a5aa01/index-old.php) I've seen that also happend when a Content-type: MIME was not sent etc. Start commenting out large chunks of your code.. turn it into a hello world to start. Then start adding a few lines at a time. See what happends. I have just commented the code that return error (the fopen line), the script return an empty page. Then by adding the part returning error message, and the censorship is blocking again everything. I guess, this was a censorship issue ! and nothing else :)) Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how could a php script return a dns error ?
Sorry I've just removed the file. - Original Message - From: John Nichel [EMAIL PROTECTED] To: Hatem Ben [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, December 29, 2002 12:55 AM Subject: Re: [PHP] how could a php script return a dns error ? I went to it in Netscape 4.x, 6 7, and got this /* Not Found The requested URL /index-old.php was not found on this server. Apache/1.3.20 Server at dynamix-tn.com Port 80 */ In IE, I got /* The page cannot be found The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. -- -- Please try the following: If you typed the page address in the Address bar, make sure that it is spelled correctly. Open the www.dynamix-tn.com home page, and then look for links to the information you want. Click the Back button to try another link. Click Search to look for information on the Internet. HTTP 404 - File not found Internet Explorer */ Hatem Ben wrote: Ok, this is Netscape shots http://www.dynamix-tn.com/28dec2002/Image1.png If you want with lynx i'll do it, it's always the same. Better, i can do this : $sockhandle = @fsockopen(http://www.dynamix-tn.com/index-old.php;, 80, $errno, $errstr); if(!$sockhandle) { echo centerh5server dynamix-tn.com not available!: $errno : $errstr/h5/center; } else { echo centerh5server dynamix-tn.com is available!: $errno : $errstr/h5/center; } and run it from here, it return server not available. - Original Message - From: Leif K-Brooks To: Hatem Ben Cc: [EMAIL PROTECTED] Sent: Saturday, December 28, 2002 10:49 PM Subject: Re: [PHP] how could a php script return a dns error ? No, it is IE specific. It's IE's general error message, which means the document contains no data in this case. Hatem Ben wrote: it's not an IE specefic :)) netscape or opera or whatever will return the same error message. - Original Message - From: Paul Reed [EMAIL PROTECTED] To: 'Hatem Ben' [EMAIL PROTECTED] Sent: Saturday, December 28, 2002 10:19 PM Subject: RE: [PHP] how could a php script return a dns error ? It's not really a dns error, that the general error that MS Internet Explorer spits out when it can't find the file, as opposed to showing you the erro 404 file not found ... PHP cannot give a dns error, looks like your just linking to a file that doesn't exist and that's IE's friendly way of telling you so ... yes .. a bit confusing to the developer. (Thanks again MS...) Try it with netscape, and I bet you'll get a 'file not found' error instead... Paul. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how could a php script return a dns error ?
/snip It's not censorship they are economising by using a proxy server and using one that gives unhelpful error messages BTW - they in this case are the people providing you with your connection (not the web hosting company) they are not blocking the site but when the page returns no data - they return an error message - this is resonable - it just isn't very helpful for web developers. I'd suggest that you see if you can get a direct connection for testing purposes - either by changing browser settings or getting another isp. Proxys are great for saving bandwidth - but terrible for developing websites through :) -- Sean That proxy server is in our national backbone :))) So I need to change the country, not only the ISP :))) Later all, Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting full HTTP request the page was requested with?
$url = http://myserver.com;; $sockhandle = @fsockopen($url, 80, $errno, $errstr); if(!$sockhandle) { $mes = server $url not available!; $result = centerh5$mes/h5/center; return $result; } else { $request = GET / HTTP/1.1\r\n; $request .= User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\r\n; $request .= Host: $url\r\n; $request .= Connection: Close\r\n\r\n; fputs($sockhandle, $request); $res = ; $line = fgets($sockhandle, 1024); //Request Method $res .= $line\n; $line = fgets($sockhandle, 1024); //Close Method $res .= $line\n; $line = fgets($sockhandle, 1024); //Server Type $res .= $line\n; $line = fgets($sockhandle, 1024); //Date $res .= $line\n; $line = fgets($sockhandle, 1024); //Transfer-Encoding $res .= $line\n; $line = fgets($sockhandle, 1024); //Content-Type $res .= $line\n; $line = fgets($sockhandle, 1024); //Cache-control $res .= $line\n; $line = fgets($sockhandle, 1024); //Set-Cookie $res .= $line\n; $line = fgets($sockhandle, 1024); //End Header space $res .= $line\n; $res = addslashes($res); return $res; - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, December 15, 2002 4:54 PM Subject: [PHP] Getting full HTTP request the page was requested with? Is there a way to find out exactly what HTTP request was made for a page? Something like: GET http://myserver.com/whatever.php HTTP/1.1 Host: myserver.com -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- 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] Help with the PHP
Welcome to the new world ;) before clicking or asking start reading what is PHP (http://www.php.net), and in what it could be usefull. then you can getting started here : http://www.php.net/manual/en/tutorial.php - Original Message - From: Ted Frank [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 28, 2002 8:47 PM Subject: [PHP] Help with the PHP Hello, I am trying to make my free home page and my friend told me to download the php because it is for the web and i want to make a web page. so i downloaded the php with the flash plugin and i put it on my desktop and nothing showed up - i just want to make the free home page but the php does not work - i double click and noting happens i have the windows 95 with internet exploerer with a pentium 100 drive what do i do? Ted _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- 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] Re: How to create zip files in PHP ?
check this, it could help : http://www.phpclasses.org/browse.html/class/42.html Hatem - Original Message - From: Derick Rethans [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 27, 2002 4:26 PM Subject: [PHP] Re: How to create zip files in PHP ? Php User wrote: How to create zip files in PHP ? I found that php's zip function are read only... Can any one help me with that ? See this tutorial on zend.com: http://www.zend.com/zend/spotlight/creating-zip-files1.php http://www.zend.com/zend/spotlight/creating-zip-files2.php http://www.zend.com/zend/spotlight/creating-zip-files3.php -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ - -- 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] Creating mySql search feature.....
Hello, What you need is : 1- parse your query and make it boolean apple orange become apple and orange and so on 2- then you can generate a MySQL query based on that like this way --- SELECT id, field1 match (field1) against (' apple orange ') as relevance FROM hospitality WHERE match (field1) against ('apple')0 AND match (field1) against ('orange')0 HAVING relevance0 ORDER BY relevance DESC --- field1 will be your field(s) you're searching in. Hope this will help Hatem Cookra [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hi all, Need a little help here been at this for a while now... I have a database holding a table which in turn holds a collection of fields I need to search. Ive set up search form that sends the variable $S_For and $S_From, these variables represent the following: $S_For = the search keyword itself $S_From = the column which I need to search Ive created this and it works fine for single words, the problem as you may of guessed is when I enter a string of words ie: apple - works fine orange - works fine apple orange - doesnt Any help would be ideal - Databse = clientacc Table = hospitality - Everything else works on my site apart from this search feature.. please help! Regards R -- 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
[PHP] Huffman encoding
Hey all I'm looking to implement the huffman encoding in PHP, but i would like to ask if it isn't already done ? (why reinventing the wheel) Thx Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Huffman encoding / almost done
Sorry for the last email (i wasn't looking to highjack any thread :( very sorry guys !) - Original Message - From: Hatem Ben [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Sunday, November 24, 2002 2:06 PM Subject: [PHP] Huffman encoding Hey all I'm looking to implement the huffman encoding in PHP, but i would like to ask if it isn't already done ? (why reinventing the wheel) Thx Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP - transfering object-pointer
It wrks okay here; I guess i'm keeping register_global= On in php.ini ! Try debuging your sample using get_declared_classes and you'll find what you're missing class overall { var $loaded; function load($class){ eval (global \$$class;); eval(\$$class = new $class;); print_r(get_declared_classes()); return true; } } - Original Message - From: Tularis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 19, 2002 10:50 AM Subject: [PHP] OOP - transfering object-pointer Currently, I have the following code: ?php class overall { var $loaded; function load($class){ //eval(global \$$class;); // This didn't work either $this-loaded[] = $class; eval(\$this-$class = new $class;); return true; } } class foo { var $bar; // Constructor function bar(){ if(!isset($this-bar)){ $this-bar = 1; }else{ $this-bar++; } echo $this-bar.br; } } // Start actual loading $overall = new overall; $overall-load('foo'); foreach($overall-loaded as $key=$val){ $key = $overall-$key; } $overall-foo-bar(); $overall-foo-bar(); $overall-foo-bar(); $overall-foo-bar(); // it doesn't understand this $foo-bar(); // line 42 ? It all works, except for the $foo-bar(); thing... I am wondering how I can turn $overall-foo-bar() to $foo-bar(); as all the things I've tried, don't work, they don't give any errors, except for Fatal error: Call to a member function on a non-object in d:\apache\htdocs\classes.php on line 42... Could anyone help me with this? thanx - Tularis -- 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] Whois Search in PHP
this is what the whois server return exactly for Google (using whois.internic.net): Whois Server Version 1.3 Domain names in the .com, .net, and .org domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information. GOOGLE.COM.IS.THE.GREATEST.SEARCH.ENGINE.EVER.JIMPHILLIPS.ORG GOOGLE.COM To single out one record, look it up with xxx, where xxx is one of the of the records displayed above. If the records are the same, look them up with =xxx to receive a full display for each record. Last update of whois database: Sun, 17 Nov 2002 05:25:23 EST The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains and Registrars. it isn't the problem of the whois script only :)) Hatem - Original Message - From: Chandu Nannapaneni [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 6:49 PM Subject: [PHP] Whois Search in PHP Hi guys, I have just downloaded whois2.php from http://www.easydns.com/~markjr/whois2/ It's working great except for certain domains, for ex : google.com is being shown as available. I am in need of a good PHP script which gives me accurate results about availability of domains. /Chandu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whois Search in PHP
well, i guess there is NO OTHER WAY to check the availability of a domain other than using whois server ?php $domain = google.com\n; $server = rs.internic.net; $port = 43; $whois = fsockopen ($server,$port); $res = fputs ($whois, $domain); while (!feof ($whois)) { $data .= fgets($whois,2024); } echo $data; ? I use the same concept as this minimalistic sample with a full list of whois servers here http://www.dynamix-tn.com/?go=whois just parse the domain and use the suitable server and most of the time it return a fresh information, just use the suitable server. PS : send your emails to [EMAIL PROTECTED] :))) Hatem - Original Message - From: Chandu Nannapaneni [EMAIL PROTECTED] To: Hatem Ben [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 8:21 PM Subject: Re: [PHP] Whois Search in PHP No... U got me wrong.. Actually I'm looking for PHP scripts which can tell about the availability of domains. Using a WhoIs script serves the purpose, but not always. So I want suggestions from anybody how I can Find out the availability of a domain ( sld + tld ) for fresh registration. /Chandu - Original Message - From: Hatem Ben [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 18, 2002 12:12 AM Subject: Re: [PHP] Whois Search in PHP this is what the whois server return exactly for Google (using whois.internic.net): Whois Server Version 1.3 Domain names in the .com, .net, and .org domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information. GOOGLE.COM.IS.THE.GREATEST.SEARCH.ENGINE.EVER.JIMPHILLIPS.ORG GOOGLE.COM To single out one record, look it up with xxx, where xxx is one of the of the records displayed above. If the records are the same, look them up with =xxx to receive a full display for each record. Last update of whois database: Sun, 17 Nov 2002 05:25:23 EST The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains and Registrars. it isn't the problem of the whois script only :)) Hatem - Original Message - From: Chandu Nannapaneni [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 6:49 PM Subject: [PHP] Whois Search in PHP Hi guys, I have just downloaded whois2.php from http://www.easydns.com/~markjr/whois2/ It's working great except for certain domains, for ex : google.com is being shown as available. I am in need of a good PHP script which gives me accurate results about availability of domains. /Chandu -- 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] OOP-classes in PHP
just change make your new class global : class overall { var $loaded; function load($class){ eval (global \$$class;); eval(\$$class = new $class;); return true; } } then you can call it using $overall = new overall; $overall-load('foo'); // This should work now ;). $foo-foo(); Hatem - Original Message - From: Tularis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 11:21 PM Subject: [PHP] OOP-classes in PHP currently I have the followig script: everything works fine, except for the fact that it doesn't seem to understand $overall-foo-foo();. It returns this error: Fatal error: Call to a member function on a non-object in d:\apache\htdocs\classes.php on line 32 Now, I know the object is loaded, because the constructor is run, and puts out a 1 onscreen... I wish to know how to make this work... any help plz? thanx - Tularis ?php class overall { var $loaded; function load($class){ eval(\$$class = new $class;); return true; } } class foo { var $bar; // Constructor function foo(){ if(!isset($this-bar)){ $this-bar = 1; }else{ $this-bar++; } echo $this-bar.br; } } // Start actual loading $overall = new overall; $overall-load('foo'); // As of here it won't work anymore... somehow $overall-foo- doesn't work... $overall-foo-foo(); ? (and if possible, I would also like to change $overall-foo-foo() to $foo-foo(), but still keeping that class as a 'subclass' to the overall one.) -- 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
[PHP] xslt question
hey all I'm using xslt_process(), and noticed that it add a meta just after the head : meta http-equiv=Content-Type content=text/html; charset=UTF-8 Where can i change it, or desactivate it ? thanks Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] missing Parser Error ?
why PHP don't return a parse error here ? code case browse : $text = $myobject-browse();;; // some codes ... break; /code i guess syntax isn't correct or what do you think ?! Best regards Hatem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Images retrieved from MYSQL database using PHP becoming corrupted.
hello, Check the PHP-DB archives you'll find a code for the upload, and this one for viewing image : ? $mysql_hostname = ; $mysql_username = ; $mysql_passwd = ; $mysql_dbname = ; // Connecting, selecting database $link = @mysql_connect($mysql_hostname,$mysql_username, $mysql_passwd) or die(Could not connect); @mysql_select_db($mysql_dbname) or die(Could not select database); $query = select image_thumbnail,image_thumbnail_type from master_products where item_id=$id; $result = mysql_query( $query ) or die(Query failed); $num = musql_numrows($result); $data = @mysql_fetch_array($result); if ($id == 1) { // Output the MIME header $mime = $data[image_thumbnail_type]; header(Content-Type: $mime); echo $data[image_thumbnail]; } else { // not valid id image, you can send any other message } ? Hope this will help Hatem Darren McPhee [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I have spent the last 3 days trying to figure this out. And will probably give up very soon. I have written 2 programs (which are very common PHP programs) that A) Allows me to upload image files into a MYSQL database using a simple form. And B) Allows me to retrieve and display the image using a PHP script. This is my problem:- I can upload the images ok. I store the binary code, image type, name, and size within the MYSQL database. On checking the database directly using DBTools, I can see that the files have uploaded. The file sizes reflect exactly what was originally on the hard disk of my PC (not sure if this is a correct gauge). When I run my PHP program to display the images, maybe only 1 out of 10 actually displays correctly. The rest are broken up or non displayable images. One image even made a prompt window appear and somehow now causes Windows paint to load the image instead of the browser. God only knows how that occurred !! Below are my (designed by others) 2 programs. The first program is the upload form. This seems to work ok. HTML HEADTITLEStore binary data into SQL Database/TITLE/HEAD BODY ?php // code that will be executed if the form has been submitted: if ($submit) { // connect to the database require_once('../../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $data = addslashes(fread(fopen($form_data, r), filesize($form_data))); $result=MYSQL_QUERY(INSERT INTO master_products (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t ype) . VALUES ('$data','$form_data_name','$form_data_size','$form_data_type')); $id= mysql_insert_id(); print pThis file has the following Database ID: b$id/b; MYSQL_CLOSE(); } else { // else show the form to submit new data: ? form method=post action=?php echo $PHP_SELF; ? enctype=multipart/form-data INPUT TYPE=hidden name=MAX_FILE_SIZE value=100 brFile to upload/store in database:br input type=file name=form_data size=40 pinput type=submit name=submit value=submit /form ?php } ? /BODY /HTML Here is the code to display the image:- ?php if($id) { require_once('../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $query = select image_thumbnail,image_thumbnail_type from master_products where item_id=$id; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,image_thumbnail); $type = @MYSQL_RESULT($result,0,image_thumbnail_type); Header( Content-type: $type); echo $data; }; ? I run the above program in the following way: http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id primary key field for whichever record I want to display. I have tried these programs on a test server here in my room to a test Apache server and MYSQL test database, and also from my ISP to a MYSQL database at a server at my ISP. I get exactly the same problem. When I run the display image program, the images being displayed are always being displayed the same. Which points the problem towards the upload process (maybe). If anybody can tell me what the heck is wrong here, I'll give them a medal !! There is basically some kind of binary corruption going on (it looks like) For added information, below is my database table structure. At the moment, the only part I am actually using relates to the image_thumbnail sections. Darren. CREATE TABLE master_products ( item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, item_code VARCHAR (10) UNIQUE, item_dateadded DATETIME DEFAULT '-00-00 00:00:00', item_datemodified DATETIME DEFAULT '-00-00 00:00:00', category ENUM (none,single herbs,general vitality,ageing,arthritis,eyesite,prostate,ahlzheimers, weight loss,menopause,depression,fatigue,headaches,insomnia,colds and flues,allergies, healthy heart,cancer prevention,aphrodisiacs,sexual herbs,for women,for