|
Posted by Moot on 10/12/06 18:32
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.
Simply do an explode on newlines to get the lines into an array, then
process the array into sql however you see fit.
$myArray = explode("\n",$_POST['myTextArea']);
foreach($myArray as $line){
$line = trim($line);
//do some sql stuff here
}
Navigation:
[Reply to this message]
|