Jump to content

JoseN

Members
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

0 Neutral

About JoseN

  • Rank
    Member
  1. Mmm! I should be focusing in learning PDO then... Thanks a lot for all the help with these hands on practice I am going through.
  2. Thanks Barand! I did some research and I knew I needed to use the bind statement and I actually did but I never released that I didn't need to include the cid and mid variables in the execute(). I was adding them in there... Thanks a lot! I am still learning the PHP language and I was not aware of the PDO style. Which one is better to use? PDO or Mysqli?
  3. Still not working! It seems everything else is fine but this line... $stmt->execute( [ $cid, $mid ] ); I think the the statement is not executing. I did a small test.. it always return DIDNT WORK. if ($stmt->execute([ $cid, $mid ])) { echo'WORKED'; } else { echo'DIDNT WORK'; }
  4. Got it! Thanks! The Process Posted Data example code not working... I tested it and it is not inserting the data into the database table. Not sure if I am doing something wrong. The code goes in the same file right? Before the HTML form...
  5. Got it! Question.... why does the query doesn't return anything when running it like this: $res=$dbc->mysqli_query(); it does return data with your example but is it secure? $res=$dbc->query(); Why not running it like this? Just wondering... $res = "SELECT meal_id, description FROM meal ORDER BY meal_id "; mysqli_query($dbc, $res); // Run the query.
  6. Great! Thanks Barand! I am still trying to get the table to come show. It is now coming up with your example. I just get a blank page when I run it. The only thing I get is the Submit button.
  7. How about this? This is the SELECT query to get the names of the children. $q="SELECT childID, CONCAT(Firstname, ' ' ,Lastname) AS childname FROM Children"; This is the table... echo' <div class="table-responsive"> <table class="table table-hover table-bordered table-sm"> <thead class="thead-dark"> <tr> <th class="text-center" scope="col">Child Name</th> <th class="text-center" scope="col">Breakfast</th> <th class="text-center" scope="col">Lunch</th> <th class="text-center" scope="col">Snack</th> </tr> </thead> <tbody>'; while ($row = mysqli_fetch_array($r)) { // Print out the records echo' <tr> <td>' . $row['childname'] . '</td> <td></td> <td></td> <td></td> </tr>'; } //end of while loop echo' </tbody> </table> </div>
  8. Got it! Date for the timestamp! How would I do the table form with the checkboxes? I can't see a way to start it!
  9. Thanks Barand! Something like this? The user table I already have it.
  10. Hello Barand! I need some help again! I am trying to create a table like the attached image. The idea is to have this table with names coming from a users table... then be able to track the meals using checkboxes. The checkboxes checked would then be submitted via a button to a Meals table in MYSQL... I am thinking the table can be mealID, userID (Userstable), Breakfast, Lunch, Snack. The meals can be a tinyint datatype. I totally don't know how to start doing this... Thanks in advance,
  11. Thanks Barand! you mean broadcasting it here in the forum? it is just dummy data or you mean other way?
  12. Barand - I got it to work using the OnClick button! I was able to pass the userID and rewardID using only one button. Now when i redeem a reward for a specific user, it inserts the reward negative value to the points table just for that single user. The total points column now it looks better. I hope this definitely worked! I will test it later to make sure. I got a different question. Is it possible to hide or encrypt the names of the PHP files in the URL when an user is browsing them? For example, www.domain.com/view_users.php to something like this www.domain.com/tsds$ds.php After redeeming rewards
  13. With the data_id attribute will I be able to insert the reward value when clicking just one redeem button? the goal would be to just have one button in every record that will be able to insert the reward negative value into the right user and getting the right reward.
  14. I just did it.. when using just SELECT when clicking redeem for one user it shows the negative value assign to that user but also other users. In the screenshot attached I redeemed beer for George which the reward is 5 points, it assign the -5 to George but also to Sandy. That is not good! Lol
  15. Barand - Too good to be true! It is not working.... When redeeming a reward it inserts the negative values (reward value) to all users in the points table. I think it is because the userID is not being picked up when clicking the redeem button. Any ideas? Below is the current INSERT query which runs when clicking the button. Thanks in advance. $rewardid = $_GET['rewardID']; $qq = "INSERT INTO points (userID, loginTime, pointsEarned) SELECT usersTable.userID, NOW(), (0 - rewardListTable.valuePoints) AS redeemPoints FROM users usersTable, rewardsList rewardListTable, points pointsTable WHERE usersTable.userID = pointsTable.userID AND rewardListTable.rewardID = $rewardid GROUP BY pointsTable.userID";
×
×
  • 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.