You are here: Re: Confused by mysqli « PHP Programming Language « IT news, forums, messages
Re: Confused by mysqli

Posted by Rik on 07/05/06 10:42

Dodger wrote:
> $dbh = new mysqli('localhost','user','password','database');
> if ($err = mysqli_connect_errno()) {
> print "Connect failed: $err";
> exit();
> }
>
> $query = <<<EOF
> SELECT *
> FROM cities
> WHERE Country = ?
> EOF;
> $statement = $dbh->prepare($query);
> $statement->bind_param('USA');
> $statement->execute();
> $statement->store_result();
> $cities = array();
> $i = 0;
> while ($city = $statement->fetch_assoc()) {
> $cities[$i] = $city;
> $i++;
> }
mysqli_stmt_fetch_assoc doesn't exist, mysqli_stmt_fetch does.

$statement->bind_results($city);
while ($statement->fetch()) {
$cities[] = $city;
}

Look at the example at
http://www.php.net/manual/en/function.mysqli-stmt-bind-result.php

Grtz,
--
Rik Wasmus

 

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

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