Guest User

Untitled

a guest
Feb 15th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. const userSchema = new Schema({
  2. mode : {type: Number, required : true},
  3. name : {type : String, required : true},
  4. surname : {type : String, required : true},
  5. email : {type : String, required : true},
  6. phone : {type : Number, required : true},
  7. community : {type : String, required : true},
  8. city : {type : String, required: true},
  9. password : {type : String, required: true},
  10. instagram : {type : String},
  11. facebook : {type : String},
  12. twitter : {type : String},
  13. portfolio : {type : String},
  14. tutorial : {type : Boolean, default : true},
  15. ban : {type : Boolean, default : false}
  16. });
  17.  
  18. const OffersSchema = new Schema ({
  19. id_advisor : {type : String, required : true},
  20. title : {type : String, required : true},
  21. short_description : {type : String, required: true, max : 150},
  22. description : {type : String, required: true},
  23. price_max : {type : String, required : true},
  24. start_date : {type : Date, default : date},
  25. end_date : {type : Date, default : end_date},
  26. finished : {type : Boolean, default : false},
  27. id_user : {type : String},
  28. paid : {type : Boolean, default: false},
  29. city : {type : String, required: true},
  30. transation_id : {type : String}
  31. });
  32.  
  33. const resultOffers = await Offers.find({city : req.user.city}).sort({start_date: "desc"});
  34.  
  35. {{#each resultOffers}}
  36.  
  37. $consult1 = "SELECT * FROM usuarios WHERE city = '$city' ORDER BY start_date DESC";
  38.  
  39. $result1 = mysql_query($consult1);
  40.  
  41. while($row = mysql_fetch_assoc($result1) {
  42.  
  43. $id_advisor = $row['id_advisor'};
  44. $consult2 = "SELECT * FROM users WHERE id = '$id_advisor'";
  45. $result = mysq_query($consult2);
  46.  
  47. while($row2 = mysql_fetch_assoc($result2) {
  48.  
  49. $name = $row2['name'] // AQUI TENGO YA EL NOMBRE
  50. }
  51.  
  52. }
Add Comment
Please, Sign In to add comment