Re: Weird Problem

From: Date: Mon, 29 Jul 2002 20:48:42 +0000
Subject: Re: Weird Problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157430@lists.php.net to get a copy of this message
Isn't there a known problem with variables and included files? Like you have to create $result in the first file, or something... Just try to have it all in one file... Also, change "mysql_fetch_row($result);" to "mysql_fetch_row($result) or print(mysql_error());"... Something also tells me you are using mysql_fetch_row... Why not array? You should try to just switch between them and try once... I didn't notice it at first... mysql_fetch_array($result) is what I would use... Will probably return same thing, but who knows? -- // DvDmanDT MSN: dvdmandt@hotmail.com Mail: dvdmandt@telia.com "Aaron Axelsen" <axelseaa@amadmax.com> skrev i meddelandet 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 > > > > - -----Original Message----- > From: Jennifer Goodie [mailto:goodie@apollointeractive.com] > Sent: Tuesday, July 29, 2003 2:46 PM > To: Aaron Axelsen; php-general@lists.php.net > Subject: RE: [PHP] Weird Problem > > > > I have the following chunk of code: > > > > $sql = "SELECT setting from settings where name='display_rows'"; > > include("connect.inc.php"); > > print $sql; > > $row = mysql_fetch_row($result); > > $path = $row[0]; > > print $path; > > > > It always prints out "1" > > > > But if I run the code at the sql command prompt, it prints out > > "25", which is the correct value. > > > > Does anyone have any ideas why im having this problem?? > > > > Are you actually executing the query? I don't see a mysql_query() > anywhere and it would be anti-intuituve to have that in your > connection include. > > > -----BEGIN PGP SIGNATURE----- > Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com> > > iQA/AwUBPybRBrrnDjSLw9ADEQJrmACg70sEqN0efwGDg4o958tPx9s6K+0AoJKK > 3WZTtCIVXsszKlGA/jOzrmMR > =LwnA > -----END PGP SIGNATURE----- > >

« previous php.general (#157430) next »