Subject | RE: [firebird-php] $login_check = ibase_num_rows($sql); problem |
---|---|
Author | Nigel Weeks |
Post date | 2004-11-21T22:10:58Z |
> This now worksYou're nearly there. You don't need ibase_fetch_array in your case:
> $sql = ibase_query("SELECT username, \"PASSWORD\" FROM users WHERE
> username='$username' AND \"PASSWORD\"='$password' AND activated='1'");
> $login_check = ibase_fetch_row($sql);
>
> if($login_check > 0){
> but ibase_fetch_array seems to be a problem and I cannot find
> the ibase
> equivalent in PHP manual ?
> while($row = ibase_fetch_array($sql)){
//Run the query, and put the record set into a variable called 'sql'
$sql = ibase_query("SELECT username, \"PASSWORD\" FROM users WHERE
username='$username' AND \"PASSWORD\"='$password' AND activated='1'");
// Fetch a row from the record set
$login_check = ibase_fetch_row($sql);
// Now, test a column in the record set
echo "Username is the first column, position zero: ".$login_check[0];
echo "PASSWORD is the second column, position one: ".$login_check[1];
// You could have used ibase_fetch_object, instead of ibase_fetch_row, and
used field names directly:
// Fetch a row from the record set AS ON OBJECT, instead of an array
$login_check = ibase_fetch_object($sql);
// get values from the returns
echo "Username is: ".$login_check->USERNAME;
echo "PASSWORD is: ".$login_check->PASSWORD;
Have fun!!
Nige.