Need help on bind param function in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help on bind param function in perl
# 1  
Old 02-02-2011
Need help on bind param function in perl

Hi,

I want to know what exactly bind paameter does?

what exactly bind_param( 1, $siteName ) means?

what 1 means?

In some examples the bind_param is set like this:

Code:
bind_param( 2, $siteName1 )
bind_param( 3, $siteName2 )

Code:
$sth = $dbh->prepare( "
            SELECT name, location
            FROM megaliths
            WHERE name = ?
        " );
$sth->bind_param( 1, $siteName );

I tired in google but some how i did not get clear picture.

Help is very much appreciated

Regards
Vanitha
# 2  
Old 02-02-2011
bind_param() is used for binding the parameters dynamically in the SQL.
What it does is, it will replace all the placeholders ('?' symbol) with the corresponding values.
First argument is the position of the placeholder in the statement.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

<Mail> attachment param is not working under system function

Hi Guys, I have executed the mail command that has attachment with filename as current date enclosed in system function that is added under awk command. I have used awk command to check if the error code is present in the file then email command sends an email with subject Error Code ,body... (2 Replies)
Discussion started by: reminisce
2 Replies

2. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies

3. Web Development

CGI param() function parameters

Hello again! Three posts in this forum now, as I am trying to understand how CGI is running and the interaction of the input and output with the server/browser. Very confused with them, especially with the param() function that I was trying to figure out how the parameters of it were passed in... (0 Replies)
Discussion started by: yifangt
0 Replies

4. Shell Programming and Scripting

Trying to Bind a keypress to a function

I've been trying to re-think an old problem that didn't get answered. I know this is possible, but I'm having trouble getting it to run. I just want to call a function with a key-press or key combination. I looked and saw bind can be used to run functions and other scripts this way. Here's what... (2 Replies)
Discussion started by: Azrael
2 Replies

5. Shell Programming and Scripting

PERL : SQL array bind issue while grouping

Hi, I have an array of strings. Each string has 4 comma separated values. I am binding this array to a SQL where I am required to do an INSERT after grouping. The binding is done as : $insertADWSth->bind_param_array(1,A_CONSTANT_STRING);... (1 Reply)
Discussion started by: sinpeak
1 Replies

6. Shell Programming and Scripting

PERL : Bind 2D array to SQL

Hi, I am in the need of doing a bulk insert via : SQL - INSERT INTO <table> (SELECT..) OR PLSQL Block - FORALL i IN 1 .. count INSERT INTO <table>(arrayname(i)) I have a 2D array in my perl code which has the rows to be bulk inserted. Is there a way to bind the 2D array to the SQL... (4 Replies)
Discussion started by: sinpeak
4 Replies

7. Shell Programming and Scripting

oct function in perl

hi i came across one program which uses some method to calculate file permissions using lstat in perl and i am not getting how its doing that i am pasting the code below ... $ > cat b.pl use Fcntl':mode'; my... (0 Replies)
Discussion started by: zedex
0 Replies

8. UNIX for Dummies Questions & Answers

perl bless function

hi i am not getting what exactly bless function do in perl explanation in perldoc is not very clear i tried to search on google but i am getting confused or rather not getting at all. can anybody explain in short what it does in following example as well as in general ? sub new { my... (1 Reply)
Discussion started by: zedex
1 Replies

9. UNIX for Dummies Questions & Answers

substr function in perl

Hi friends, I have written a perl code and it works fine but I am not sure tommorow it works or not, please help me. problem : When diff is 1 then success other than its failure but tomorrow its 20090401 and the enddate is 20090331. thats why I write the code this type but it does not work and... (1 Reply)
Discussion started by: tukuna82
1 Replies

10. Shell Programming and Scripting

Perl DBI - Bind Parameters Problem

I have a SQL statement that includes a UNION that I can't get to work when I bind the parameters. (I am binding the parameters to prevent SQL injection.) Does anybody have any suggestion on how I can use a SQL statement that includes a UNION and bind the params? Code would be something like... (1 Reply)
Discussion started by: mh53j_fe
1 Replies
Login or Register to Ask a Question