|
Environment: php5 windows2003 IIS with fastCGI Code: <?php $p = "i:\\tmp"; if( file_exists($p) ) { print $p . ' exists!'; } else { print $p . ' not exists!'; } ?>
Started by madcat on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Also note that the File_Exists caches....
Literal, don't forget that backslashes introduce escape sequences:
file_exists("D:\rip\this\nipple then File_Exists will always return FALSE for files inaccessible due to safe mode restrictions.
|
|
If I do a Create Table If Not Exists , and a table with the same name exists with fewer rows (or columns), what would happen?
Started by Marin on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The table will not be created if a table with the same name already exists regardless of table layout..
If the "IF Not Exists" clause fails, the rest of the create is skipped.
Nothing.
|
|
Edit: using SQL Server 2005.
I have a query that has to check whether rows from a legacy database have already been imported into a new database and imports them if they are not already there. Since the legacy database was badly designed, there is no ...
Started by Dennis on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If I had to guess, I'd say t1.printed....
If there's no indexes its likely doing multiple full table scans .
That should show you where the database is chewing up its time .
Not knowing what the schema looks like, your first step is to EXPLAIN those sub-queries .
|
Ask your Facebook Friends
|
Is there an easy way to INSERT an row when not exists, or to UPDATE if it exists, using one MySQL query?
Started by blub on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
For example:
INSERT INTO `usage` (`thing_id`, `times_used`, `first_time_used`) VALUES (4815162342, 1, NOW()) ON DUPLICATE KEY UPDATE `times_used` = `times_used` + 1
http://dev.mysql.com/doc/refman/5.0/en/replace... .
ON DUPLICATE KEY UPDATE.
Yes, INSERT ...
|
|
I need to be able to tell if an image exists in a directory or not. Given the file name and the directory, how can I tell if it exists?
Thanks!
Started by John Isaacks on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Filename does not exist"; } ?>
Source: http://in.php.net/file_exists
You are talking about imagefile_exists($filename);
http://www.php.net/file_exists
$dir = '/var/img/'; $name = 'img.jpg'; echo is_file($dir.$name);
....
|
|
How can I check if mysql table field even exists ?
The column name is 'price' and I need to see if it exists.
Haven't understood really how the 'EXISTS' works...
Any examples or ideas ?
Thanks
Started by Camran on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Desc ....
In PHP:
$fields = mysql_list_fields:
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ‘TEST’ AND COLUMN_NAME = ‘TEST_DATE the column in your table.
Column 'price' in 'field list'
then it does not exists.
|
|
Hello,
How do I check if an URL exists and not 404 in PHP
Thanks Jean
Started by Jean on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Headers[0] == 'HTTP/1.1 404 Not Found') { $exists = false; } else { $exists = true; }
From here: http, there's a curl solution:
function url_exists($url) { if (!$fp = curl_init($url)) return false; return true] == 'HTTP/1.1 404 Not....
|
|
Hiya All,
I've always used the method of checking a table to see if a row exists, and then update it with my new data or insert it if it doesn't exist, but it's got me thinking what would be wrong with simply doing an update, if no rows are effected, ...
Started by Shadi Almosri on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
But it allows....
Statement does the same thing, if a row doesn't exist it will insert it, if it exists it will updateHi,
If by "see if a row exists" you mean by primary key, you might be interested by 12.2.5.3., it updates the line...
|
|
I know this must be simple, but how do I preface the creation of a function with a check to see if it already exists? If it exists, I want to drop and re-create it.
Started by David Stein on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
IF EXISTS (SELECT * FROM sys....
In sysobjects
IF EXISTS (SELECT * FROM sysobjects WHERE name='<function name>' and xtype='FN'
Actually, if the function could be a table function, you need to use
xtype in ('FN','TF')
IF EXISTS.
|
|
How do I check if a column exists in SQL Server 2000?
Answer Snippets (Read the full thread at stackoverflow):
SELECT count(*) AS [Column Exists.
IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='tablename' AND COLUMN_NAME to check if the field exists or not and run the query below.
|