On 20 Feb 2005 06:16:17 -0800, "Jared" <jared.t.boehm@gmail.com> wrote:
[color=blue]
>This is very strange.
>
>I'm running MySQL 4.1.10, and php 4.3.10, on a FreeBSD 4.10 box. The
>database has been created, and permissions are set right. I can access
>the database from bin/mysql without a problem, too, using -uweb
>-pblahblahblah.
>
><?php
>
>$connection = @ mysql_connect("localhost", "web", "blahblahblah") ||
>die( mysql_error());[/color]
Actually you probably want the 'or' operator - not ||. There's a subtle
difference related to operator precedence.
$connection = @mysql_connect("localhost", "web", "blahblahblah")
or die(mysql_error());
http://uk.php.net/manual/en/language...ors.precedence
[color=blue]
>printf("conn = %d<p>", $connection);
>
>mysql_select_db("somedb", $connection) || die (mysql_error() );
>
>which yields:
>
>conn = 1[/color]
Should have been something like 'MySQL Link Resource #1'- but you'd have to
use %s in the format string anyway.
[color=blue]
>Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link
>resource in /usr/local/apache8001/htdocs/scratch/index.php on line 7
>
>I am so at a loss, and could use any help you could offer.[/color]
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool