Maybe I am missing something but it seems you are doing things in a 
potentially unreliable way.

Firstly... your sql statement in create.php

$query_update = "INSERT INTO pets (uid) SELECT uid FROM users WHERE

could simply be

mysql_query("INSERT INTO pets SET uid = " . $session["uid"]);

if you are using php4 session variables, why don't you use $uid as the 
so you would only need -->  mysql_query("INSERT INTO pets SET uid = 

Moving on...

I don't know why you would create an empty record, and insert data later 
if it is allowed.

Do this:

Show Form --> Submit Form --> Check Data Integrity --> Check If Allowed 
to Insert Record --> Insert Record

If anything stuffs up then you don't do the bit following.

So it doesn't check data integrity if you haven't submitted the form 
(obvious) and it doesn't insert the record until it checks the data 
integrity and if they are allowed to insert the record.


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to