Team,
I have a script that uploads a CSV file into a MySQL database. In this CSV file is a column of two sets of numbers. Ex: 48 / 54.
There are times when this set of numbers is 06 / 54 and interpreted by the spreadsheet creating the CSV as a date (06/01/54).
I need a way to determine of this field of data is set up like a date, and if so to remove the middle set (/01) or (01/) so my end result is 06 / 54
This line is for TxRxMBPS, line_of_data[4]
Code below.
[CODE]
while (($line_of_data = fgetcsv($file_handle, 1000, “,”)) !== FALSE) {
$line_import_query=”
INSERT into bridges (
MAC,
DeviceName,
SignalNoiseDBM,
Distance,
TxRxMbps,
CCQ,
ConnectionTime,
LastIP,
ComputerName,
ExpectedRig
) VALUES (
‘”.mysql_real_escape_string($line_of_data[0]).”‘,
‘”.mysql_real_escape_string($line_of_data[1]).”‘,
‘”.mysql_real_escape_string($line_of_data[2]).”‘,
‘”.mysql_real_escape_string($line_of_data[3]).”‘,
‘”.mysql_real_escape_string($line_of_data[4]).”‘,
‘”.mysql_real_escape_string($line_of_data[5]).”‘,
‘”.mysql_real_escape_string($line_of_data[6]).”‘,
‘”.mysql_real_escape_string($line_of_data[7]).”‘,
‘”.mysql_real_escape_string($compname).”‘,
‘”.mysql_real_escape_string($ExpectedRig).”‘
)
“;
mysql_query($line_import_query) or die(mysql_error());
}
I appreciate your help