All this steps are necessary with prepared statement?

All this step are corrects and necessary ?

store_result() and bind_result() togheter ?

if (isset($_SESSION['userID'])) {
$userID = $_SESSION['userID'];
$stmt = $mysqli->prepare(
   "SELECT usergroup, firstname FROM tbl_users WHERE userID = ? ");
$stmt->bind_param('i', $userID); 
$stmt->bind_result($usergroup, $firstname);
$_SESSION['usergroup'] = $usergroup;
$_SESSION['firstname'] = $firstname;



But a programmer always can write a function to wrap all this code in, and call it in one line

if (isset($_SESSION['userID'])) {
    $sql = "SELECT usergroup, firstname FROM tbl_users WHERE userID = ?";
    $_SESSION['user'] = $db->getRow($sql, $_SESSION['userID']);

However, I have to admit that to write a function based on mysqli requires extraordinary skill, which renders it practically unreliazable for the most SO users. So, better switch to PDO, as it requires three times less code to handle prepared statement, than mysqli

if (isset($_SESSION['userID'])) {
    $stm = $pdo->prepare("SELECT usergroup, firstname FROM tbl_users WHERE userID = ?");
    $_SESSION['user'] = $stm->fetch();

Need Your Help

Java Youtube credentials?

java youtube-api

I'm facing a problem with youtube java credentials,normally it works well and i was able to upload to youtube, but today i' m getting this exception invalid credentials.

java programming get the date from a calendar

java date calendar

i am new to java programming .i do not whether it is possible to connect the external calendar to a java program.i have no previous experience on this.So please help me.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.