Jump to content

gertjanmeire

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gertjanmeire's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you! This worked for me, although I had to change the syntax a little bit to make it work... $sql = "UPDATE users SET score_points = score_points + :score_points, mood_points = CASE WHEN mood_points + :mood_points > 99 THEN 100 WHEN mood_points + :mood_points < -99 THEN -100 ELSE mood_points + :mood_points END WHERE id = :id"; I did not know you could do this in SQL
  2. Hi there, I'm currently trying to update a value in my DB, and it works great (I'm using PDO prepared statements btw). Only problem is the number I'm inserting gets added to the current value that's in the DB, but I want it to have a MAXIMUM value of 100 or a min value of -100. I want to check if the current value in the table + the value I'm adding will be higher then 100 or smaller than -100, if so I'd like it to have a value of 100 or -100. This is my code so far: (the value I'm talking about is "mood_points = :mood_points) function updateMoodAndUserPoints(){ $db = Major4PDO::getInstance(); $sql = "UPDATE users SET score_points = score_points + :score_points, mood_points = mood_points + :mood_points WHERE id = :id"; $params = array( "score_points" => $_POST['score_points'], "mood_points" => $_POST['mood_points'], "id" => $_POST['id'] ); $stmt = $db->prepare($sql); if($stmt->execute($params)){ return true; }else{ return false; } } Any help would be appreciated!
  3. Hi there, My name is Gert-Jan and I'm a student Digital Design and Media at Howest in Kortrijk, Belgium. I'm currently in my 2th year and will have to do an internship next year if all goes well with my exams! I'm joining this forum because I will probably specialise myself in back-end development being PHP/MySQL and some Javascript. I hope to learn a lot on these forums and hope to be able to contribute to the PHP community as well. I do have a question though: I've been googling lately and it seems that the demand for PHP developers is quite high in most agencies... I was wondering if this is true and what the industry expects from students wanting to to internships or do a job as a php developer? I currently have some experience programming PHP/MySQL as well as using the Smarty Templating system, so I'm not a complete noob! ^^ But I was wondering what u guys could recommend me to specialise myself even more. I would also like to get participated in some opensource PHP programming, but have no idea where to start with all of this... So any help would be appreciated! Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.