[x]
Forum
Forum
[x]  
~eCON500:iconeCON500: May 9, 2008, 4:08:15 PM
Hey Guys I missed one of my lectures a week back and Ive been looking over the slides he gave out on that week. I understand 6/7 of the slides lol. Here is the slide I don't understand

Both Perl and PHP support string interpolation. What is string
interpolation and why is it particularly useful in the context of
web server technology?

Define the terms placeholder and bind value.

Rewrite the Perl below to use a placeholder and a bind value.
$sth = $dbh->;prepare("SELECT fNB, fNA FROM tN
where fNZ=$fNZ;") or die $dbh->errstr;
$sth->execute( ) or die $dbh->errstr;

Why might the PHP below be a useful addition to one of your
validation functions? Suggest text for the user feedback
message.
elseif(strlen($suspectValue)>20) $myArr = array(false,"user
feedback message");

I kinda get what string interpolation is, I think its something to do with how to php and perl handle input from http request methods like get and post.
Apart from that im pretty stuck on this slide.

Any help on any of that stuff would be awesome and greatly appreciated :)

--
The Home of Awesomeness [link] :headbang:

Devious Comments

love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0

`BoffinbraiN:iconBoffinbraiN: May 9, 2008, 5:39:59 PM
Anything that your lecture notes cannot teach you, Wikipedia can! http://en.wikipedia.org/wiki/Interpolation_search
~eCON500:iconeCON500: May 10, 2008, 6:19:19 AM
I think string interpolation is different from Interpolation search.

--
The Home of Awesomeness [link] :headbang:
=philho:iconphilho: May 10, 2008, 6:42:32 AM
Without searching, I believe that what is called string interpolation is putting variable names in strings. At interpretation time, these variable names are replaced by their values.
Example: $result = "Hello $title $lastname, how are you since your last visit $dayNb days ago?";
Or substituting SQL parameters with variables...

I let you find how the placeholder and bind value stuff goes there... (but I can help more if needed).

--
82% of statistics in signatures are made up. :rip: (This is a recursive signature...)
Spreading them is un-original and sheepish. If you agree, copy this in your... wait, no! :D
No to signature clichés! You are on an art site, be creative!
~eCON500:iconeCON500: May 10, 2008, 6:55:01 AM
Yeh I think placeholder is where $title $lastname $dayNb are replaced with ? ? questions marks and filled in when the SQL is executed. Not really sure what "bind value" is

--
The Home of Awesomeness [link] :headbang:
=philho:iconphilho: May 10, 2008, 7:50:42 AM
Not sure either, but I would say that a variable name is bound to its current value.

--
82% of statistics in signatures are made up. :rip: (This is a recursive signature...)
Spreading them is un-original and sheepish. If you agree, copy this in your... wait, no! :D
No to signature clichés! You are on an art site, be creative!
~ZarelSL:iconZarelSL: May 10, 2008, 9:46:12 AM
Anyone know what the

elseif(strlen($suspectValue)>20) $myArr = array(false,"user feedback message");

is supposed to do? What strings are somehow different and erroneous when they're over 20 chars? $dbh->errstr ? The query itself should be above 20 chars, so it's not that.
=philho:iconphilho: May 10, 2008, 10:00:52 AM
If the database field where this value must be read has a fixed size of 20 chars, this value can't be there.

--
82% of statistics in signatures are made up. :rip: (This is a recursive signature...)
Spreading them is un-original and sheepish. If you agree, copy this in your... wait, no! :D
No to signature clichés! You are on an art site, be creative!
`BoffinbraiN:iconBoffinbraiN: May 10, 2008, 7:24:29 PM
:giggle: Well then, that makes two people that failed to interpret the notes correctly.
~eCON500:iconeCON500: May 11, 2008, 4:25:05 AM
Thanks for the help man I think i got the jist of it

--
The Home of Awesomeness [link] :headbang: