Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Can I see your final code?
  2. I did a test of my own and my code works just fine with no need to modify the use of $filename. Try it. Don't know why you thought you had to play with the glob output.
  3. Don't know why the printf is needed. Here is how I would tackle it, no testing of course. I'll leave that to you. $files = glob("images/*.{jpg,png,gif,svg,jpeg,bmp,webp}", GLOB_BRACE); $cnt = count($files); $i = 0; foreach ($files as $filename) { $i++; echo " <div class='mySlides fade'> <div class='numbertext'>$i / $cnt</div> <img src='$filename' style='width:100%;'> </div> "; } Not sure what $filename actually contains but you can easily append anything needed to the src= attribute clause if it's not already there
  4. Or like this: include __DIR__ . "/../templates/$templateFileName";
  5. Your hosting provider doesn't manage PHP updates for you? What are you then paying them for? Backups? Do you have all error checking turned on for your app(s)? Any warnings or other messages coming up? And just how are you determining this slowdown?
  6. It would be extremely helpful if you tied the messages to the exact line that is giving you the error AND it definitely helps if you code only one instruction per line.
  7. Well as maxxd told you you have your if test backwards, assuming that he is interpreting what that other function is doing correctly. Try changing that php code and see if you're happier.
  8. We could help you (and probably someone will) but that could end up giving you encouragement to make a mess out of your next 'programming' problem and then where would you be?
  9. If you are not a programmer why oh why are you doing this?
  10. Good guess on that function's actions. I didn't even try to work out what that was doing.
  11. Since you seem to be questioning the determining of the is_wholesale value, perhaps you should show us that function? PS Since there are only a couple of rates to be dropped why bother with a loop to unset them. Just do the unset instead of setting up an array to loop thru. Can you unset a variable defined outside of the function from inside of that function? ****************** My Bad. Didn't notice the return of the rates array back to the caller. So definitely you s/b examining that other function.
  12. I think you are missing a single quote in your img tag as well. See below. echo "<td> <a href='https://www.tradingview.com/chart/P2500000/?symbol={$domains[$checkSqlRow["CHART"]]}' style='color:lime;' target='_blank'> <img src='\assets\img\Table\chart1.png\'/> $chart </a> </td>"; And perhaps that trailing backslash on the png filename is not necessary.
  13. Score one for the home team!!
  14. While I hate what you are doing your current problem is missing comma in the values of your query. Why not look at some real syntax in the official PHP manual to see how that is supposed to look. Read the part on prepared queries.
  15. So you want to do a query against 2 tables that exist in separate databases. No big deal. Make it look simpler. You want to query for a value in one table and see if it is contained in some record in the other table. Except for the referencing of the different db name, what is the real problem here? There's got to be more of an issue.
  16. I didn't get what that poster said anyway. Whatever did the word 'John' have to do with the OP's example? Beats me!
  17. Totally agree with macgyver. I wonder if the OP can give us a succinct description why he/she thinks this is something worth doing? OP - that last test with the printr call is not going to do anything for you. Look at your code again. PPS - Those titles are already variables in case you want to know. They are $list[0], $list[1] & $list[2].
  18. The OP has not been back in over 2 weeks. What's the fuss for now?
  19. How about this? $arr = array(1,2,3,4,3,2,1); $sz = count($arr); foreach($arr as $k=>$v) echo "$k:$v,&nbsp;&nbsp;"; echo "<br><br>"; for ($n = 0; $n < $sz; $n++) { $left = $right = 0; for($i = 0; $i < $n; $i++) $left += $arr[$i]; for($i = $n+1; $i < $sz; $i++) $right += $arr[$i]; echo "For middle #$n of {$arr[$n]} the left sum is $left and the sum right is $right"; if ($left == $right) echo "***!"; echo "<br>"; } I believe this will satisfy your task requirements. Hopefully it is not HOMEWORK that you decided to farm out. I took it as a small challenge and threw this together. If it were anything more than that I would not have done it without seeing your attempts, as Barand has asked about.
  20. You could setup a cron job that runs at midnight and generates the number and store it in a db table for every script to access when it begins.
  21. This paragraph makes no sense to me. Could you write it a bit more properly so it makes some sense?
  22. Well you have to change that echo. Of course I could also ask just why you are trying to echo that result array? Can you pare down your posting to just the parts that are giving you the problem. Way too much stuff here to make sense of what you're asking us to look at. LIke where is the submit that causes your error? And the form that contains that submit.
  23. So why is your code taking you to the error page? Cause your query isn't running most likely. Do the things I suggested and then test it. BTW do you have error checking enabled?
  24. $statement = $pdo->prepare($sql); $statement->execute(['id' => $id]); $member = $statement->fetch(); if (!$member) { http_response_code(404); header('Location: page-not-found.php'); exit; The above code should have a check on the $statement value to see if your query actually runs. And you could also add a check on the number of records returned before you try to process one. And just what does that response code thingie doing for you? You are producing your own custom error page so WTF code? And is the not found page located in the same folder as your running script? or in the list of locations to search?
×
×
  • 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.