Re: [PHP] Variable as an index

2008-12-21 Thread Lars Torben Wilson
2008/12/21 German Geek : > Yes, i agree with this. Even if it takes a few nano seconds more to write > out more understandable code, it's worth doing it because code management is > more important than sqeezing out the last nano second. And then also an > $var = "Hello"; > echo "$val World"; > > ha

Re: [PHP] Replacing special characters with their HTML equivalents

2008-12-21 Thread Larry Garfield
On Sunday 21 December 2008 5:30:25 pm James Colannino wrote: > Hey everyone. I have a question. I have a web scraper that grabs > information from web pages that often contain characters such as vowels > with umlots (I know I spelled that wrong.) > > The data is editable, so the characters show u

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
Yes, i agree with this. Even if it takes a few nano seconds more to write out more understandable code, it's worth doing it because code management is more important than sqeezing out the last nano second. And then also an $var = "Hello"; echo "$val World"; has less characters than and is more rea

Re: [PHP] Variable as an index

2008-12-21 Thread Chris
Anthony Gentile wrote: for e.g. $var = 'world'; echo "hello $var"; vs echo 'hello '.$var; The first uses twice as many opcodes as compared to the second. The first is init a string and adding to it the first part(string) and then the second part (var); once completed it can echo it out. The seco

Re: [PHP] Replacing special characters with their HTML equivalents

2008-12-21 Thread James Colannino
Daniel Brown wrote: > Welcome to the list, James. Thanks :) > Check out htmlentities(): http://php.net/htmlentities I'll check that out. James -- "Black holes are where God divided by zero." --Steven Wright signature.asc Description: OpenPGP digital signature

Re: [PHP] Variable as an index

2008-12-21 Thread Chris
Anthony Gentile wrote: True, it might mean the very slightest in milliseconds...depending on what you're doing/hardware. Connecting to a db will (probably) take longer than most of those differences, let alone running a query & processing the results. Ternaries that make a lot of people feel

[PHP] Replacing special characters with their HTML equivalents

2008-12-21 Thread James Colannino
Hey everyone. I have a question. I have a web scraper that grabs information from web pages that often contain characters such as vowels with umlots (I know I spelled that wrong.) The data is editable, so the characters show up unmodified in an editable text box. However, when I try to import t

Re: [PHP] Variable as an index

2008-12-21 Thread Anthony Gentile
True, it might mean the very slightest in milliseconds...depending on what you're doing/hardware. However, no harm in understanding the difference/how it works. Many will code echo "Hello World" and echo 'Hello World'; and never know the difference, I just happen to think being aware of the details

Re: [PHP] Replacing special characters with their HTML equivalents

2008-12-21 Thread Daniel Brown
On Sun, Dec 21, 2008 at 18:30, James Colannino wrote: > Hey everyone. I have a question. I have a web scraper that grabs > information from web pages that often contain characters such as vowels > with umlots (I know I spelled that wrong.) Welcome to the list, James. Check out htmlenti

Re: [PHP] Variable as an index

2008-12-21 Thread Anthony Gentile
for e.g. $var = 'world'; echo "hello $var"; vs echo 'hello '.$var; The first uses twice as many opcodes as compared to the second. The first is init a string and adding to it the first part(string) and then the second part (var); once completed it can echo it out. The second is simply two opcodes,

Re: [PHP] Variable as an index

2008-12-21 Thread Marc Steinert
German Geek schrieb: Why is the first method faster and uses less memory? Because the concatenation operator first reassembles a new string, stores it in memory then passes this newly created string to the echo function, if I'm not misstaken. -- http://bithub.net/ Synchronize and share yo

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
Why is the first method faster and uses less memory? Tim-Hinnerk Heuer http://www.ihostnz.com On Mon, Dec 22, 2008 at 10:59 AM, Marc Steinert wrote: > MikeP schrieb: > >> I have tried putting the quotes all over and all I get is: >> 'Array[U]'. >> >> >> > Try to avoid accessing the two-dimens

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
OK. I would think it uses more memory then, but doubt it would be slower. Isnt the output buffered in memory anyway though in PHP? Surely the buffer is bigger than 100 bytes (which is about the length of this string). So one way or the other, the memory is used. Tim-Hinnerk Heuer http://www.ihost

Re: [PHP] Variable as an index

2008-12-21 Thread German Geek
$users is an array and you are trying to simply put it in a string. $x seems to be undefined ergo it's not printing anything. If 'U' is the index in the array for your variable, use the '.' operator to concatenate strings: echo " '" . $users[$x]['U'] ."' "; Tim-Hinnerk Heuer http://www.

Re: [PHP] Variable as an index

2008-12-21 Thread Marc Steinert
MikeP schrieb: I have tried putting the quotes all over and all I get is: 'Array[U]'. Try to avoid accessing the two-dimensional array $users inside a string. Use echo's ability to accept multiple parameters: echo '', $users[$x]['U'], ''; Or by concating the string with the .-Operator:

[PHP] Variable as an index

2008-12-21 Thread MikeP
Hello, I am trying to output the value of the following:($x is an int incremented by a for statement. echo " '$users[$x][U]' "; I have tried putting the quotes all over and all I get is: 'Array[U]'. What am I doing wrong. Thanks Mike -- PHP General Mailing List (http://www.p

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
I guess you are right about mixing php with html. Actually the suggestion you gave breaks my search function. If I now search for a product called 'type 22' the space and first digit 2 breaks the serach. Also the \" in the htnl / php is causing a break in the image path urls ... so back to the dr

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
I guess you are right about mixing php with html. Actually the suggestion you gave breaks my search function. If I now search for a product called 'type 22' the space and first digit 2 breaks the serach. Also the \" in the htnl / php is causing a break in the image path urls ... so back to the

[PHP] Re: Create PHP form from MySQL table structure

2008-12-21 Thread Al
R B MacGregor wrote: Hi folks Anybody got any recommendations for a utility which would create a quick head start by creating the php/html code for a basic form using the field structure of a MySQL table ? Thanks for any suggestions. Look at Pear HTML_QuickForm and other HTML classes.

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
thanks for the advice re html and php mashup!! I will research to find the way to do it outside the php. - Gary Maddock-Greene ""Anthony Gentile"" wrote in message news:2ce4207d0812211021g215d5346wb0afcedf039ef...@mail.gmail.com... Sorry no products were found"; } else { echo "Please click o

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
That's got it thanks Anthony. I love when you learn something. It was the back slash \ preceeding the "'s in my html that I wasn't aware of. Now I know they are needed if using "" in your code. Thank you so much for your help. -- - Gary Maddock-Greene ""Anthony Gentile"" wrote in message n

Re: [PHP] eof bof in php

2008-12-21 Thread Anthony Gentile
err forgot the closing > in ". Anthony Gentile Cell: 704.657.8550 Diese E-Mail ist vertraulich. Wenn Sie nicht der rechtmaessige Empfaenger sind, duerfen Sie den Inhalt weder kopieren noch verbreiten oder benutzen. Sollten Sie diese E-Mail versehentlich erhalten haben, senden Sie diese bitte an un

Re: [PHP] eof bof in php

2008-12-21 Thread Anthony Gentile
Sorry no products were found"; } else { echo "Please click on a product for further information."; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo " ". $row_rsSearch['product_name']." ". $row_rsSearch['product_subtitle'] ."

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
I've corrected those errors thanks but how do I insert this code as the else statement? View Product -- - Gary Maddock-Greene ""Anthony Gentile"" wrote in message news:2ce4207d0812210959

Re: [PHP] eof bof in php

2008-12-21 Thread Anthony Gentile
...missing semicolon and some brackets. Sorry no products were found"; } else { echo "Please click on a product for further information."; } ?> If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile

Re: [PHP] Create PHP form from MySQL table structure

2008-12-21 Thread Bassel Safadi
On Sun, Dec 21, 2008 at 7:24 PM, tedd wrote: > At 10:35 AM + 12/21/08, R B MacGregor wrote: > >> Hi folks >> >> Anybody got any recommendations for a utility which would create a quick >> head >> start by creating the php/html code for a basic form using the field >> structure >> of a MySQL t

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
Thanks guys .. I can get this part working great .. Sorry no products were found"; } else echo "Please click on a product for further information." ?> But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above

Re: [PHP] Create PHP form from MySQL table structure

2008-12-21 Thread tedd
At 10:35 AM + 12/21/08, R B MacGregor wrote: Hi folks Anybody got any recommendations for a utility which would create a quick head start by creating the php/html code for a basic form using the field structure of a MySQL table ? Thanks for any suggestions. -- Ronnie MacGregor Scotland Ro

Re: [PHP] Re: imap_rfc822_parse_adrlist problem

2008-12-21 Thread Manuel Lemos
Hello, on 12/21/2008 11:12 AM Ben Stuyts said the following: >>> Since upgrading to php 5.2.8 I have a problem with >>> imap_rfc822_parse_adrlist. When I run the example given on the manual >>> page at http://nl3.php.net/imap_rfc822_parse_adrlist: >>> ... >>> So the host part isn't filled in corre

[PHP] Create PHP form from MySQL table structure

2008-12-21 Thread R B MacGregor
Hi folks Anybody got any recommendations for a utility which would create a quick head start by creating the php/html code for a basic form using the field structure of a MySQL table ? Thanks for any suggestions. -- Ronnie MacGregor Scotland Ronnie at dBASEdeveloper dot co dot uk www.dBASEd

Re: [PHP] eof bof in php

2008-12-21 Thread Ashley Sheridan
On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: > if (0 == $totalRows_rsSearch) { > echo "Sorry no products were found"; > } else > > Anthony Gentile > > > > On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene < > g...@maddock-greene.co.uk> wrote: > > > I have tried that but to no

Re: [PHP] eof bof in php

2008-12-21 Thread Anthony Gentile
if (0 == $totalRows_rsSearch) { echo "Sorry no products were found"; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene < g...@maddock-greene.co.uk> wrote: > I have tried that but to no avail :) > > if ($totalRows_rsSearch=0) > echo "Sorry no products were found"; >

Re: [PHP] eof bof in php

2008-12-21 Thread Ashley Sheridan
On Sun, 2008-12-21 at 16:22 +, Gary Maddock-Greene wrote: > I have tried that but to no avail :) > > if ($totalRows_rsSearch=0) > echo "Sorry no products were found"; > else > > > // All seems OK to here, then the syntax error unexpected T_VARIABLE > appears > > > echo Please click o

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
I have tried that but to no avail :) // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo Please click on a product for further information. View Product -

