Re: [PHP] very basic php mysql question

2004-09-20 Thread Jason Davidson
add mysql_error() to your die string so you can report what the error
is.

Jason

"AMC" <[EMAIL PROTECTED]> wrote: 
> 
> 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?
> 
>  
> 
> 
> $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" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > >
> > > 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.
> > >
> > >  > >
> > >
> > >
> > > $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
> > --
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] very basic php mysql question

2004-09-20 Thread AMC
I figured it out - using the wrong info for host

Thanks again
"Amc" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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?
>
> 
>
>
> $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" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > >
> > > 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.
> > >
> > >  > >
> > >
> > >
> > > $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
> > --

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] very basic php mysql question

2004-09-20 Thread AMC
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?



"Matthew Sims" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >
> > 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.
> >
> >  >
> >
> >
> > $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
> --

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] very basic php mysql question

2004-09-20 Thread Victor SaldaƱa D.
On Mon, 20 Sep 2004 15:17:33 -0700, AMC <[EMAIL PROTECTED]> wrote:

> http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] very basic php mysql question

2004-09-20 Thread Matthew Sims
>
> 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.
>
> 
>
>
> $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
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] very basic php mysql question

2004-09-20 Thread AMC
Hi,

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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php