09-16-2019
Normally we write the processing of SQL statements in a server-side scripting language meant for the web, using "created for the web languages" like PHP or Javascript.
Also, depending on how you write your SQL select query, the results of the select query are generally in an array and so the script generally needs to process an array, not a simple string or text file.
However, if you are looking for a single element only from the SQL select query, the results of the SQL query are often still in an array, a single element array.
So, in the general case, you should write your script to process an array as the input to your script which is the output of the SQL query.
This User Gave Thanks to Neo For This Post:
10 More Discussions You Might Find Interesting
1. Programming
helo i want to implement the following concept in my project
write a c/c++ algorithm for : accept a number from the user not greater than 6 digits and display the number in words i.e. if the input from the user is 18265 then the output should be Eighteen Thousand Two Hundred Sixty Five. if the... (3 Replies)
Discussion started by: amitpansuria
3 Replies
2. Shell Programming and Scripting
Hi..
How to search for multiple words in a single line using grep?.
Eg: Jack and Jill went up the hill
Jack and Jill were best friends
Humpty and Dumpty were good friends too
----------
I want to extract the 2nd statement(assuming there are several statements with... (11 Replies)
Discussion started by: anduzzi
11 Replies
3. Shell Programming and Scripting
Dear All,
I have a final output files as
736645|0|
13879|1|
495563|10|
127933|14|
4975|16|
49038|6|
53560|7|
135115|8|
178857|9|
Now I want to replace second column with respective tag as per the value (4 Replies)
Discussion started by: jojo123
4 Replies
4. UNIX Desktop Questions & Answers
well, i am so not familiar with this kind of things but i am gonna explain extactly what i am looking for so hopfully someone can figure it out :)
i have a command that shows memory usage besides the process name, for example(the command output):
500 kb process_1
600 kb process_2
700 kb... (4 Replies)
Discussion started by: Portabello
4 Replies
5. Shell Programming and Scripting
Hi,
I have a requirement with,
No~Dt~Notes
1~2011/08/1~"aaa
bbb
ccc
ddd
eee
fff
ggg
hhh"
Single column alone got splitted into multiple lines.
I require the output as
No~Dt~Notes
1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh"
mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies
6. Shell Programming and Scripting
Hello All,
I'm a newbie/rookie in Shell scipting. I've done oracle export of a table using Export utility. When I do export, it generates 2 files.
1> .dmp file
2> .dmp.log file.
In .dmp.log file I have to search for a sentence which goes like '0 records have been inserted' and then... (2 Replies)
Discussion started by: samfisher
2 Replies
7. Shell Programming and Scripting
I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help
File:
<xml><object1>house</object1><object2>child</object2>... (9 Replies)
Discussion started by: srkmish
9 Replies
8. Shell Programming and Scripting
Hi All,
I am working with a XML file.
Below is part for the file.
<Emp:Profile>
<Emp:Description>Admin</Emp:Description>
<Emp:Id>12347</Emp:Id>
</Emp:Profile>
<Emp:Profile>
... (7 Replies)
Discussion started by: Girish19
7 Replies
9. Shell Programming and Scripting
I have the input file like this.
Input file: 12.txt
1) There are one or more than one <tr> tags in same line.
2) Some tr tags may have one <td> or more tna one <td> tags within it.
3) Few <td> tags having "<td> </td>". Few having more than one " " entry in it.
<tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies
10. Shell Programming and Scripting
Greetings all,
I have an XML file that is being generated from my application, here is a sample of the first tag (That I am trying to remove and display in a list..)
Example-
<tag one= "data" data="1234" updateTime="1300">
<tag one= "data1" data="1234" updateTime="1300">
<tag... (5 Replies)
Discussion started by: jeffs42885
5 Replies
LEARN ABOUT PHP
pg_query_params
PG_QUERY_PARAMS(3) PG_QUERY_PARAMS(3)
pg_query_params - Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command
text.
SYNOPSIS
resource pg_query_params ([resource $connection], string $query, array $params)
DESCRIPTION
Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text.
pg_query_params(3) is like pg_query(3), but offers additional functionality: parameter values can be specified separately from the command
string proper. pg_query_params(3) is supported only against PostgreSQL 7.4 or higher connections; it will fail when using earlier versions.
If parameters are used, they are referred to in the $query string as $1, $2, etc. The same parameter may appear more than once in the
$query; the same value will be used in that case. $params specifies the actual values of the parameters. A NULL value in this array means
the corresponding parameter is SQL NULL.
The primary advantage of pg_query_params(3) over pg_query(3) is that parameter values may be separated from the $query string, thus avoid-
ing the need for tedious and error-prone quoting and escaping. Unlike pg_query(3), pg_query_params(3) allows at most one SQL command in the
given string. (There can be semicolons in it, but not more than one nonempty command.)
PARAMETERS
o $connection
- PostgreSQL database connection resource. When $connection is not present, the default connection is used. The default connection
is the last connection made by pg_connect(3) or pg_pconnect(3).
o $query
- The parameterized SQL statement. Must contain only a single statement. (multiple statements separated by semi-colons are not
allowed.) If any parameters are used, they are referred to as $1, $2, etc. User-supplied values should always be passed as param-
eters, not interpolated into the query string, where they form possible SQL injection attack vectors and introduce bugs when han-
dling data containing quotes. If for some reason you cannot use a parameter, ensure that interpolated values are properly escaped.
o $params
- An array of parameter values to substitute for the $1, $2, etc. placeholders in the original prepared query string. The number
of elements in the array must match the number of placeholders. Values intended for bytea fields are not supported as parameters.
Use pg_escape_bytea(3) instead, or use the large object functions.
RETURN VALUES
A query result resource on success or FALSE on failure.
EXAMPLES
Example #1
Using pg_query_params(3)
<?php
// Connect to a database named "mary"
$dbconn = pg_connect("dbname=mary");
// Find all shops named Joe's Widgets. Note that it is not necessary to
// escape "Joe's Widgets"
$result = pg_query_params($dbconn, 'SELECT * FROM shops WHERE name = $1', array("Joe's Widgets"));
// Compare against just using pg_query
$str = pg_escape_string("Joe's Widgets");
$result = pg_query($dbconn, "SELECT * FROM shops WHERE name = '{$str}'");
?>
SEE ALSO
pg_query(3).
PHP Documentation Group PG_QUERY_PARAMS(3)