Re: [PHP] eof bof in php

2008-12-21 Thread Ashley Sheridan
On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: > Thanks Ashley ... I have been trying that but I think my syntax id shot!! > > if ($totalRows_rsSearch="0") > echo "Sorry no products were found"; > else > echo "Please click on a product for further information." > ?> > >

Re: [PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
Thanks Ashley ... I have been trying that but I think my syntax id shot!! Please click on a product for further information." ?> ?> View Product -- - Gary Maddock-Greene "Ashley Sheridan" wro

Re: [PHP] eof bof in php

2008-12-21 Thread Ashley Sheridan
On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: > Hi, I'm very new to php. Please can someone point me in the right direction? > I want to display a message: 'No Products Found' if my search record set > returns no value. > > I think I need to be looking at this section of my code

[PHP] eof bof in php

2008-12-21 Thread Gary Maddock-Greene
Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf("SELECT * FROM products WHERE product_na

Re: [PHP] Passing var from one page to itself

2008-12-21 Thread tedd
At 4:10 PM +1300 12/21/08, Aslan wrote: Hey there, I have a problem where I have a simple -script that I am wanting to pass back to itself three times 1) Symptoms - > 2) Troubleshooting questions 3) Answer to problem -snip- I have it currently all on one page, but it isn't quite what I was

Re: [PHP] Image Resizing

2008-12-21 Thread Gary Maddock-Greene
nice post Tedd and useful web site :) -Gary "tedd" wrote in message news:p06240802c573f5a71...@[192.168.1.101]... At 12:38 PM -0800 12/20/08, Stephen Alistoun wrote: Hi all, What is the best way in PHP to Resize an Image to a specific width. For Example I have images in the following sizes

Re: [PHP] Image Resizing

2008-12-21 Thread tedd
At 12:38 PM -0800 12/20/08, Stephen Alistoun wrote: Hi all, What is the best way in PHP to Resize an Image to a specific width. For Example I have images in the following sizes: (1) 200px width and 350px height (2) 125px width and 220px height (3) 166px width and 455px height I want all the i

Re: [PHP] Re: imap_rfc822_parse_adrlist problem

2008-12-21 Thread Ben Stuyts
Hi, On 21 dec 2008, at 03:41, Manuel Lemos wrote: on 12/20/2008 09:34 PM Ben Stuyts said the following: Hi, Since upgrading to php 5.2.8 I have a problem with imap_rfc822_parse_adrlist. When I run the example given on the manual page at http://nl3.php.net/imap_rfc822_parse_adrlist: ... So the

[PHP] Re: Repeat Region Error

2008-12-21 Thread Gary Maddock-Greene
Sorry guys .. resolved it doh! I was freeing the recordset in -Gary ""Gary Maddock-Greene"" wrote in message news:5a.42.33998.4b83e...@pb1.pair.com... Hi All, I am getting the following error - Warning: mysql_fetch_assoc(): 3 is not a valid MySQL result resource in I think it has

[PHP] Repeat Region Error

2008-12-21 Thread Gary Maddock-Greene
Hi All, I am getting the following error - Warning: mysql_fetch_assoc(): 3 is not a valid MySQL result resource in I think it has something to do with my Dreamweaver created code for a repeat region. The head code is: function GetSQLValueString($theValue, $theType, $theDefinedValue =

Re: [PHP] Passing var from one page to itself

2008-12-21 Thread Jason Paschal
also, you can store info in hidden form fields. on the 2nd page, populate the hidden fields with the data from the first page. when that form is submitted, the hidden field values will get submitted as well. that's not ideal, tho. if you have validation in place between the first and second pag

Re: [PHP] Image Resizing

2008-12-21 Thread Jason Paschal
i use imageMagick: http://www.imagemagick.org/Magick++/Geometry.html $command_line = "convert -geometry $width" . "x" . "$height $image_path $thumb_path"; system($command_line, $return_var); if ($return_var == 1) { echo "Thumbnail creation failed! :("; } else { echo "Thumbnail create

Re: [PHP] Image Resizing

2008-12-21 Thread Kevin Waterson
This one time, at band camp, Stephen Alistoun wrote: > I want all the images to resize to 100px width but the height adjusts > automatically. Two ways, GD or Imagick http://www.phpro.org/examples/GD-Thumbnail-Based-On-Image-Type.html http://www.phpro.org/tutorials/Imagick.html#4 Kevin --

Re: [PHP] Passing var from one page to itself

2008-12-21 Thread kspal
hello, you can use session to store your variables between pages. Aslan a écrit : Hey there, I have a problem where I have a simple -script that I am wanting to pass back to itself three times 1) Symptoms - > 2) Troubleshooting questions 3) Answer to problem The page is passing the vars f