Reply to Re: textarea selection

Your name:

Reply:


Posted by Mahmoud Babli on 10/12/06 16:23

Lucas Byers wrote:
> Hey all,
>
> I'm trying to create a php tool for local use where I put a
> list of words (one on each line) in to a textbox and it takes each word
> and creates an entry in an sql table.
>
> So I'd put
>
> hey
> ho
> whats
> up
> yes
> no
> maybe
>
> and it'd go through each word and create a seperate entry so 1 for hey,
> 1 for ho, and so on.
>
> Is there a way to
>
> a) get how many rows there are in to php?
> b) select each row and grab it's contents?
>
> Thanks for your time.
>

I assume you are looking for something like this:

function readFileToDB($file)
{
if(!$fp=@file($file)) //$fp is an array of each line in $file
{
echo "FAILED-LEVEL-1";
exit;
}
for($i=0; $i<count($fp); $i++)
{
if(!$dp=sqlOperationInsert($fp[$i])
{
echo "FAILED-LEVEL-2";
exit;
}
}
echo "SUCCESS";
}

function sqlOperationInsert($data)
{
// insert into database.
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация