[thelist] mysql_query + php

Kae Verens kverens at contactjuggling.org
Tue Feb 25 03:38:01 CST 2003

Andrew Maynes wrote:
> can anone say why this doesn't work?  When I say work I mean pull in the records
> from city and display them?
> <?
> require("connection.php");
> mysql_connect("$DBHost","$DBUser","$DBPass");
> echo "<select name=\"CityID\" size=\"1\" class='menuForm'>";
> $result=mysql_query("$DBName","SELECT City, CityID FROM city ORDER BY City");

As I said yesterday - $DBName is not initialised.
Replace the line above with:
$result=mysql_query('SELECT City,CityID FROM city ORDER BY City');

Kae Verens               _______\_   webworks.ie
pay:  www.webworks.ie       _____\\__   webhosts
play: www.contactjuggling.org  ___\\\___  design
  kae: kverens.contactjuggling.org _\\\\____ code

More information about the thelist mailing list