function createUri($name, $table, $field) { //=============BASE NAME $s = uriName($s); $basename = $s; //====CHECK NUMBERING======== $ok = FALSE; while ($ok == FALSE) { $sql = "select count({$field}) c from `{$table}` where `{$field}` like '{$basename}'"; $row = queryFetch($sql); if ($row['c'] == 0) { $uriName = $basename; $ok = TRUE; } else { $sql = "select count({$field}) c from `{$table}` where `{$field}` like '{$basename}%'"; $row = queryFetch($sql); $uriName = $basename . "_"; if (isset($counter)) { $counter++; $uriName .= $counter; } else { $uriName .= ++$row['c']; $counter = $row['c'] + 1; } $sql = "select count({$field}) c from `{$table}` where `{$field}` like '{$uriName}'"; $row = queryFetch($sql); if ($row['c'] == 0) { $ok = TRUE; } } } return $uriName; }
function tutorShowUri($uri) { $sql = "select tlist_name name, tlist_prev preview, tlist_uri uri, ttext_detail detail,\n\tttext_code code\n\tfrom nasgor_tutoriallist, nasgor_tutorialtext where\n\tttext_list=tlist_id and tlist_uri like '{$uri}'"; return queryFetch($sql); }
<?php loadMod('tutor_mod'); $id = 1; $sql = "select * from nasgor_tutorial"; $row = queryFetch($sql); ?> <h1><?php echo $row['tutor_name']; ?> </h1> <h3><?php echo $row['tutor_detail']; ?> </h3> LIST CONTENT:<dl> <?php $aTutor = listTutor($id); foreach ($aTutor as $row) { ?> <dd><a href='<?php echo my_url(); ?> read/<?php echo $row['tlist_uri']; ?> ' class='btn'><?php echo $row['tlist_name']; ?> </a></dd> <?php