-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
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
-
Try adding 'object-fit:contain' to your css to help the img stay inside your div dimensions.
-
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.
-
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.
-
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
-
Check your spelling....
-
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
-
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.
-
How do i query these lines in one single line someone help please??
ginerjm replied to Ronel's topic in PHP Coding Help
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 -
how to insert auto current date inside this tag please help?
ginerjm replied to Ronel's topic in PHP Coding Help
People usually post their 'fixed' code for others to see if they have a similar problem..... -
how to insert auto current date inside this tag please help?
ginerjm replied to Ronel's topic in PHP Coding Help
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) -
how to insert auto current date inside this tag please help?
ginerjm replied to Ronel's topic in PHP Coding Help
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. -
And I commented out the readfile line which is why they DID show up on my screen...
-
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.
-
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
-
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.
-
What in god's name does this code have to do with doing a file download?????
-
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.
-
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.
-
Huh?
-
And I have no idea how I solved this topic. Oh, well.....
-
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.
-
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.
-
What is the question here?