我收到此错误:
Notice: Undefined variable: picture in C:\Users\Raj\PhpstormProjects\comment03\Wall\wall-functions.php on line 36
Notice: Undefined variable: picture in C:\Users\Raj\PhpstormProjects\comment03\Wall\wall-functions.php on line 38
Notice: Undefined variable: gender in C:\Users\Raj\PhpstormProjects\comment03\Wall\wall-functions.php on line 40
连接数据库后运行程序时,我从现在开始向下下载php墙脚本,这给了我这个错误..请帮助我现在该怎么办?
这是我的
wall-functions.php
代码:<?php
$path = 'http://yepinol.com/wall/';
if(!function_exists('getUserImg')) {
function getUserImg($user_id = ''){
$username_get = mysql_query("SELECT picture,gender from member where member_id=".$user_id." order by member_id desc limit 1");
while ($name = @mysql_fetch_array($username_get))
{
$picture = $name['picture'];
$gender = $name['gender'];
}
$imageUser = 'pics/'.$picture;
if (!file_exists($imageUser) || $picture=='')
{
if($gender == 'm')
$imageUser = 'pics/no-image-m.png';
else
$imageUser = 'pics/no-image-f.png';
}
return $imageUser;
}
}
?>
最佳答案
尝试在while循环之前/之前声明$picture
和$gender
。
关于javascript - 注意:未定义的可变图片,性别,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23190626/