window.location='news.php'"; exit(); } $sql = "select * from news where n_id = '$n_id' limit 1"; $result = mysql_query($sql) or die("$sql error"); $row = mysql_fetch_array($result); $n_topic = $row["n_topic"]; $n_detail = $row["n_detail"]; $n_topic = str_replace("
","\n", $n_topic); $n_detail = str_replace("
","\n", $n_detail); $n_date = $row["n_date"]; //$n_date = strtotime($n_date); //$n_date = date('d/F/Y',$n_date); /*$n_date_array = explode("/",$n_date); $n_date = $n_date_array[0]; $n_mon = $n_date_array[1]; $n_year = $n_date_array[2]; */ $n_date = ChangeDateShot($n_date); $p = 0; $sql = "select * from news_image where n_id = '$n_id' order by p_id asc"; $result = mysql_query($sql) or die("$sql error"); while($row = mysql_fetch_array($result)){ $allthumb[$p] = $row["p_thumb"]; $allimg[$p] = $row["p_image"]; $p++; } if(sizeof($allimg) >= 3){ $all_size = sizeof($allimg) -1; $num1 = rand(0, $all_size); $num2 = rand(0, $all_size); while($num2 == $num1){ $num2 = rand(0, $all_size); } $num3 = rand(0, $all_size); while($num3 == $num1 or $num3 == $num2){ $num3 = rand(0, $all_size); } /*echo "$num1 $num2 $num3"; exit();*/ $thumb1 = $allthumb[$num1]; $thumb2 = $allthumb[$num2]; $thumb3 = $allthumb[$num3]; $img1 = $allimg[0]; $img2 = $allimg[1]; $img3 = $allimg[2]; } if(sizeof($allimg) == 2){ $thumb1 = $allthumb[0]; $thumb2 = $allthumb[1]; $img1 = $allimg[0]; } if(sizeof($allimg) == 1){ $thumb1 = $allthumb[0]; $img1 = $allimg[0]; } if(sizeof($allimg) == 0){ $thumb1 = ""; $img1 = ""; } /*$n_date = str_pad($n_date,1); $n_mon = str_pad($n_mon,1);*/ ?>



คลิกที่ภาพเพื่อดูรูปทั้งหมด