PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$db_username="root"; //database user name
$db_password="";//database password
$db_database="example"; //database name
$db_host="localhost";
mysql_connect($db_host,$db_username,$db_password);
@mysql_select_db($db_database) or die( "Unable to connect to database.");
$handle = fopen("SMS.xls", "r"); //test.xls excel file name
if ($handle)
{
$array = explode("\n", fread($handle, filesize("SMS.xls")));
}
$total_array = count($array);
$i = 0;
while($i < $total_array)
{
$data = explode(",", $array[$i]);
$sql = "insert into excel values ('$data[0]')"; // i have two fields only , in oyour case depends on your table structure
$result = mysql_query($sql);
$i++;
}
echo "completed";
?>
Hi, when im running the script the im getting some data with symbols,the data is inserting but im not getting the correct that that i need
kindly help me on this