Re: DB Select

From: Date: Sun, 26 Nov 2000 01:10:43 +0000
Subject: Re: DB Select
References: 1 2 3  Groups: php.windows 
Request: Send a blank email to php-windows+get-4108@lists.php.net to get a copy of this message
----- Original Message ----- From: "Noah Spitzer-Williams" <noahsw@cyberdude.com> To: <php-windows@lists.php.net> Sent: Saturday, November 25, 2000 1:12 PM Subject: Re: [PHP-WIN] DB Select > sorry this is kinda unrelated, but is it a good idea to run > mysql_free_result after a query? > hi noah, since php 4.03pl1 the ram is given free after end of an php script automatically. the only recommendend usage is, if the ram-usage while the script is executed gets too high. i don´t think this is often really happening. (:-! greetings friedhelm betz > > ----------------- > The DevBoard - http://www.thedevboard.com > ----------------- > http://www.alladvantage.com/go.asp?refid=BIY971 - AllAdvantage > ""friedhelm betz"" <holliwell@gmx.net> wrote in message > news:002001c056fd$a78c0560$ec1a07d5@home.de... > > hallo ben others, > > because your question wasnt answered yet, ill try. > > > > Ben wrote: > > > I am using the following script to select stuff from a database. > > > > > > <? > > > mysql_connect("$db_host", "$db_user", "$db_pass"); > > > $query = "SELECT * FROM users where LoginName = '$user' and Active = > > > 'Yes'"; > > > $result = mysql_db_query("$db_name", $query); > > > if ($result) { > > > > try an echo $result, then you will ALWAYS get an id-link identifier, in > > other words: > > $result is true for every query ! > > > > > > > > while ($r = mysql_fetch_array($result)) { $FullName = > > > $r["FullName"]; $Email = $r["Email"]; > > > $LoginName = $r["LoginName"]; $Password = > > > $r["Password"]; $Address = $r["Address"]; $Telephone = > > > $r["Telephoene"]; $Active = $r["Active"]; > > > > > > echo " > > > $LoginName<BR>$Active > > > "; } > > > } > > > > as mentionend above: this else will never work! > > > > > else { echo "Account Not Active"; } > > > mysql_free_result($result);?> > > > > > > The database is a user login database. When they create an account, it > > sets > > > the Active field to no, and they have to follow a lonk sent to them by > > > E-Mail to active the account. > > > > > > I want the above script to say Account not active when they try to login > > > using an account that hasn't been actovated by following the E-Mailed > > link. > > > > > > But, it doesn't, it just returns a blank page. What am I doing wrong? > > > > > > The DB_xxx variables are read from a conf file, and the $user is read > from > > > the url > > > > > > -- Ben Cairns, Head Of Technical Operations, Intasept.com > > > E-Mail: BenC@intasept.com | Web: > > > http://www.intasept.com > > > > in general, i suggest to turn on error reporting on in php.ini while > > developing. then you get the errors from mysql and you can see whats > wrong! > > because you get nothing on your screen, there must be an error/warning > from > > mysql. try an echo of each returned variable. hint: make your $active a > > integer dichotom variable ( 0=not active, 1= active). in my opinion its > > easier to use for controlling, > > have a look on the reset syntax (array functions) in phpmanual too. > > for further help post again. > > hope it helps > > friedhelm betz > > p.s.: let me/us know if and how you managed! > > > PHP Windows Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-windows-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > >

« previous php.windows (#4108) next »