Hi all:
Trying to figure out how to use bound parameters with a Select statement and am running into issues. Here is the code. The errors will be below:
require($_SERVER['DOCUMENT_ROOT'] . '/inc/dbconn_RO_my.php');
/* check connection */
if (!$conn) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$stmt = mysqli_prepare($conn, "SELECT name FROM members WHERE name = ? ");
mysqli_stmt_bind_param($stmt, 's', $cUsername);
$result = mysqli_query($conn, 's', $stmt);//LINE 26
$row = mysqli_fetch_array($result);//LINE 27
$iname = $row['name'];
$cUsername = $_REQUEST["U"];
If ($iname==$cUsername){
header( 'Location: http://www.mysite.com/search.asp' );
}
/* execute prepared statement */
mysqli_stmt_execute($stmt);
/* close statement and connection */
mysqli_stmt_close($stmt);
Here are the errors:
Warning: mysqli_query() expects parameter 3 to be long, object given in C:\Web\mysite\test3.php on line 26
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\Web\mysite\test3.php on line 27
Thank you!