Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Really? I have no idea what you asked so I surely don't know what all those lines of code are doing. Perhaps you can go thru it yourself and see where you need a sort to happen.
  2. The general way of doing what you want is to first display the input form and have a button to either cancel/return from it or to Submit it. That form should go to your update script which needs to do what Kicken has said - check if the form has been POSTED to your update script. If it is not from post then do a header call to go back to the input script. If it is from the input script you then retrieve and check the input values and only THEN do the db update.
  3. I believe that your JS should be in the admindashboard script not the delete script. <script type='text/javascript'> function confirmDelete() { if (confirm('Are you sure you want to delete this record?')) return true; else return false; } Use the above function like this: <input type="submit" name="search_by_roll_no_for_delete" onclick='return confirmDelete()' value="Delete"> You can use shorter names for your fields. Saves on typing
  4. If you had tested whether or not the 'open' ran successfully you would have received an error message. Try taking the leading dot off your filenames. if (!$file1 = file('data.txt', FILE_IGNORE_NEW_LINES)) echo "Could not open file1<br>"; if (!$file2 = file('data1.txt', FILE_IGNORE_NEW_LINES)) echo "Could not open file2<br>";
  5. You need to ensure that the files are in the same sequence or else you have to loop thru one file and compare each line to ALL of the lines in the other file. Plus you have to be sure that the files are all using the same case or else convert each file to a single case and compare them.
  6. It doesn't look good to me. There are no values in it. Show us what it will look like when it actually runs. Echo just before calling query function
  7. A lot of wasted coding here but have you tried echoing out the update query an looked at it to see if it is what you want? Hint - All input tags will always be set in the POST array (except checkboxes and radios(?)) so the use of isset doesn't ensure that your user has provided any required input values.
  8. If you are just starting out with PHP and database access I (and many others here) would strongly suggest that you use the PDO interface to access your data instead of mysqli. It is much easier to use/code and provides an easy way of doing whatever you need to to with your data. And as for your post. Yes - always post your code here. And not an 'image' of your code but the real thing so that we can easily read it and even copy and paste it into our own editor to work with it. Use the <> icon at the top of this window to place all code in its own window in the middle of your post.
  9. And -- why are you moving one array into a new array? Just do your loop using a fetch on the results instead of doing an unnecessary move. And also why are you then moving your values from the table array to discrete variable names? Another waste. At that point you have your data stored in 3 places - the query resource, the table array and a set of distinct vars.
  10. I was frustrated with you when I gave you my version of what should work for you and you complained that it didn't run properly but you NEVER want to show how you included it into your script. How can we help you if you don't show us what you did???? Enough. Are you happy? If not post the part of the code that is giving you a problem. It will be be PHP code, not CSS or JS or HTML. And if there is an error message put a line (comment) in that post telling us which line is the error line. Then we can see it and probably tell you what is wrong.
  11. It is not that you ask questions. It is when you are provided solutions and you don't use them. It is when you are asked to show how you used that code so that we can help debug it and you don't.
  12. Good luck with that being tried out. OP seems to not like receiving good examples of how it should be done.
  13. My typo . Correct $row['file_name'] please. Suggestion for the future. Don't use upper and lower cases in your table names and php variable names. Just makes for a headache when trying to debug your code because you used the wrong letter.
  14. Way too much code. // query for all id values and sort by id // no need to do a new query for each id!!! $game = "SELECT file_name, Game FROM images WHERE 1 order by id"; // run the query for all records $qresults = $db->query($game); // provide a path name to the images if you are not already storing (and you shouldn't be anyway) $pathname = (where images are save if not in the table column); // now loop thru all the query results and output the div to show them in while ($row = $qresults->fetch_assoc()) { echo " <div> <img class='w-100 mb-2 bg-dark' src='" . $pathname.$row['filename'] . "'> <center>$row['Game']</center> </div> "; } This is what I think you need to do Hopefully it is correct mysqli code ( I said already that I don't use mysqli) Plain and simple without all of the div tags you are using (why?) but it should show you all the results including a path name as suggested by Barand above.
  15. Show me the block of code that sets up your divs and does the query and makes the output. I don't deal with images I only deal with code that I can see and check. Without a full block of logic to analyze I am wasting my time.
  16. Since you are not cooperating with my requests to see the new code I have to retire. Good luck not listening.
  17. I can't until you SHOW it to me. Please post the changed code so that I can see what you are running. Not the index file, not the css or connection file -- just the part that is failing
  18. Show us the NEW code and mark the error line
  19. But that use of "fetch()' is invalid. You've already been told that.
  20. The config file is making the connection so that is not the problem. Nor is a stylesheet giving you an error. Your main line code is the problem. What line is the error message pointing to? The line that does the fetch still?
  21. Show us the code so we can both know what is going on.
  22. As I said --- it was my error putting a pdo---like call into his mysqli environment....
  23. The code that is giving you the error! The script that we have both been looking at.
×
×
  • 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.