Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. That means your query failed. output the error message that comes from the query call. Sorry - that was partly my fault. I only use PDO, not mysqli and so my function name was incorrect. BTW pdo is a much better interface. If you are a noob I strongly suggest learning pdo instead of mysqli
  2. Try adding 'object-fit:contain' to your css to help the img stay inside your div dimensions.
  3. So - as I said - do your php code at the beginning of this code. Then begin the loop $game = "SELECT file_name, Game FROM images where 1 order by id"; $qresults = $db->query($game); while ($row = $qresults->fetch()) { echo " <div class='card-body p-2'> <img class='w-100 mb-2 bg-dark' src=\"{$row['file_name']}\"> <center>{$row['Game']}<center> </div>"; } The div can be setup with a width and a float to position them as wide as your body is and then they will wrap.
  4. Is 'file_name' the name of the image? I am not really sure at all what you are trying to do. All those divs! And 2 queries. Why 2? And all the in-and-out of php mode. Why? Do you php at the top. Get the query results. Then begin your div(s) and loop thru the query results and output the image tag that you need. I am guessing that your two queries are to get two specific images - one for id of 1 and one for id of 2.
  5. To clarify here is an example from the PHP manual: $stmt = $dbh->prepare($sql); $stmt->bindParam(':val', $val, PDO::PARAM_INT); $stmt->execute(); $lastId = $dbh->lastInsertId(); I found this with the following: https://www.php.net/manual/en/pdo.lastinsertid.php
  6. Check your spelling....
  7. To answer your question I went to the Go To resource for everything PHP & PDO - the manual. BTW - might be a good idea to add a parm to your connection logic to allow you to pass the dbname into it
  8. Here's a link (that I did a google search for) that may give you some better idea of how to write a query. https://www.mysqltutorial.org/mysql-select-statement-query-data.aspx
  9. Have you used google to find a mysql source (aka manual) that can teach you about writing a select query? BTW -- it is not a good practice to use the asterisk in your select queries. Always specify the column names you want to select. Makes it easier to edit later on when you want to make adjustments of if you are looking at someone else's code who hasn't learned to not use it.
  10. What requinix is possibly saying is to use a WHERE clause that includes all of your 'ifs' in one query statement. You may want to use an ORDER BY clause at the same time. Suh as: Where fld='xxx' or fld == 'yyy' or fld ='zzz' order by fld
  11. People usually post their 'fixed' code for others to see if they have a similar problem.....
  12. Here is what you should see if you actually tried out your code like this: $outgoing_date = "CURRENT_DATE()"; echo "1. outgoing_date: $outgoing_date<br>"; $outgoing_date = date("Y-m-d", strtotime($_POST['outgoing_date'])); echo "2. outgoing_date: $outgoing_date<br>"; And the output of this: 1. outgoing_date: CURRENT_DATE() Notice: Undefined index: outgoing_date in /home/albany/public_html/homejg/test.php on line 19 2. outgoing_date: 1969-12-31 (Line 19 is line 3 in my above code)
  13. No I don't think that will work. Perhaps you can see what the errors are if you LOOK at it a bit longer. The very first response to this topic was truly exactly what you asked for though. Although I don't know what you meant by using the word "AUTO" in your request.
  14. And I commented out the readfile line which is why they DID show up on my screen...
  15. The code you posted above has those errors in it. It Has to throw errors. I suggest that the code you posted it NOT the code you are running. It happens.
  16. Nor is $ip defined inside the function. That is 2 errors you have besides the line I addressed. This is what I get when I run an edited version of your script: Notice: Undefined variable: ip in /home/albany/public_html/homejg/test.php on line 58 Notice: Undefined variable: ip in /home/albany/public_html/homejg/test.php on line 59 Notice: Undefined variable: pdo in /home/albany/public_html/homejg/test.php on line 60 Fatal error: Uncaught Error: Call to a member function query() on null in /home/albany/public_html/homejg/test.php:60 Stack trace: #0 /home/albany/public_html/homejg/test.php(30): mydloader('file.deb') #1 {main} thrown in /home/albany/public_html/homejg/test.php on line 60
  17. Try changing this line: header('Content-Disposition: attachment; filename="$filename" '); AND - I don't believe that you are not getting any error message. You have not defined the pdo connection inside that misplaced function that is trying to do a query and update.
  18. What in god's name does this code have to do with doing a file download?????
  19. Ok - so tell us what you want to do. What table do you want to update? What columns do you want to change? What is the record key that selects the record to be updated? From that we can write a query statement for you. But - you should also be able to write it if you can answer all of my questions.
  20. I think you have an error in your options array. An extra comma at the end perhaps. CURLOPT_HTTPHEADER => [ "Content-Type: application/json", ], <<<<< ]); If you have error checking enabled and on I would have thought this to be caught.
  21. And I have no idea how I solved this topic. Oh, well.....
  22. You call my comments a solution? Why? All I did was give you some pointers on how to resolve your issue maybe. At least it will give you some direction I hope. It may not be the 'solution' though.
  23. Have you added any debugging code? Something that verifies that you are not creating any errors? LIke when you do a prepare do you check the result? When you run the query do you check if it ran? Do you have error checking enabled and turned on? All important things when you are having problems to solve. Echo out the results of things when you don't think you are getting the right answers. All part of being a good coder.
  24. What is the question here?
×
×
  • 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.