Jump to content

Recommended Posts

Hi all

 

I want to export a xls or csv file (which is having number of user details) into mysql database table. And i want to validate that xls file. That means i don't want to accept duplicate entries etc. How can i do this.

 

Can anyone send me scripts or url's.

 

Thanq

I  am trying to get data from xls file. But i am getting some garbage value. See this output.

 

nࡱ��nnࡱ�nࡱࡱࡱࡱࡱ�nࡱ�nࡱࡱ�nࡱࡱࡱ�nࡱ�nࡱ�nࡱࡱࡱ�nࡱ�

 

The above output i am getting when i execute the following program.

 

<?

// open the text file

$fd = fopen ("test.csv", "r");

// initialize a loop to go through each line of the file

while (!feof ($fd)) {

$buffer = fgetcsv($fd, 4096); // declare an array to hold all of the contents of each

//row, indexed

echo "n";

// this for loop to traverse thru the data cols

// when this is re-created with MySQL use the mysql_num_fileds() function to get

// this number

for ($i = 0; $i < 5; ++$i){

if ($buffer[$i] == ""){

$buffer[$i] = " ";

}

// print 's with each index

echo "$buffer[$i]n";

}

echo "n";

}

fclose ($fd);

?>

 

Please help me out

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.