On 21/03/06, sathyashrayan <[EMAIL PROTECTED]> wrote:
>
> ----- Original Message -----
> From: "Dan Parry" <[EMAIL PROTECTED]>
> To: "'sathyashrayan'" <[EMAIL PROTECTED]>; <php-general@lists.php.net>
> Sent: Tuesday, March 21, 2006 6:12 PM
> Subject: RE: [PHP] 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

Reply via email to