Re: Weird Problem
| From: | Kevin Stone | Date: | Tue, 29 Jul 2003 21:18:22 +0000 |
| Subject: | Re: Weird Problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157438@lists.php.net to get a copy of this message | ||
"Aaron Axelsen" <axelseaa@amadmax.com> wrote in message
news:000701c3560b$43c3a4b0$6400a8c0@DELTA...
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Yes, connect.inc.php does the following:
>
> @$connect=mysql_connect("localhost",$dbuser,$dbpass);
> if (!$connect) {
> echo "Could not connect to mysql!";
> exit();
> }
>
> @$db=mysql_select_db($dbname);
> if (!$db){
> echo "Could not connect to database";
> exit ();
> }
>
> @$result=mysql_query($sql);
> if (!$result){
> echo "Invalid Sql Command";
> exit ();
> }
>
>
> - ---
> Aaron Axelsen
> AIM: AAAK2
> Email: axelseaa@amadmax.com
>
> Want reliable web hosting at affordable prices?
> www.modevia.com
>
> Web Dev/Design Community/Zine
> www.developercube.com
The resource identifier returned by mysql_connect() is an optional input to
the mysql_query() function. You should test it out to see if your system
isn't passing the value automatically.
$result = mysql_query($sql, $connect); //<-- like this
The reason you may be seeing 1 instead of the value you expected is that the
mysql_query() function can return True even if it doesn't succesfully
execute the query. In that case you may see the output 1 becuase the
boolean True evaluates to 1 in the parser.
--
Kevin