Jump to content

MySQL query results to PHP ?


tweakui

Recommended Posts

Hello,

 

This is query in MySQL

 

 

mysql> LOAD DATA LOCAL INFILE '/var/www/html/numbers.csv' INTO TABLE details FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (number);

Query OK, 0 rows affected (0.00 sec)

Records: 2200 Deleted: 0 Skipped: 1200 Warnings: 0

Now, I am trying to run the same query in PHP and display the same results.... (i.e. Records, Deleted, Skipped)

 

<?php

$db=mysql_connect("localhost", "user", "1234") or die(mysql_error());

$dname="database";

mysql_select_db($dname)or die(mysql_error());

$sqlstatement="LOAD DATA LOCAL INFILE '/var/www/html/numbers.csv' INTO TABLE details FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (number)" ;

mysql_query($sqlstatement) or die(mysql_error());;

echo "it is done!";

?>

 

Tried mysql_fetch_array, row but could not get it to work... please help guys

Link to comment
https://forums.phpfreaks.com/topic/215629-mysql-query-results-to-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.