The following is a query results stored in $performset.
$sqlperform = $ilance->db->query("
SELECT
q.title_per
FROM " . DB_PREFIX . "perform q
LEFT JOIN " . DB_PREFIX . "perform_answers a ON (q.cid = a.cid)
WHERE a.user_id = '" . $res_vendor['user_id'] . "'
");
if ($ilance->db->num_rows($sqlperform) > 0)
{
while ($rows = $ilance->db->fetch_array($sqlperform))
{
$perform .='<li>'.$rows['title_per'].'</li>';
}
$performset .='<ul>'.$perform.'</ul>';
}
echo
The values i get from particular variable are
Adobe Flex, C++ Builder, C#/.Net, C/C++/Unix, C/C++/Win32SDK, Oracle DBA,
Data Entry,
The out put I have got form this is
Adobe Flex, C++ Builder, C#/.Net, C/C++/Unix, C/C++/Win32SDK, Oracle DBA,
Data Entry, Oracle DBA, Adobe Flex ,C++ Builder, C#/.Net , Data Entry
C/C++/Unix, C/C++/Win32SDK
But the output I need is
Data Entry C++ Builder C/C++/Win32SDK
Oracle DBA C#/.Net
Adobe Flex C/C++/Unix
The html that works for this is as such
<ul>
<li>Data Entry</li>
<li>Oracle DBA</li>
<li>Adobe Flex</li>
</ul>
<ul>
<li>C++ Builder</li>
<li>C#/.Net</li>
<li>C/C++/Unix</li>
</ul>
How can i script it in php to produce such n number of results
Use of array_chunk() is perfect in this case.
Take a looks at this example, might looks complicated but might be how you need
TESTED, but For test, I used the following codes, which simulates the situation above