Welcome Guest, Not a member yet? Register   Sign In
Image upload problem
#5

[eluser]haris244808[/eluser]
[quote author="TheFuzzy0ne" date="1363961677"]Sorry, I thought that the upload library overwrites existing images by default. It turns out that it doesn't. Even still, my idea should still work. Just use the user's ID for the image name, which you should be storing in the session anyway. Then you know what to delete, you just need to figure out the extension.

If you only want the query to execute if an image has been uploaded, then why are you executing it before you perform validation? Also, if you're only expecting a single result (since you're grabbing a user by their ID), why are you looping through the results? That should only be returning a single result, or FALSE. I assume this is as obvious to you as it is to me, so perhaps I'm misunderstanding the question?[/quote]

im looping through each result because i return an array:

here is the model i user to return the results:
Code:
function select_user_by_id($id){

  $sql = "SELECT * FROM users WHERE id = ?";
  $user_query = $this->db->query($sql, array($id));

  if ($user_query->num_rows() == 1) {

   return $user_query->result();
  }
  else{

   return false;
  }
}

so to get only the picture name i have to loop throug results in controller...

if you know a better and faster way, pls tell me... i will appriciate that Smile


Messages In This Thread
Image upload problem - by El Forum - 03-21-2013, 09:27 PM
Image upload problem - by El Forum - 03-22-2013, 05:48 AM
Image upload problem - by El Forum - 03-22-2013, 06:31 AM
Image upload problem - by El Forum - 03-22-2013, 07:14 AM
Image upload problem - by El Forum - 03-22-2013, 12:37 PM
Image upload problem - by El Forum - 03-22-2013, 01:13 PM
Image upload problem - by El Forum - 03-22-2013, 03:42 PM
Image upload problem - by El Forum - 03-23-2013, 01:38 AM
Image upload problem - by El Forum - 03-23-2013, 03:00 AM
Image upload problem - by El Forum - 03-23-2013, 03:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB