PHP concat funtion (JAVA)

Site Index


ヘッダー操作部




<table>
<tr>
<td>
<input type="text" name="text_g3code" style="width:25px;" value=<? echo $p_g3code; ?>>
<input type="text" name="text_g4code" style="width:25px;" value=<? echo $p_g4code; ?>>
<input type="text" name="text_g5code" style="width:25px;" value=<? echo $p_g5code; ?>>
<input type="text" name="text_g5name" style="width:200px;" value=<? echo getname($p_g3code,$p_g4code,$p_g5code); ?>>
</td>
<td>
<input type="button" style="width:100px;height:32px;" value="前の商品" onclick="JFC_prev('<? echo $p_g3code; ?>','<? echo $p_g4code; ?>','<? echo $p_g5code; ?>')">
<input type="button" style="width:100px;height:32px;" value="次の商品" onclick="JFC_next('<? echo $p_g3code; ?>','<? echo $p_g4code; ?>','<? echo $p_g5code; ?>')">
</td>
<td>
<input type="text" name="text_date01" style="width:80px;" value=<? echo $date01; ?>>
<input type="text" name="text_date02" style="width:80px;" value=<? echo $date02; ?>>
</td>
<td>
<input type="button" style="width:200px;height:32px;" value="ジャンル選択へ戻る" onclick="JFC_jump('<? echo $p_g3code; ?>','<? echo $p_g4code; ?>','<? echo $p_g5code; ?>')">
</td>
</tr>
</table>

JAVA function




<script>
function JFC_jump(p_g3code,p_g4code,p_g5code){
if (confirm("コード入力に戻ります")==true)
location.href = "calendar-index.php?text_g3code=" + p_g3code + "&text_g4code=" + p_g4code + "&text_g5code=" + p_g5code;
}
function JFC_next(p_g3code,p_g4code,p_g5code){
if (confirm("次の商品表示(コード順)")==true)
location.href = "calendar-list-next.php?text_g3code=" + p_g3code + "&text_g4code=" + p_g4code + "&text_g5code=" + p_g5code + "&next=next";
}
function JFC_prev(p_g3code,p_g4code,p_g5code){
if (confirm("前の商品表示(コード順)")==true)
location.href = "calendar-list-next.php?text_g3code=" + p_g3code + "&text_g4code=" + p_g4code + "&text_g5code=" + p_g5code + "&next=prev";
}
</script>

PHP function




<?
function getname($g3,$g4,$g5){
$g5name="----";
$sql = "select * from tb_gr5mst";
$sql .= " where g3code = '".$g3."'";
$sql .= " and g4code = '".$g4."'";
$sql .= " and g5code = '".$g5."'";
$result = mysql_query($sql);
if ( $result == $FALSE ) {
echo "MySQLDBエラー<br>";
die($sql);
}
$num = mysql_num_rows($result);
for ($idx=0; $idx<$num; $idx++) {
$row = mysql_fetch_array($result);
$g5name = $row[G5Name];
}
return $g5name;
}
?>

strtotime




$firstDate = mktime( 0, 0, 0, date("n"), 1, date("Y"));//今月の1日
$date01 = date("Y/m/d", $firstDate);
//先月より表示
$date01 = date("Y/m/d", strtotime($date01 . "-1 month"));
$nissuu = 63;
$date02 = date("Y/m/d", strtotime($date01 . "+" . $nissuu . " day"));

concat




$w_g345 = $p_g3code . $p_g4code . $p_g5code;
$sql = "select * from tb_gr5mst";
if ($p_next=='next'){
$sql .= " where concat(g3code,g4code,g5code) > '".$w_g345."'";
$sql .= " order by concat(g3code,g4code,g5code)";
} else {
$sql .= " where concat(g3code,g4code,g5code) < '".$w_g345."'";
$sql .= " order by concat(g3code,g4code,g5code) desc";
}




AX