Guest User

Untitled

a guest
Jul 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <? $sql_user_exists =$db->my_query("SELECT user_id, email FROM `users` WHERE `email` LIKE '%".$trimmed_email."%'");
  2.  
  3. switch(true):
  4.  
  5. case $db->num_rows($sql_user_exists)>0:
  6. while($array = $db->fetch_array($sql_user_exists)) {
  7. $user_id=$array['user_id'];
  8. $email=$array['email'];
  9. }
  10. $db->my_query("INSERT INTO orders ($fields_order) VALUES(".$values_order."'".$user_id."')");
  11. $last_insert=mysql_insert_id();
  12. break;
  13. default:
  14. $db->my_query("INSERT INTO users ($fields_user) VALUES($values_user)");
  15. $last_insert=mysql_insert_id();
  16.  
  17. $db->my_query("INSERT INTO orders ($fields_order) VALUES(".$values_order."'".$last_insert."')");
  18. $last_insert=mysql_insert_id();
  19. break;
  20. endswitch;
  21. ?>
Add Comment
Please, Sign In to add comment