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!
Multiple PHP errors when clicking a link..and..removing a ghost..
Hi - I have 2 problems with a new website - homeswapvacations.com, which I need help solving.The first problem - In the left column (on all pages) is "Featured Listing" column (in the admin
unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_
Can anyone view my code and tell me why im getting the error:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in
Production Order Enterprise Service to Manufacturing Exctn Sys (MES) ???
Hello Experts,
Passing JS to PHP
So I have the followingCode: <?phpgetdetails(?><script type="text/javascript">document.write(jsvariable)</script><?php );?>The idea is
url- go to webpage
i have an input text field and submit button.how do i make the url entered into the textfield go to that webpage?
Array help
Hello i got this code to fetch data from database but it is not working it displays7ArrayArrayArrayArrayArrayArrayCode: if (isset($_POST['showrecord'])){ $query='SELECT * FROM artus_test';
Memory Allocation
Hi folks,see this ex:int v=5;v=v+10;then what will do the compiler before the output come as 15.Please explain me technically.
Display last record first.
I need some help how put the last record first and first record last.ThanksCode: <?phpinclude("connect.php");$query="SELECT * FROM MyNotes ";$result=mysql_query($query);$num
Reading Most Recent CSV File in Directory
I thought I had wrapped this project up, but found out that the program I use to FTP a csv file to my website is best used in time stamp mode. That is, each day a newly named csv file is uploaded with
Files in current folder. Should be an easy fix.
Never mind. I've asked about this before and just found my answer. Anyway to delete this?