/    Sign up×
Community /Pin to ProfileBookmark

Can We Not Test These In Prep Stmt ?

““
if(mysqli_stmt_prepare($stmt_2,$query_2))
{
““

Manual shows to test like the above.

Can we not test:

““
if(mysqli_stmt_execute($stmt_2);
{
““

And,
not test ?:

““
if(mysqli_stmt_bind_param($stmt_2,’s’,$keywords);
{
““

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@NachfolgerSep 15.2020 — @developer_web#1623320

``PHP<i>
</i>if(mysqli_stmt_execute($stmt_2);
{<i>
</i>
`</CODE>

<CODE lang="PHP">
`PHP<i>
</i>if(mysqli_stmt_bind_param($stmt_2,'s',$keywords);
{<i>
</i>
``

That's not valid PHP. I'm not sure what you're asking for here--I guess the answer is no?
Copy linkTweet thisAlerts:
@NogDogSep 15.2020 — It depends on whether you're willing to accept the consequences if something fails. If you do a mysqli_stmt_prepare() and it fails, then any subsequent command that tries to use that prepared statement is going to fail, and likely by throwing an exception or fatal error, as opposed to just returning false.

Yet another advantage of PDO: it's relatively easy to configure it to always throw exceptions on errors, allowing you to explicitly catch them in try/catch blocks.
Copy linkTweet thisAlerts:
@developer_webauthorSep 25.2020 — @NogDog,

You may close this thread.
Copy linkTweet thisAlerts:
@developer_webauthorSep 25.2020 — @Nachfolger#1623321

Why this no valid ? Just checking if execution went ahead or not.


if(mysqli_stmt_execute($stmt_2);
{
Copy linkTweet thisAlerts:
@developer_webauthorSep 25.2020 — @Nachfolger#1623321

Why this no valid ? Just checking if params got bound or not.

if(mysqli_stmt_bind_param($stmt_2,'s',$keywords);
{
Copy linkTweet thisAlerts:
@NachfolgerSep 26.2020 — @developer_web#1623661

Go ahead and try it out, tell me why it isn't valid.
×

Success!

Help @developer_web spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...