I urgently need someones help thats much smarter than me.
I have to create code that reads a field out of a database thats got 2900 clients, now each of them has completed a survey which has a question that requires them to list in order of preference 6 choices.
The database which I didnt create stores the values as follows, 5,3,4,6,1,2 per row. Now my predicament is that I have to read all those values out of the field into a form on which I have to report the most favoured value per "column" and get a percentage value in total and per grid code. Please pleae help. I only just started with PHP and can hardly count values. What do I do?
All that Ive tried ends up in endless loops, here is a small snippet of the code which is left, Ive deleted and started over so many times😕
$query = "SELECT trader_preferences FROM survey WHERE trader_preferences <> 0";
if (!$result = mysql_query($query))
die("<p>Could not load survey information!.</p><p>" . mysql_error() . "</p>$query</p>");
//$result = mysql_num_rows($query);
//echo mysql_num_rows($result);
$totRecs = mysql_num_rows($result);
$details = mysql_fetch_array($result);
$num = 1;
//do {
$trader_pref1 = explode(",",$details['trader_preferences']);
//echo $totRecs;
for ($count=0;$count<$totRecs;$count++)
for ($count=0;$count<count($trader_pref1);$count++)
echo $trader_pref1[$count];
//} while ( $num <= $totRecs);