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!
How to sum these output values
Hi
Something like an INI editor or a DelimitedText-Editor
Hi all,Am very, very, very new to PHP and not sure if I should be posting this to a Javascript or PHP forum so I posed the question on both FORUM.Basically, I am looking for something like an INI
Please help understand this code
I noticed the index page on my site was modified this morning and found this code inserted at the bottom of the page:Code: <!--ddgbsre_erd_sdd--><?php
Packet Design
Hi All,Im new about network programming and I want to design a protocol but I have some questions about packet desing. For example I wanna do a sturct to send informations like that ;struct info {
reating a background image
I am building a site in drupal and have a php form in it, due to certain annoyances with module building I need to generate a background image and margin for my form in PHP and, whilst i imagine this
Call Screen statement Error
Dear Experts,
Gaining access to Drop Down Menu Variable
code is below, I am creating a drop down menu. I want to echo the value selected in the drop down menu in the php file that is executed afterwards. when I echo frmcounty in the php file it returns
Just cannot get 'area' to submit to db using same php code as already used
Basically all i have done is just modified some code and added an area section.The form is allready submitting other things like location price etc.And i have simply added a field in db called area
A Few Questions
Hi, I want to ask a few questions that I can't seem to find..1) I'm creating a "shortcut" system on my website, where users can add shortcuts from pages by clicking the link and it will
Refining of search Criteria
Dear FriendsI need a help, I have a search page which of cars related, which has different search criteria e.g. maker, model, color, displacement etc. when i give any search criteria and click the