Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. The two lines that you showed us would NOT do the query you have been asking for help with. If you are changing topics then it's time to begin a new post. Your query as posted 2 hours ago will only select those records having a (supposed) date that matches '03/18/2023' which is a totally improperly formed date stored in a db table. I realize that you began this post worrying about just such a thing but to show this code now that the problem has been covered and (supposedly) resolved and say that "it works" is not true. The code does not match 'only the month and day' but matches ONLY the exact record value that includes the month, day and year as well as 2 slashes.
  2. You're missing Barand's point. You are showing us code that uses today's date to select birthdays from your database. That code will not select anything at all unless you are running something different than what you posted here.
  3. Soooo close! Try this since the execute wants an array as its argument: $stmt->execute([$Name]); Adding the brackets turns that arg from a string to an array. Voila! BTW - one should not use the * for a list of fields in the select statement. Always specify what you want to retrieve. As in: $q = "select Name_F, Name_S, DOB from ....... ' BTW #2 - is your table name really PDO?
  4. PHPMailer worked for me first time with very little setup after downloading it.
  5. As Barand has said - you really should have gone into your code to find the places that this function is being called and ensure that you are sending an array to it. Obviously your approach has a 'bug' in it to be sending the invalid argument to this function. OTOH - if you don't want to do this work - you could have simply added a test at the beginning of the function for is_array() and if it fails simply return a null or whatever you are expecting from this function. Your convoluted expression makes for difficult reading when someone else comes along and tries to figure out your code. As in: function orderByDate($items) { if (!is_array($items)) return null; // or something ... ... ...
  6. YOu are doing some math with bytes. But you are also trying to calculate something you are calling a 'width'. What is a width when you're looking at file and table sizes?
  7. You do see what you were doing wrong before, yes? Here you simply swapped out an incorrect if statement for a different one that did a proper test. Should have used if ($CCQry == 0) not = 0
  8. These statements are incorrect - I've shown you one. Look for similar mistakes. if ($MileageQty = 0){ return; You are not testing anything. You are making an assignment.
  9. Well it isnt in the php code so it has to be something that is being called somewhere and that is probably in one of the included JS files. What does your html body tag look like?
  10. Images are one thing, but you are looking for code help. Where is that code? Although if it is JS, perhaps you need to post that in a JS forum unless it is something that PHP people can handle. I'm one of those that gets by with JS but not when it gets huge. I'm assuming that that output is being generated from the JSON data you built at the end of the php code.
  11. Ok - I see that you have the code to display your entire db results with counts by rating as well as an average. Not sure by what you meant in your 1st when you said 'not displaying count'. Other than the display of all of the review data I don't see any other displays so maybe you need to add another echo or something to display whatever var has this count in it? Or you could point out the line(s) where you believe that this count should be getting displayed? Other than that this is some fairly nice code, considering what we normally see here. !!
  12. As Gizmola says, you show us 2 huge blocks of html code but no 'real' code. How do you expect us to 'fix' the code without seeing any of it? And - we don't really want to see ALL the code. Mostly we like to help those who have made an effort to locate the possible problem area and help them straighten it out if it can be done. PS - do you have php error checking enabled to possible point out something that is not working ?
  13. My learning for the day...
  14. oops I see that I type an extra left paren. Please fix.
  15. I think that Kicken gave you same information that I was typing for you. Seems like we agree on all those things. Hopefully you can step back and work out what we are saying and how you have to think about your coding practices. I said I was backing away an hour ago. Now I think I will.
  16. Actually the first block of code you provided was addressed and you then showed us how you altered it. That was good except it had some errors which were then resolved - or so we thought. Changing a var form $conn to $pdo was simply a choice someone offered to make it clearer what was done. You can stick with $conn. Use of $pdo is more meaningful since the var represents a 'pdo connection'. The change of a var name from one thing to another I didn't catch but so what - change it back. Adding a result var to the call to connectDB function was a necessary thing because otherwise the connection that the function made wasn't available outside of the function. And the addition of the pdo connection var to the functions parms was necessary to pass the handle to that function since you were told that it was undefined. All important things that were necessary.
  17. foreach ($users as $key->$data) { list(($userid, $name, $cardno, $uid, $role, $password) = $data; if ($cardno == LEVEL_ADMIN) $role = 'ADMIN'; elseif($cardno == 'LEVEL_USER') $role = 'USER'; else $role = 'Unknown'; } Not sure what is supposed to be the result since you are doing the same thing for every array element. I suppose you might do an output as the last line of the loop such as: echo "$key is $role<br>";
  18. What am I supposed to "sort out"? You are writing some html which includes a bit of PHP code (I suggest NOT using short php tags) (and also not mixed-case PHP vars) which will output something that is derived by a PHP function that apparently uses a db to provide data which is then returned to be displayed. So what is wrong with this? Looks good to me!
  19. I think that posting this on a PHP forum is probably not the way to go. I am unfamiliar with .Net and don't even know if it uses PHP. But PHP is all about web-based programming for sure. We are trying to help you do something in PHP but apparently you are not dealing with PHP. No wonder things are so confusing - for you and us.
  20. I think that everybody who has contributed to your topic IS a web-based programmer. Why did 'microsoft.net' suddenly make an appearance here?
  21. I think I'll back out now. Thought I could offer some comfort but I think that I cannot. Good luck.
  22. What are you telling us here that we don't already know? PHP does allow for an unequal amount of arguments as long as the last ones have a default value in the function's header. function MySchholResults($pdo, $user, $class) { } $x = MySchoolResults($user, $class); The above would not work of course. And I assume that you are demonstrating how the new db connection would be implemented. But the workable way would have to be : function MySchholResults($user, $class, $pdo) { } $x = MySchoolResults($user, $class, $pdo); to make it easier to do all these updates you have ahead of you. Of course the spelling would have to be corrected.
  23. What does this array look like? Is it an array of arrays or just an array of values? Your two examples are confusing.
  24. Yes - the rowcount may not work but I am so used to it working on my host that I didn't remember that weakness of PDO.
  25. If you have 'hundreds of web pages' all making a db connection someone spent a lot of time doing unnecessary coding. Do you have other apps written the same way? Sounds like a career completing any kind of update/maintenance at your place. We are trying to help you see how simple this could be and I can understand that it is giving you a scare as you realize what we are telling you. Without us being able to see this nightmare for ourselves it would be difficult for us to help you find a work-around to implement a change in your db interface. It sounds like there has to be changes made to all of these 'hundreds of web pages'. Without seeing anything I can only offer that one solution would be to use a new function name for your database connection, include it into every script that you have, call it at the start of that script and then find every usage of the current db connection function and comment out all its uses and start using the assigned db connection var for any db operations.
×
×
  • 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.