[function.file]: failed to open stream: No such file or directory
Posted on
16th Feb 2014 07:03 pm by
admin
Okay I wrote this little script to upload a csv file that is located on my webhosts server to a mysql database. Something is wrong because I am getting the following error:
Warning: file(./html/beer/uploads/filename.csv) [function.file]: failed to open stream: No such file or directory in /home/content/d/l/a/dlanden/html/beer/uploads/upload_csv_mysql.php on line 12
insert into sunocoimport values ('')
Column count doesn't match value count at row 1
I did a syntax check and everything checked out. Here is the code:
$fcontents = file ('./html/beer/uploads/filename.csv');
# expects the csv file to be in the same dir as this script
for($i=0; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);
$arr = explode(",", $line);
#if your data is comma separated
# instead of tab separated,
# change the 't' above to ','
$sql = "insert into sunocoimport values ('".
implode("','", $arr) ."')";
mysql_query($sql);
echo $sql ."
n";
if(mysql_error()) {
echo mysql_error() ."
n";
}
}
?>
I am a newbie so any advice would be appreciated!
No comments posted yet
Your Answer:
Login to answer
205
46
Other forums
problem with script manager
Hi iam using Net.2005.I have created ajax enabledwebsite.i have master page in which i have script m
Unable to customise toolbar in FCK
Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to
How to show the difference between two data field in a database with php.
Hello php gurus,
how r u all... i'm not so well facing a typical problem please help me...<
MySQL Primary key gap
Alright, so I have a table with 26 entries in it (id, filename, caption) for my image randomiser (ht
insert quotes
Hi,
I have an output like this:
Code: john,18,Cancer
How can I change this to
Code:
ME54/ME54N Conditional check for Release of PR
Hi Gurus,
My requirement is to put a check on the release of the PR with respect to the c
$_POST
Hi, I have 2 seperate php files, and i want my $_POSt["fname"] To go into both of them, Fo
code help - pagination
Hi all, I have this code, basically a user logs into my site and they get this page.
The pro
Help with explandable category tree
I have the below query:
SELECT l1.id as lev1_id,l2.id as lev2_id,l3.id as lev3_id,l1.categ