php - What is the correct order of statement method calls using prepared statements? -


i want make db secure possible, , 1 of things i've learned use prepared statements...so that's i'm doing.

i need confirmation make sure order of execution ok.

does following make sense, or missing something?

$sql = 'select ...'; $conn = @ new mysqli($host, $user, $pwd, $db);  $stmt = $conn->stmt_init(); // initialize prepared statement  $stmt->prepare($sql); $stmt->bind_param('i', ...); $stmt->bind_result(..., ..., ...); $stmt->execute();  while ($stmt->fetch()) {     ... }  $stmt->free_result(); // free database resources other queries $stmt->close(); // close statement $conn->close(); //close database connection 

i don't need call stmt_init() -- @ least, doesn't seem necessary, according example on page of mysqli::prepare()

you might want check :


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -