07-05-2007
Two small queries
Query 1 : How to check if a directory already exists? If doesn't exist then
create a new one.
Query 2 : I want to put following text using a single echo statement into a
log file and also want to retain the formatting of the text. How it
can be done?
ewdvgw eqjhd fvgweqj hfweqf jkweg qfjweqf
bwdfjb wfjwb fwej fjewf wjefw ejfw efwe
fewfeff \jjjjjj eddwdwf wecfwd/
wewefwef wefwefwef 3eiouo23
edwewef ewfwefewe nbgfb
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Guys need some advice on how to check some of the questions below?
i'm running on an open VMS platform... which i am an idiot to...
appreciate if anyone can give some hints or source on how to check on..
a script that is running on cron job... but doesn't run as the login user name..
1. why... (6 Replies)
Discussion started by: 12yearold
6 Replies
2. Shell Programming and Scripting
hi guys
Well, i need to have a report generation script or any script which will show me all the content/information of a file when i run that script.
Please help me on this isssue at the earliest.As i am little bit aware of scripting.Thanks in advance!
regards
ash (4 Replies)
Discussion started by: whizkidash
4 Replies
3. Homework & Coursework Questions
Any help on like where to get started on this? I'm just confused.
1. The problem statement, all variables and given/known data:
Enter text here.Queries to satisfy these two report requests (use your CCI database):
Retrieve all rows of active inventory where current on hands is less than... (0 Replies)
Discussion started by: lakers34kb
0 Replies
4. Solaris
Dear All,
Please clarify my queries
My 1st doubt is as you know solaris have default 8 slices out of 8 slices in which slice the OS is stored. Like in windows if you select C drive the Program files are stored in C drive like that in solaris in which slice the OS is stored.
My 2nd doubt is... (2 Replies)
Discussion started by: suneelieg
2 Replies
5. Shell Programming and Scripting
One of the command output is as below.
-rw-r--r--+ 1 root root 75G Nov 21 16:43 /var/ovs/mount/86BXXX/running_pool/Machine1/System-sda.img
-rw-r--r--+ 1 root root 75G Nov 21 16:36 /var/ovs/mount/86BXXX/running_pool/Machine2/System.img
-rw-r--r--+ 1 root root 150G Sep 23 19:13... (2 Replies)
Discussion started by: pinga123
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
1) How to get exact permissions, group names for files while transferring with FTP
2) Is there any command to transfer entire directory and sub directories.
Thanks (1 Reply)
Discussion started by: nag_sathi
1 Replies
7. Red Hat
Hi,
I would like to know on one server how many mouting can be done? wheather there is limitation on number of mounting?
wheather it is possible to increase NFS Performance? if yes then which parameters needs to given while mounting? (3 Replies)
Discussion started by: manoj.solaris
3 Replies
8. Debian
Hello,
I am posting the following questions here because I need them answered by people who have actually done a lot of work in GRUB. DO NOT GIVE ME GUESS ANSWERS PLEASE. Feel free to redirect me if this is not the right place to ask these questions.
Can I download GRUB separately from... (6 Replies)
Discussion started by: sreyan32
6 Replies
9. IP Networking
Hey everyone,
I have a question, I've been playing around with tcpdump, and noticed my machine making numerous rdns look ups. They are displayed like:
10.80.80.141.51234 > 10.80.80.1.domain: 9950+ PTR? 223.114.55.65.in-addr.arpa. (44)
My question is, if dns works based on numerical... (0 Replies)
Discussion started by: Lost in Cyberia
0 Replies
LEARN ABOUT PHP
mysql_query
MYSQL_QUERY(3) 1 MYSQL_QUERY(3)
mysql_query - Send a MySQL query
SYNOPSIS
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should
be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
omysqli_query(3)
o PDO::query
mixed mysql_query (string $query, [resource $link_identifier = NULL])
DESCRIPTION
mysql_query(3) sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated
with the specified $link_identifier.
o $query
- An SQL query The query string should not end with a semicolon. Data inside the query should be properly escaped.
o $
link_identifier -The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect(3) is
assumed. If no such link is found, it will try to create one as if mysql_connect(3) was called with no arguments. If no connection
is found or established, an E_WARNING level error is generated.
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query(3) returns a resource on success, or FALSE on
error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query(3) returns TRUE on success or FALSE on error.
The returned result resource should be passed to mysql_fetch_array(3), and other functions for dealing with result tables, to access the
returned data.
Use mysql_num_rows(3) to find out how many rows were returned for a SELECT statement or mysql_affected_rows(3) to find out how many rows
were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.
mysql_query(3) will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.
Example #1
Invalid Query
The following query is syntactically invalid, so mysql_query(3) fails and returns FALSE.
<?php
$result = mysql_query('SELECT * WHERE 1=1');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
?>
Example #2
Valid Query
The following query is valid, so mysql_query(3) returns a resource.
<?php
// This could be supplied by a user, for example
$firstname = 'fred';
$lastname = 'fox';
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see mysql_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM friends
WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
// Perform Query
$result = mysql_query($query);
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>
mysql_connect(3), mysql_error(3), mysql_real_escape_string(3), mysql_result(3), mysql_fetch_assoc(3), mysql_unbuffered_query(3).
PHP Documentation Group MYSQL_QUERY(3)