function Fdbd_getRow($tbl, $where) { try { Fcom_setLogInfo("debug", "where:" . $where); return Fdbd_getTableData($tbl, "*", $where); } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage()); } }
function Fitm_search() { try { $ret = "test"; if (false === isset($_POST["key"])) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):invalid param'); } $ttl = $_POST["key"]; $ret = Fdbd_getTableData("tb_item", "*", "title='" . $ttl . "'"); return $ret; } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage()); } }
function Fitm_getConts($id) { try { $item = Fdbd_getTableData("tb_item", "*", "id=" . $id); $type = Fdbd_getTableData("tb_itemtype", "*", "typeid=" . $item["typeid"][0]); $tagchk = Fdbd_getTableData("tb_itemtag", "*", "itemid=" . $id); $tag = array(); foreach ($tagchk["tagid"] as $tagid) { $tag_buf = Fdbd_getTableData("tb_tag", "*", "tagid=" . $tagid); $tag[] = $tag_buf["tag"][0]; } $ret_val = array("title" => $item["title"][0], "tag" => $tag, "type" => $type["type"][0], "conts" => $item["conts"][0], "desc" => $item["desp"][0]); return $ret_val; } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '() path:' . $path . PHP_EOL . $e->getMessage()); } }
function Fitm_setItemTag($itemid) { try { if (false === isset($_POST['tag'])) { return; } $ptag = $_POST['tag']; foreach ($ptag as $t_elm) { $tag = Fdbd_getRow(DITM_TBNAME_TAG, "tag=\"" . $t_elm . "\""); if (null === $tag) { Fdbd_insert(DITM_TBNAME_TAG, array("tag" => $t_elm)); $max = Fdbd_getTableData(DITM_TBNAME_TAG, "max(tagid)", "tag=\"" . $t_elm . "\""); $tagid = $max["max(tagid)"][0]; } else { $tagid = $tag["tagid"][0]; } $t_dat = array("itemid" => $itemid, "tagid" => $tagid); Fdbd_insert(DITM_TBNAME_ITMTAG, $t_dat); } } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage()); } }
<?php require_once dirname(__FILE__) . "/Sdbd_mysql.php"; try { //$test = Fdbd_getTableData( "tb_itemtype" , "type=\"command\"" ); //$test = Fdbd_getTableData( "tb_item" , "max(id)" , "title=\"fdsaf\" and typeid=3 and conts=\"fadsfd\"" ); // $test = Fdbd_getRow( "tb_tag" , "tag=\"test\"" ); $test = Fdbd_getTableData("tb_item", "distinct title", null); var_dump($test); $dat = array("title" => "test", "typeid" => 3, "conts" => "contents", "desp" => "test"); //Fdbd_insert( "tb_item" , $dat ); } catch (Exception $e) { echo $e->getMessage(); }
<?php require_once dirname(__FILE__) . "/../com/dbd/Sdbd_mysql.php"; try { var_dump(Fdbd_getTableData("tb_item", "*", "id=1")); } catch (Exception $e) { echo $e->getMessage(); }