Php Buddies,
For my learning purpose, do mention what is wrong with the sets you do not recommend and what kind of problems I would face should I ever use them out of mistake.
Q1. sets regarding mysqli_stmt_execute(). Which set to keep ?
SET 1
““
if(mysqli_stmt_execute($stmt) === FALSE)
{
printf(“Error: %s.n”, mysqli_stmt_error($stmt));
printf(“Error: %d.n”, mysqli_stmt_errno($stmt));
die;
}
SET 2
““
$stmt_execute = mysqli_stmt_execute($stmt);
if($stmt_execute === FALSE)
{
echo __LINE__;
printf(“Error: %s.n”, mysqli_stmt_error($stmt));
printf(“Error: %d.n”, mysqli_stmt_errno($stmt));
die;
}
Q2. 2 sets regarding mysqli_stmt_bind_result(). Which set to keep ?
SET 1
““
if($bind_result = mysqli_stmt_bind_result($stmt,$page_url,$link_anchor_text,$page_description,$keyphrase,$keywords));
{
echo __LINE__;
printf(“Error: %s.n”, mysqli_stmt_error($stmt));
printf(“Error: %d.n”, mysqli_stmt_errno($stmt));
die;
}
SET 2
““
$bind_result = mysqli_stmt_bind_result($stmt,$page_url,$link_anchor_text,$page_description,$keyphrase,$keywords);
if($bind_result === FALSE)
{
echo __LINE__;
printf(“Error: %s.n”, mysqli_stmt_error($stmt));
printf(“Error: %d.n”, mysqli_stmt_errno($stmt));
die;
}
Q3. 2 sets regarding mysqli_stmt_fetch(). Which set to keep ?
SET 1
““
if($stmt_fetch = mysqli_stmt_fetch($stmt))
{
echo __LINE__;
printf(“Error: %s.n”, mysqli_stmt_error($stmt));
printf(“Error: %d.n”, mysqli_stmt_errno($stmt));
die;
}
SET 2
““
$stmt_fetch = mysqli_stmt_fetch($stmt);
if($stmt_fetch === FALSE)
{
echo __LINE__;
printf(“Error: %s.n”, mysqli_stmt_error($stmt));
printf(“Error: %d.n”, mysqli_stmt_errno($stmt));
die;
}
Anything else I should know, you are welcome to mention.
Thanks