|
 |
|
สอบถามหน่อยค่ะ ถ้าต้องการให้กดปุ่ม submit ก่อนเเล้วค่อยเรียกข้อมูลในดาต้าเบสมาโชว์ |
|
 |
|
|
 |
 |
|
ตอนนี้ กด Add เเล้วข้อมูลบันทึกลงดาต้าเบสได้เร่ะค่ะ
จะเก็บได้ ทั้ง user_member ทั้ง url เเต่ name_list ก็ยังไม่มาอยู่ดี ==
( เหมือนมัน ไม่มีค่าหรือยังไงไม่เเน่ใจ) T^T
ขอคำเเนะนำ เเนวทางวิธีการแก้ไขหน่อยค่ะ
ขอบคุณค่ะ
|
ประวัติการแก้ไข 2013-11-14 02:43:22 2013-11-14 02:44:25
 |
 |
 |
 |
Date :
2013-11-13 23:55:04 |
By :
chocozaa |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขั้นตอน add เป็นยังไงครับ แล้วไม่เอา code มาดูหน่อยหรอครับ จะได้ช่วยดูหรือแนะนำได้  
|
 |
 |
 |
 |
Date :
2013-11-14 03:22:09 |
By :
basic |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลืมๆเมื่อคืนเเก้ดึกไปหน่อยค่ะ ><
อันนี้หน้า create_list
Code (PHP)
<?php
include("config.php");
?>
</head>
<script language="javascript">
function fncSubmit()
{
if(document.form1.list_name.value == "")
{
alert('กรุณากรอกชือเพลย์ลิส');
document.form1.list_name.focus();
return false;
}
}
</script>
<form action=" chk_creat.php" method="post" name="form1" onSubmit="JavaScript:return fncSubmit();">
<?php
echo "<br><br>ชื่อ <input type='text' name='list_name' class='twitterStyleTextbox'><br><br/>";
?>
<input type="submit" name="ok" value="Ok"/>
<input type="reset" name="cancle" value="Cancle"/>
</form>
</body>
หน้า chk_creat พอเช็คเสร็จเเล้วจะเก็บ user ที่สร้างเพลย์ลิส ลงดาต้าเบส crate_list ด้วย จะได้ตารางดาต้าเบสเเบบด้านบ
Code (PHP)
<?php
include("config.php");
?>
<?php
$strName=$_POST['list_name'];
//echo '<b>'.$strName.'</br>'; <---- ลอง echo ดูตรงนี้มีค่า
$sql_sel="SELECT * FROM `crate_list` WHERE `name_list` ='".$strName."'";
$result_sql = mysql_query($sql_sel);
$num_rows=mysql_num_rows($result_sql);
if($num_rows>=1){ // มีค่ามากกว่า 1 เท่ากับ 1 {
echo"ชื่อนี้มีอยุ่เเล้ว <br>";
echo"<a href=\"../long2.php\"></a>";
}
else{
$strMem =$_SESSION['log_user'];
$str_username=$_POST['log_user'];
$sql_sel="SELECT * FROM member WHERE user_member = '".$strMem."'";
$result_xxx = mysql_query($sql_sel);
$result_yyy=mysql_fetch_array($result_xxx );
$result_sql =$result_yyy['user_member'];
$sql_insert="INSERT INTO `$db_name`.`crate_list`";
$sql_insert.="(id_list , user_member, name_list , date_list)";
$sql_insert.="VALUES (NULL ,'".$result_sql."', '".$strName."','".$print_date_eng."')";
$sql_result=mysql_query($sql_insert);
echo "บันทึกเรียบร้อยแล้ว";
echo "บันทึกข้อมูลเรียบร้อย<br> ";
//require("show_db.php");
//echo"ย้อนกลับ<br>";
echo "<a href=\"index.php\"> ย้อนกลับ </a>";
}
?>
หน้า show_db
Code (PHP)
<?php
include("config.php");
?>
<?php
$strMem =$_SESSION['log_user'];
$strSQL = "SELECT * FROM crate_list WHERE user_member = '".$strMem."'";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">id_list</div></th>
<th width="98"> <div align="center">user_member</div></th>
<th width="100"> <div align="center">name_list</div></th>
<th width="97"> <div align="center">date_list </div></th>
</tr>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["id_list"];?></div></td>
<td><?=$objResult["user_member"];?></td>
<td><?=$objResult["name_list"];?></td>
<td><div align="center"><?=$objResult["date_list"];?></div></td>
<td align="center"><a href="phpMySQLEditRecordForm.php?CusID=<?=$objResult["id_list"];?>">Edit</a></td>
<td align="center"><a href="phpMySQLDeleteRecord.php?CusID=<?=$objResult["id_list"];?>">Delete</a></td>
<td> <?php echo '<a href="phpMySQLAdd.php?watch='.$watch.' &code='.$code.' &title='.$title.'">'?><?php echo "Add"?></a></td>
</tr>
อันนี้หน้า phpMySQLAdd ค่ะ
( เมื่อวานว่าเเก้ไปเยอะ ทำไมวันนี้เหลือเเค่นี้ไม่รู้ สงสัยเมื่อคืนลืมเซฟ >< )
Code (PHP)
<?php
$strName=$_POST['list_name'];
//echo '<b>'.$strName.'</br>'; <-----ลอง echo ตรงนี้เเล้วไม่มีค่า ==
$strMem =$_SESSION['log_user'];
$str_username=$_POST['log_user'];
$sql_sel="SELECT * FROM member WHERE user_member = '".$strMem."'";
$result_xxx = mysql_query($sql_sel);
$result_yyy=mysql_fetch_array($result_xxx );
$result_sql =$result_yyy['user_member']; //ปล. user_mem= ชื่อฟิลสิ่งที่ต้องการครับ
//echo"$result_sql";
$sql_insert = "INSERT INTO $db_name.youtube";
$sql_insert.= "(id ,user_member,name_list,url,title,code)";
$sql_insert.= " VALUES (NULL , '".$result_sql."','".$strName."','".$watch."','".$title."','".$code."');";
$sql_result = mysql_query($sql_insert);
//echo "บันทึกเรียบร้อยแล้ว";
echo "บันทึกข้อมูลเรียบร้อย<br> ";
//require("show_db.php");
//echo"ย้อนกลับ<br>";
echo "<a href=\"index.php\"> ย้อนกลับ </a>";
require("show_db.php");
?>
ขอบคุณค่ะ 
|
ประวัติการแก้ไข 2013-11-14 08:52:13 2013-11-14 08:53:32
 |
 |
 |
 |
Date :
2013-11-14 08:48:26 |
By :
chocozaa |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|