// Check for an invalid record length
if(count($data) != $RECORD_LENGTH) {
if(count($data) < $RECORD_LENGTH) {
$badMsg[] = 'Record '.$cnt.' contains too few fields.';
}
if(count($data) > $RECORD_LENGTH) {
$badMsg[] = 'Record '.$cnt.' contains too many fields.';
}
$badCnt++;
continue;
}
// Record length is ok at this point so validate each field we care about
if(!empty($data[0]) && !is_numeric($data[0])) {
$badMsg[] = 'Record '.$cnt.' , supplier_id must be a number';
$badCnt++;
continue;
}
// if(!strlen($data[2])) {
// $badMsg[] = 'Record '.$cnt.' , service name (i.e. Broadband) must be entered';
// $badCnt++;
// continue;
//}
// if(!strlen($data[4])) {
// $badMsg[] = 'Record '.$cnt.' , service type (i.e. Residential, Business) must be entered';
// $badCnt++;
// continue;
// }
// Ensure that our float and binary fields have values
$binary = array(9, 20, 19 );
$float = array(10, 11, 12, 13, 14, 15, 16, 17, 18 );
$updateCnt = 1 should be 0, no? Yeah, I would say that is definitely what is causing your problem.
I changed this and I am still presented with the error:
Notice: Undefined offset: 26 in /var/www/SITENAME/htdocs/classes/admin_classes/SCRIPT.php on line 3087
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Mbps, No, Free, , 0,' at line 34
Its not just this line either. Its every line that is being imported into the DB.
Last edited by cenibyte; 11-04-2009 at 01:51 PM.
Reason: Information addition
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I agree with jasonahoule....did you change BOTH lines where $updateCnt = 1?
Judging by the fact that you are 'still' presented with an undefined offset of 26, I say you didn't because the offset would only go as high as 25 if you changed it in both places.
EDIT: That probably wouldn't work as it appears your first line is a supplierid.......did you write this script? Can you access any csv file that this application is supposed to be processing so we can have a look at it?
Last edited by aj_nsc; 11-04-2009 at 02:33 PM.
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
I agree with jasonahoule....did you change BOTH lines where $updateCnt = 1?
Judging by the fact that you are 'still' presented with an undefined offset of 26, I say you didn't because the offset would only go as high as 25 if you changed it in both places.
EDIT: That probably wouldn't work as it appears your first line is a supplierid.......did you write this script? Can you access any csv file that this application is supposed to be processing so we can have a look at it?
I changed both update lines to '0' and I'm presented with this now for every line being updated in the DB:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' XXX, XXXXXXX , XXX, ' at line XX
That probably wouldn't work as it appears your first line is a supplierid.......did you write this script? Can you access any csv file that this application is supposed to be processing so we can have a look at it?
Yes I did write this script and here is a .csv import example of the data being processed:
The values need to be quoted within the SQL string (if they are not numeric).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
The values need to be quoted within the SQL string (if they are not numeric).
Didn't work. Output below:
Error 1:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''service_name', 'connection_type', 'service_type', 'download_s' at line 4
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''service_name', 'connection_type', 'service_type', 'download_s' at line 4
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''service_name', 'connection_type', 'service_type', 'download_s' at line 4
All I can suggest at this point is to output the query string along with the error message so that you can see exactly what was sent to the DB. (You can even copy-and-paste it then if you want to try it from phpMyAdmin or the MySQL command line.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
The error message for number 2 doesn't match the sql from your script. The message shows the fields with single quotes around them, even though the script doesn't add them. Did you forget to save the script before you ran it?
Don't use quotes, single or double, around field names.
Bookmarks