Re: Inserting data at runtime (php,mysql)

From: Date: Tue, 21 Mar 2006 13:10:23 +0000
Subject: Re: Inserting data at runtime (php,mysql)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-232318@lists.php.net to get a copy of this message
On 21/03/06, sathyashrayan <foraci@gmail.com> wrote: > > ----- Original Message ----- > From: "Dan Parry" <dan@virtuawebtech.co.uk> > To: "'sathyashrayan'" <foraci@gmail.com>; > <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

« previous php.general (#232318) next »