Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199807

[PHP3] Getting fancy with loops, SQL and arrays From: Paul Monaghan (paulm <email protected>)
Date: 07/31/98

Hey. Wondering if anyone had any clues to the following: I've asked the
user on a web page what their First and Lastname is. I generate possible
combinations of usernames based on first anem last names that are less
than 9 characters and assign that to an array called $names. I then do a
$count=count($names) to see how many combinations passed the <8 charater
rule. Once I have my array i want to query oracle with the names to see
if any are already taken but every time I try this I get an error from
Oracle (Warning: No tuples available on this cursor in
/opt/https/htdocs/index.php3 on line 290).

Here is a sample of my code:

$count_names = count($names);
$count = 0;

$conn_id = ora_plogon("username","password");
$cur = ora_open($conn_id);
ora_fetch($cur);
do {
        ora_parse($cur, "SELECT login from dbadmin.db_account WHERE login =
'$names[$count]'");
        ora_exec($cur);
        $ora_error=Ora_ErrorCode($cur);
        if ($ora_error == 1) {
                $availnames[$count] = $names[$count];
                $count = $count + 1;
        } else {
                       $count = $count +1;
        }
} while ($count < $count_names);

                /* Form with name choices */
                include ("includes/$inc/php3/$language/choosename.php3");

The choosename.php3 contains a for loop to loop through count(availnames)
and then creates a form for the user to choose the name.

Can anyone help me here?

Thanks!

Paul

--
Paul Monaghan (PM1819, paulm <email protected>)
System Administrator - Internet Operations - ACC Tel.
No user-servicable parts inside. Refer to qualified service personnel.

-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3