|
Posted by Jerry Stuckle on 08/29/07 03:04
sugapablo wrote:
> Here's my code:
>
> <?php
> $mysqli = new mysqli("localhost", "****", "********", "***********");
>
> $idNum = "1030";
>
> $sql = "select id,email from users where id > ?;";
> $stmt = $mysqli->prepare($sql);
> $stmt->bind_param('s', $idNum);
> $stmt->execute();
>
> $stmt->bind_result($id, $email);
>
> while ($stmt->fetch()) {
> printf ("%s (%s)<br/>\n", $id, $email);
> }
> ?>
>
> Obviously, what this should do is bind $idNum (value of 1030) to the
> SQL statement and send this to the MySQL server -> select id,email
> from users where id > '1030'; This should return 10 rows.
>
> However, this is not what's happening. What's happening is that the
> variable is not being binded and this is being sent -> select id,email
> from users where id > ''; And because of this, it's returning 1040
> rows.
>
> I've tested this on many different scenarios. No matter what I do,
> the variables are not binding.
>
> Any idea why this could be happening? I'm assuming it's a server
> config issue. Even if you can think of more than one reason, can I
> hear some possibilities? I'm at a loss!
>
What happens if you try
$idNum = 1030;
?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|