MSQL_QUERY(3)MSQL_QUERY(3)msql_query - Send mSQL querySYNOPSIS
resource msql_query (string $query, [resource $link_identifier])
DESCRIPTION msql_query(3) sends a query to the currently active database on the server that's associated with the specified link identifier.
PARAMETERS
o $query
- The SQL query.
o $
link_identifier -The mSQL connection. If not specified, the last link opened by msql_connect(3) is assumed. If no such link is
found, the function will try to establish a link as if msql_connect(3) was called, and use it.
RETURN VALUES
Returns a positive mSQL query identifier on success, or FALSE on error.
EXAMPLES
Example #1
msql_query(3) example
<?php
$link = msql_connect("dbserver")
or die("unable to connect to msql server: " . msql_error());
msql_select_db("db", $link)
or die("unable to select database 'db': " . msql_error());
$result = msql_query("SELECT * FROM table WHERE id=1", $link);
if (!$result) {
die("query failed: " . msql_error());
}
while ($row = msql_fetch_array($result)) {
echo $row["id"];
}
?>
SEE ALSO msql_db_query(3), msql_select_db(3), msql_connect(3).
PHP Documentation Group MSQL_QUERY(3)
Check Out this Related Man Page
MSQL_CONNECT(3)MSQL_CONNECT(3)msql_connect - Open mSQL connectionSYNOPSIS
resource msql_connect ([string $hostname])
DESCRIPTION msql_connect(3) establishes a connection to a mSQL server.
If a second call is made to msql_connect(3) with the same arguments, no new link will be established, but instead, the link identifier of
the already opened link will be returned.
The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling
msql_close(3).
PARAMETERS
o $hostname
- The hostname can also include a port number. e.g. hostname,port. If not specified, the connection is established by the means
of a Unix domain socket, being then more efficient then a localhost TCP socket connection.
Note
While this function will accept a colon ( :) as a host/port separator, a comma ( ,) is the preferred method.
RETURN VALUES
Returns a positive mSQL link identifier on success, or FALSE on error.
SEE ALSO msql_pconnect(3), msql_close(3).
PHP Documentation Group MSQL_CONNECT(3)
Can any one help me how to pass the value of result of one query to another query.
I to pass the value of result of 'select max(id) from a' into another query
like
update table
set col =<value from last query>
where ....;
updatestaging()
{
xx=`$ORACLE_HOME/bin/sqlplus -s... (1 Reply)
Hi All,
I have a txt file which is an export of a query result from the database. The txt file contains 'Processid#sqlquery' from the database table.As the sqlquery is too long.... i am unable to get the fields seperated using the awk script as below:-
cat sql.txt | awk -F'#' '{printf $2}'... (2 Replies)
I am executing a SQL query in Unix Server:
select status,location from user_information where request_id='DS-43720'
In shell script I am writing this query in the below manner:
echo "select status,location from user_information where request_id='DS-43720' ;" >> $directory/info.sql
... (3 Replies)
Hello Guys,
I'm new to Shell scripting, and i need someone to help me with this issue:
I'm trying to do a dynamic update query on Sysbase database table using shell script.
Lets say, the Update query is "update Table set id=X" , where X is dynamic value for the loop index.
If the loop is... (10 Replies)
Hi friends,
I have written a script which retrieves one value from the database.
It takes time for the sql query to get the desired output. So the query runs fine from TOAD or from UNIX console.
However if I put this in a script it doesn't work. The script is as below.
#! /bin/ksh... (2 Replies)
how to convert the result of the select query to comma seperated data and put in a .csv file using korn shell.
Pls help me as its very urgent.
Thanks,
Hema. (1 Reply)
Hi Friends,
I have one query which is returning a string value. So how can I append this string into a new file?
The query is like this,
stringvalues =`echo "set isolation to dirty read; select \"ZZZ\", \
account_id,date \
from accounts where... (1 Reply)
i would like to know how can i fine tune the following query since the cost of the query is too high ..
insert into temp temp_1 select a,b,c,d from xxxx
.. database used is IDS.. (1 Reply)
Hi all,
In my concern they gave a task to me do cran job like
To write a shell script for
To connect a database
it should execute a query
it should save the output of the query
after getting the output it should send a mail to you inbox for every one hour
I can able to... (8 Replies)
I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error:
ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
HI,
I want to connect to database and fetch the count from a table.
The sql query is as below :
select count(*) from table_test where test_column='read';
How can I print the output of this statement using shell script.
Thanks in advance. (4 Replies)
I have a script in which i connect to database to run a query and get the result of the query to a temp file. This works fine , now what i want is there is flat file which contains the value to be used in the query. I want to read this file line by line and then run the query for each value in that... (7 Replies)
I have tried executing one particular query through perl.But I am unable to get the result. When I tried to execute the sysdate query its working when I executed my perl code.
The below query doesn't work.
QUERY 1:my $sql ="select name from tab where rownum <6";
Received ora error... (23 Replies)
Hi All,
I tried creating a soft link with the file itself. It got created successfully.
bash-3.2$ ls -l a
lrwxrwxrwx 1 ebrigup other 1 Oct 5 19:14 a -> a
bash-3.2$
Can anyone explain what is the possible use of it. I dont see any except practically wasting an inode... (2 Replies)
Hi All
I need to run a query on a remote database through a shell script. I have the query, I have the script ready. I have the details of the database server I need to connect to.
Now my problem here is , the server where I run the shell script is an FTP server.
->I do not have Oracle... (4 Replies)