Re: very basic php mysql question

From: Date: Mon, 20 Sep 2004 22:43:47 +0000
Subject: Re: very basic php mysql question
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-197358@lists.php.net to get a copy of this message
I figured it out - using the wrong info for host Thanks again "Amc" <aboehme@netgate.net> wrote in message news:20040920223538.56292.qmail@pb1.pair.com... > Thanks, > > the script runs now, but I cannot open a connection. I know the user name, > and password are correct. What could be the cause? > > <?php > > > > $user = "aclark"; > > $host = "localhost"; > > $password = "ajaxx"; > > $database = "corrigent"; > > $connection = mysql_connect($host, $user, $password) or die("can't open damn > connection"); > > $db = mysql_select_db($database, $connection) or die("can't open damn > database"); > > $query = "select * from customer"; > > $result = mysql_query($query) or die ("couldn't execute query"); > > while ($row = mysql_fetch_array($result)) > > { > > extract($row); > > echo $company; > > } > > ?> > > "Matthew Sims" <matt@killermookie.org> wrote in message > news:38150.208.44.135.18.1095719428.squirrel@208.44.135.18... > > > > > > I have a php page with the code below. The page doesn't show the record > > > from > > > the database when it runs and I'm not sure why. I'm not getting any > error > > > message, just a blank page. There is one record in the tabele I'm trying > > > to > > > query. > > > I'm brand new to php so I'd really appreciate the help. > > > > > > <? php > > > > > > > > > > > > $user = "aclark"; > > > > > > $host = "localhost"; > > > > > > $password = "ajaxx"; > > > > > > $database = "corrigent"; > > > > > > $connection = mysql_connect($host, $user, $password)or die("can't open > > > damn > > > connection"); > > > > > > $db = mysql_select_db($database, $connection) or die("can't open damn > > > database"); > > > > > > $query = "select * from customer"; > > > > > > $result = mysql_query($query) or die ("couldn't execute query"); > > > > > > while ($row = mysql_fetch_array($result)); > > > > > > { > > > > > > extract($row); > > > > > > echo $company; > > > > > > } > > > > > > ?> > > > > > > > > > Your while statment has a ; at the end of it. > > > > while ($row = mysql_fetch_array($result)) { > > echo $row["company"]; > > } > > > > -- > > --Matthew Sims > > --<http://killermookie.org>

« previous php.general (#197358) next »