Re: syntax help
| From: | Richard Davey | Date: | Fri, 13 Feb 2004 12:17:36 +0000 |
| Subject: | Re: syntax help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177592@lists.php.net to get a copy of this message | ||
Hello bob,
Friday, February 13, 2004, 12:10:06 PM, you wrote:
bp> $array=array("Flyer","Email","Phone");
bp> $array_len=count($array);
bp> for($i=0;$i<$array_len;$i++){
bp> $query="select count(score) from test_table
bp> where source = '$array[$i]'";
bp> $result=mssql_query($query,$numero);
bp> $row=mssql_fetch_row($result);
bp> $array[$i].total=$row[0];<-- problem here
bp> }
$array[$i]['total'] = $row[0];
Alternatively, you can probably do this too:
$query = "SELECT COUNT(score) AS hits FROM ...";
$result = mssql_query($query, $numero);
$array[$i]['total'] = mssql_result($result, 0, "hits");
Same end result, but saves on processing a bit. This assumes MSSql has
the same functions available as MySQL does (the mssql_result part)
--
Best regards,
Richard mailto:rich@launchcode.co.uk