Add Category ...

%s

\n", $ERRMSG); fatal(""); } if (msqlSelectDB($sock,"contacts") < 0) { printf("

%s

\n", $ERRMSG); fatal(""); } if ($del_nmbr!="") { if (msqlQuery($sock, "delete from $user where nmbr=$del_nmbr")<0) { printf("

%s

\n", $ERRMSG); fatal(""); } } $vc=""; $vf=""; if ($ctcg=="OK") { if ($new_cat=="" && $new_full=="") { echo("You should specify CATEGORY and FULLL DESCRIPTION.
\n"); } else { if (#$new_cat!=3) { echo("

"); echo("CATEGORY length should be 3 characters. \n"); echo("

"); $vc=$new_cat; $vf=$new_full; } else { if (#$new_full>30) { echo("

"); echo("DESCRIPTION field should be less than 30 characters long. \n"); echo("

"); $vc=$new_cat; $vf=strseg($new_full, 1, 30); } else { if (msqlQuery($sock, "INSERT INTO $user VALUES($next_nmbr,'$new_cat','$new_full')") < 0) { printf("

%s

\n", $ERRMSG); fatal(""); } } } } } echo("
\n

\n"); if (msqlQuery($sock, "select nmbr, code, full from $user order by nmbr")<0) { printf("

%s

\n", $ERRMSG); fatal(""); } $res=msqlStoreResult(); $row=msqlFetchRow($res); echo(" "); $next_nmbr=1; if (#$row > 0) { $n = 0; while(#$row > 0) { if ((int)$row[0] != 1) { $n = $n + 1; if ($next_nmbr<=(int)$row[0]) { $next_nmbr=(int)$row[0] + 1; } if ($n<6) { echo("
$n.\n | $row[1] \n | $row[2]
\n"); } else { echo("
$n.\n | $row[1] \n | $row[2]
\n"); } } $row=msqlFetchRow($res); } msqlFreeResult($res); } $n=$n + 1; echo(""); echo(""); echo("
$n."); echo(" | \n"); echo(" \n"); echo(" | "); echo("
\n"); echo("
| \n"); echo(" |
\n"); echo(" "); >