 |
ช่วยดูโค้ดนี้ทีครับ โค้ดส่งเมล์ mysql_connect($host,$user,$passwd) or die("ไม่สามารติดต่อฐานข้อมูลได้"); |
|
 |
|
|
 |
 |
|
Code (PHP)
$sql = "select * from userinfo where id=$id";
$dbquery = mysql_db_query($dbname, $sql);
$array = mysql_fetch_array($dbquery);
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/thaicgco/domains/bsy-blackhair.com/public_html/sendmail.php on line 10
มันขึ้นว่า ไม่สามารถ fetch ข้อมูลออกมาได้ คือ ไม่เจอผลลัพธ์ออกมา
ให้เช็คชื่อฟิลด์ว่า่ตรงกับฐานข้อมูลรึป่าว แล้วในฐานข้อมูลมีข้อมูลอยู่รึป่าว
แล้ว
$array = mysql_fetch_array($dbquery);
$id = $array['id'];
$email = $array['email'];
แนะนำให้เปลี่ยน $array เป็นชื่ออื่น เดี๋ยวจะมีปัญหา อย่าใช้ชื่อเฉพาะ
|
 |
 |
 |
 |
Date :
2010-02-02 21:42:48 |
By :
kennyg |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
array เป็นชื่อที่เค้าห้ามตั้งหรือเปล่าค่ะ แบบว่าเป็นคำเฉพาะอะค่ะ
|
 |
 |
 |
 |
Date :
2010-02-02 21:58:43 |
By :
leehoon5 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
$admin_username2=$_POST[admin_username2];
if ($admin_username2==""){
echo "<h3>ERROR : Please input your Username</h3>"; exit();
}
include "connect.php";
$sql = "select * from admin WHERE admin_username='$admin_username2'";
$result = mysql_db_query($dbname,$sql);
$record = mysql_fetch_array($result);
$num=mysql_num_rows($result);
if ($num<=0){
echo "<h3>ERROR : This user does not exist in the system.</h3>";
} else {
$to=$record[admin_email];
$password=$record[admin_password];
$subject = "Inform the membership password.";
$message = "Username : $user_forget </br>Password : $admin_password";
$headers = "From IMSDC";
if (@mail($to, $subject, $message, $header)) {
echo "<h3>Password mainly sent successfully.</h3>";
}else{ echo "<h3>Cannot sent password to email </h3>";}
}
mysql_close();
?>
|
 |
 |
 |
 |
Date :
2010-02-02 22:10:16 |
By :
leehoon5 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ง่ายกว่านะลองดูนะ
|
 |
 |
 |
 |
Date :
2010-02-02 22:10:41 |
By :
leehoon5 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ 
|
 |
 |
 |
 |
Date :
2010-02-02 22:44:01 |
By :
โอ๊ต |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|