YoungManRiver
IS-IT--Management
All,
Solved my dBase problem from:
only to find my list is unsorted. PHP manual says use "asort" or "ksort" but not having any luck. Please look at my code and let me know what is needed to get my sort working.
Solved my dBase problem from:
only to find my list is unsorted. PHP manual says use "asort" or "ksort" but not having any luck. Please look at my code and let me know what is needed to get my sort working.
Code:
<?php
require('db_connect.php');
$sql = "SELECT cli_cnm FROM client ORDER BY cli_cnm;";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$rw_vl_cl[] = $row['cli_cnm'];
}
$af = 'C:\ACT\myact.dbf'; //LapTop
$db = dbase_open($af, 0);
$outline[] = array();
$comp_list="";
$k = 0;
if ($db) {
$record_numbers = dbase_numrecords($db);
echo "G rec cnt => $record_numbers<br>";
for ($i = 1; $i <= $record_numbers; $i++) {
$row = dbase_get_record_with_names($db, $i);
foreach ($row as $key => $val) {
if ($key == 'COMPANY') {
if (!array_search($val, $rw_vl_cl)) {
if (!array_search($val, $outline[$k])) {
$k++;
$outline[$k] = array("comp" => $val,"rowno" => $i);
}
}
} /* end if($key) */
} /* end foreach */
} /* end for($i) */
} /* end if($db) */
dbase_close($db);
// asort($outline);
ksort($outline);
echo "Set count => $k";
for ($i = 1; $i <= $k; $i++) {
$rw = $outline[$i]['rowno'];
$vl = $outline[$i]['comp'];
$comp_list .= "<option value=$rw>$vl</option>";
}
?>
Thanks!
YMR