|
|
|
ช่วยดู Error Warning: mysql_result(): supplied argument is not a valid MySQL result resource |
|
|
|
|
|
|
|
Code
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\system\function\user.func.php on line 9
Code (PHP)
<?php
function logged_in(){
return isset($_SESSION['user_id']);
}
function login_check($email, $password){
$email = mysql_real_escape_string($email);
$login_query = mysql_query("SELECT COUNT(user_id) as count, user_id FROM users WHERE email = '$email' AND password = '".md5($password)."'");
return (mysql_result($login_query, 0) == 1) ? mysql_result($login_query, 0, 'user_id') : false;
}
function user_data(){
$args = func_num_args();
$fields = '`'.implode('`, `', $args).'`';
$query = mysql_query("SELECT $fields FROM `users` WHERE `user_id` = ".$_SESSION['user_id']);
$query_result = mysql_fetch_assoc($query);
foreach ($args as $fields){
$args[$fields] = $query_result[$fields];
}
return $args;
}
function user_signup($email, $name, $password){
$email = mysql_real_escape_string($email);
$name = mysql_real_escape_string($name);
mysql_query("INSERT INTO users VALUES ('', '$email', '$name', '".md5($password)."')");
return mysql_insert_id();
}
function user_exists($email){
$email = mysql_real_escape_string($email);
$query = mysql_query("SELECT COUNT(user_id) FROM users WHERE email = '$email'");
return (mysql_result($query, 0) ==1) ? true : false;
}
?>
Tag : PHP
|
|
|
|
|
|
Date :
2013-01-24 10:34:22 |
By :
nukedonut1 |
View :
1273 |
Reply :
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
mysql_query(sql) or die(mysql_error());
ลองดักจับ error ดูครับ
|
|
|
|
|
Date :
2013-01-24 12:01:50 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอาใส่ตรงไหนคับ
|
|
|
|
|
Date :
2013-01-24 13:31:21 |
By :
nukedonut1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ต่อจากบรรทัด
$query = mysql_query("select * table_name");
เช่น mysql_query($query) or die(mysql_error());
|
|
|
|
|
Date :
2013-01-24 13:38:23 |
By :
backship |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันบอกว่า Query was empty
เอาแซกเข้าไป
Code (PHP)
function login_check($email, $password){
$email = mysql_real_escape_string($email);
$login_query = mysql_query("SELECT COUNT(user_id) as count, user_id FROM users WHERE email = '$email' AND password = '".md5($password)."'");
mysql_query($login_query) or die(mysql_error());
return (mysql_result($login_query, 0) == 1) ? mysql_result($login_query, 0, 'user_id') : false;
}
ไม่ทราบว่าถูกหรือป่าว
|
|
|
|
|
Date :
2013-01-24 18:27:07 |
By :
nukedonut1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Query was empty แปลตรง ๆ ไม่มีค่าที่นำมาคิวรี่ มันว่าง มันไม่มี....
ค่าหายไปไหนหว่า อยากรู้เหมือนกัน
|
|
|
|
|
Date :
2013-01-24 20:19:17 |
By :
apisitp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
|
|
|
|
Date :
2013-01-24 21:11:40 |
By :
nukedonut1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|