PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Class Check
{
var $mMemberId;
function GetName($memberId)
{
$this->mMemberId=$memberId;
$query=mysql_query("SELECT name FROM table WHERE mid=$mMemberId");// 1
// OR
$query=mysql_query("SELECT name FROM table WHERE mid='. $this->mMemberId.'"); //2
}
}
1 or 2?
Thanks
Last edited by shivam0101 on Mon Sep 03, 2007 5:05 am, edited 1 time in total.
Although, since you're passing the memberid as a parameter to the function, you don't even need to use the class property.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
$query=mysql_query("SELECT name FROM table WHERE mid='{$this->mMemberId}'");
Notice you did not need the string concentration ( the periods ) and I also used {} brackets since the variable is in object context (would be the same in array contexts {$foo['bar']} )