Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. DECLARE id_modela int(10) DEFAULT 0;
  2. DECLARE id_usera int(11) DEFAULT 0;
  3.  
  4. BEGIN
  5. SELECT id_model
  6. INTO id_modela
  7. FROM model
  8. WHERE model_name=model1
  9. LIMIT 1;
  10.  
  11. SELECT id_user
  12. INTO id_usera
  13. FROM users
  14. WHERE username=username1 AND password=password1
  15. LIMIT 1;
  16.  
  17.  
  18. IF id_modela='' OR id_usera=null
  19. then set poruka='Poglesan password ili nepostojeci model'
  20. else set poruka='Postojeci model i user'
  21. end if;
  22.  
  23.  
  24. INSERT INTO `car` (`id_oglas`, `id_model`, `id_user`, `stanje`, `godiste`, `broj_vrata`, `broj_sedista`, `registrovan`, `gorivo`, `horse_power`, `boja`, `servo`, `klima`, `opis`, `price`) VALUES (NULL, id_modela, id_usera, stanje1, godiste1, broj_vrata1, broj_sedista, registrovan, gorivo1, horse_power1, boja1, servo1, klima1, opis1, price1);
  25. select poruka;
  26. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement