Re: [PHP4BETA] Latest CVS - Question
| From: | Dustin Marquess | Date: | Tue, 21 Sep 1999 02:24:16 +0000 |
| Subject: | Re: [PHP4BETA] Latest CVS - Question | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-4720@lists.php.net to get a copy of this message | ||
On Mon, 20 Sep 1999, Sarah Pearson wrote:
> Mark Musone [musone@edgeglobal.com] wrote:
> > > A small problem I have encountered though is when building the latest CVS
> > > and installing as an apache module, I get "Document contains no data" when
> > > viewing a php file. I realise that running a CVS version is not gauranteed to
> > > work :)
> >
> > if you could get a backtrace and a sample of your php script,
> > that'd be great!
>
> I think I have located the problem.
>
> Here is a simple non-useful script that works.
>
> <?
>
> $db = mysql_connect("localhost", "root");
> if ($db) {
> mysql_select_db("pcstuff") or die ("Could not connect to table in
> database!");
> echo "Works ok";
> } else {
> echo "<P>Could not connect to database.\n";
> }
>
> ?>
>
> However, if I put $db as the link identifer in mysql_select_db I get the
> document contains no data error. I do not know if this is an error or
> intentional.
Probably because you are assigning $db the result of the
mysql_connect, which is a MySQL data structure. mysql_select_db() wants
the name of the database you want to select, not the structure. Try:
$blah = "pcstuff";
@mysql_select_db($blah) or die("Could not select database.");
-Dustin