Subject RE: **SPAM** Re: [firebird-php] auto increment last insert
Author Johan van Zyl
Hi
OK, because I have that trigger in place, I am only using this bit of code
(no $userid=ibase_gen_id(G_USERS) etc)

$sql = ibase_query("INSERT INTO users (first_name, last_name, email_address,
username, \"PASSWORD\", info)
VALUES('$first_name', '$last_name', '$email_address', '$username',
'$db_password', '$info2')") or die (ibase_errmsg()); //line 124
i.e. removed reference to userid
This now works, it adds the user and sends the e-mail.
But when clicking on link in e-mail
// Get database connection
include 'db.php';

// Create variables from URL.

$userid = $_REQUEST['id'];
$code = $_REQUEST['code'];

$sql = ibase_query("UPDATE users SET activated='1' WHERE userid='$userid'
AND \"PASSWORD\"='$code'"); //line 12

$sql_doublecheck = ibase_query("SELECT * FROM users WHERE userid='$userid'
AND \"PASSWORD\"='$code' AND activated='1'"); //line 14
$doublecheck = ibase_fetch_row($sql_doublecheck); //line 15

if($doublecheck == 0){
echo "<strong><font color=red>Your account could not be
activated!</font></strong>";
} elseif ($doublecheck > 0) {
echo "<strong>Your account has been activated!</strong> You may login
below!<br />";
include 'login_form.html';
}

?>

I now get this:

Warning: InterBase: conversion error from string "" in
/home/e-smith/files/ibays/Primary/html/mc/activate.php on line 12

Warning: InterBase: conversion error from string "" in
/home/e-smith/files/ibays/Primary/html/mc/activate.php on line 14

Warning: Supplied argument is not a valid InterBase result resource in
/home/e-smith/files/ibays/Primary/html/mc/activate.php on line 15
Your account could not be activated!


-----Original Message-----
From: Lester Caine [mailto:lester@...]
Sent: 24 November 2004 14:20
To: firebird-php@yahoogroups.com
Subject: Re: **SPAM** Re: [firebird-php] auto increment last insert


Johan van Zyl wrote:

> I am on PHP4, so I cannot use
> $userid=ibase_gen_id(G_USERS) ?
>
>
> I also have a Trigger T_USERS
> AS
> begin
> if ( (new.userid is null) OR (new.userid <= 0) ) then
> begin
> new.userid = gen_id( g_USERS, 1 );
> end
> end
> which is not required if
> $userid=ibase_gen_id(G_USERS) ?
> would work?

The trigger is useful if you don't need to remember the userid every
time. If you 'INSERT' without a valid userid the trigger will insert it.
Or if you have other applications inserting the data. So it does not
cause a problem if you leave it in place. ibase_gen_id simply wraps the
previous code in a nice name, so you don't need the ibase_query +
getting the result, all of this has nothing to do with how the database
server works itself.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

Yahoo! Groups Sponsor
ADVERTISEMENT





----------------------------------------------------------------------------
--
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-php/

b.. To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 2004/11/19


[Non-text portions of this message have been removed]