You are here: Re: Problem with mysqli_stmt_bind_param :: Variables are not Binding! « PHP Programming Language « IT news, forums, messages
Re: Problem with mysqli_stmt_bind_param :: Variables are not Binding!

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
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация