Explode database array PHP

arrays, explode, php

Solution

function words() {
        $query = mysql_query("SELECT text FROM table WHERE textID = 1");
        while($row = mysql_fetch_array($query)) {
            $e[] = explode(" ", $row[0]);
            foreach($e as $r) {
                echo $r;
            }
        }
    }

$row is array. Choose first element to explode. Read documentation for Explode.

Problem

I'm trying to breakdown a paragraph, retrieved from a database array, into separate words. Is this the right way to go about doing it because it is currently giving an error saying explode() expects 2 parameters, so it must not be picking up the $row array. ``` function words() { $query = mysql_query("SELECT text FROM table WHERE textID = 1"); while($row = mysql_fetch_array($query)) { $e[] = explode(" ", $row); foreach($e as $r) { echo $r; } } } ```

Original source