Re: [PHP3] cant work out looping function in a php cgi
| From: | (Richard Lynch) | Date: | Fri, 30 Jun 2000 17:02:59 +0000 |
| Subject: | Re: [PHP3] cant work out looping function in a php cgi | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4065@lists.php.net to get a copy of this message | ||
In article <394D17BC.DA9BD532@ozemail.com.au>, mwaples@ozemail.com.au
(MichaelWaples) wrote:
> basically i use the following cgi script(all done on command line) - to
> look up values in a database (eg a domain)
> and depending on what variables it fed keep asking or return the value.
>
> the problemis when i get it to check if a value exists - firstime if i
> say
>
> have
> $test = (y,admin,domains,domain name)
>
> if test.com is in the datbase - and first time i enter test.com -
> echo $test; shows - test.com
> but if i enter say stupid.com, it correctly asks again - and i enter
> test.com but this time it will end but echo nothing at all.
> Im doing unset() on the entered data - and it correctly ends with the
> new data but wont display it.
I can't really follow the logic you're trying to use, and recursion is
almost for sure not the thing you really want...
But echo out all the variables at the critical stage where the program is
going wrong, and see what's not what you expect.
I personally think you should be doing something more like this:
$conn = pg_Connect("", "", "", "", "admin");
echo "Enter $name<BR>\n";
while (($data = read()) != 'bye'){
$result = pg_Exec($conn,
"SELECT * FROM $table where $column = '$data';");
$number = pg_NumRows($result);
if ($number){
echo "$data is in the database<BR>\n";
}
else{
echo "$data is not in the database<BR>\n";
}
echo "Enter $name<BR>\n";
}
But maybe I just don't understand what you're trying to do...
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)