Re: Inserting data at runtime (php,mysql)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21/03/06, sathyashrayan <foraci@xxxxxxxxx> wrote:
>
> ----- Original Message -----
> From: "Dan Parry" <dan@xxxxxxxxxxxxxxxxxxx>
> To: "'sathyashrayan'" <foraci@xxxxxxxxx>; <php-general@xxxxxxxxxxxxx>
> Sent: Tuesday, March 21, 2006 6:12 PM
> Subject: RE:  Inserting data at runtime (php,mysql)
>
>
> > [snip]
> > $conn=mysql_connect(" ");/*with the required parameters*/
> > if(!conn) <<<
> > {
> > [/snip]
> >
> > You are testing conn in your if condition... should that not be $conn?
> >
>
>   No if conn evaluates to false then error.

Yeah, but it should be $conn, not conn.

PHP treats conn as an unquoted string which evaluates to true, so it's
quite possible that your mysql_connect() is failing and you're not
detecting it.

$ php -r 'if (conn) print "Connected...\n";'
Connected...

You're not checking that you've managed to open the file - if you've
got error_reporting turned down low then you'll miss the warnings from
that.

You've also got problems with the while($funct_var) loop - that return
statement is all that's stopping it looping infinitely and it's still
almost certainly not what you want.

  -robin

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux