Error with mysql_num_rows

admin

Administrator
Staff member
I'm trying to add a csv file to mysql, which is working fine. However when I try to
retrieve the results back from mysql I get an error. Here is my code below.

$sql = "LOAD DATA LOCAL INFILE
'C:/Xitami/webpages/epdsite/csv/$path'
INTO TABLE `$table`
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'";

$result = mysql_query($sql);

if (mysql_num_rows($result) > 0) {
echo "categoryId = $A_R[0]";
echo "category = $A_R[1]";
}
else {echo "No data in record set";}

I get the following error:

Warning: Supplied argument is not a valid MySQL result.
It also says "No data in record set" and yet when I view the database using phpmyadmin, it
shows the csv file has been uploaded.

Can anyone help me????
 
Back
Top