Jump to content

phppup

Members
  • Content Count

    514
  • Joined

  • Last visited

Community Reputation

0 Neutral

About phppup

  • Rank
    Prolific Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @requinix I don't know EXACTLY what you think I should "look carefully" and hope to see. If it was obvious, i'd have already spotted it, and not have asked the question. The best I can summize that you're eluding to is that errors occur. But do those errors affect the end result? In an instance where I do, in fact, know what tables are in my db, the question is even more appropriate: was NOT EXIST created for only lazy db designers?? Or is there a realistic usage?
  2. I have discovered that if I try to create a table within a database, and the table name already exists, the existing table remains intact. It does not get overwritten or removed. And my code has error messaging to indicate the disparagy. Likewise, there is built in SQL errors that will be thrown (if made visible). So, is there any benefit to using: CREATE TABLE IF NOT EXISTS as opposed to just CREATE TABLE when writing code??
  3. I have a form with several text fields. For example (sorry, no code insert option on my phone) I would like to scan the INPUTS to determine which fields were left empty. Using !isset (to the best of my knowledge) would require that I list each input individually. Is there a PHP alternative that, similar to JavaScript, would allow me to evaluate every INPUT or TEXT field to then list those left empty?
  4. You need to RUN the script. This is done by calling it. If your DOMAIN NAME is:. mydomain And the file in the root folder is xyz.php Then, open a browser and type in the address bar: mydomain/xyz.php Another tip: You can remove the: include_once("db_connect.php") and replace it with the actual connection information DIRECTLY in the script. This is NOT an optional method to use, but a good troubleshooting technique to determine whether a connection problem is due to the scripting code or the connection code. Once everything is working, you can expand an
  5. I hope this entry finds everyone safe and healthy. I am trying to extract table data and schema info from a database WITHOUT knowing the field names. Essentially, I want to connect to the database and have the information for each table deposited into an HTML format (just like I'd see if I accessed the db directly). I've found several methods online, but all use DEPRICATED coding that will no longer function. Any code or links to assist in resolution would be appreciated. Stay safe, and thank you.
  6. Thanks. I use Procedural, but will try to adapt your modifications. I think I see your logic here although these two lines have me a little confused (regarding their Procedural translations). $updatedID = $_POST['IDs'] ?? 0; $message = $updatedID == $row['id'] ? $msg : ''; // is this the row that was updated? Also, can I use prepared statements with Procedural method. Looked a few times and didn't find a clear confirmation.
  7. Sorry, lost tiny pieces in effort to cull personal comments. $sql = "UPDATE $table SET comment='$comment' WHERE id=$IDs"; if (mysqli_query($conn, $sql)) { echo "Record updated successfully for $IDs"; //appears at top of table and confirms $IDs value is active } else { echo "Error updating record: " . mysqli_error($conn); } $sql = "SELECT * FROM $table "; if($result = mysqli_query($conn, $sql)){ if(mysqli_num_rows($result) > 0){ echo "<table>"; while($row = mysqli_fetch_assoc($result)) { echo "<tr>"; echo "<td>id: " . $row['id']. "</td>" ; ec
  8. $sql = "UPDATE $table SET comment='$comment' WHERE id=IDs"; if (mysqli_query($conn, $sql)) { echo "Record updated successfully for $IDs"; //appears at top of table and confirms $IDs value is active } else { echo "Error updating record: " . mysqli_error($conn); } $sql = "SELECT * FROM $table "; if($result = mysqli_query($conn, $sql)){ if(mysqli_num_rows($result) > 0){ while($row = mysqli_fetch_assoc($result)) { echo "<td>id: " . $row['id']. "</td>" ; echo "<td>Name: " . $row['firstname']. "</td>" ; echo "<td>other: " . $row['other']. "</
  9. The success message that displays at the top of the table is part of my UPDATE statement which runs separately within the script before this SELECT display. I have tried several variations to get a message next to the submit button. Here is a current effort that displays the same message at each iteration of a row. if(isset($IDs) { echo "Variable is set.<br>".$IDs; } The above is displaying the message at all rows while confirming that $IDs is, in fact, grabbing the correct row ID number. Also confirmed in my SUCCESS message. if(isset($IDs) && $IDs == 3) {
  10. Updated with same issue: echo "<td> <form method='POST' action=''>"; echo "<textarea name='comment' cols='30' rows='5'> " . $row['comments'] . " </textarea></td>"; echo "<td> <input type='submit' name='submit' value='Save text' />"; //echo "<td> <input type='submit' name=' " . $row['id'] . " ' value='Save text' />"; //tried but didn't work echo " <input type='hidden' name='IDs' value=' " . $row['id'] . " '> "; echo "</form></td>"; Either way, I get a success message at every butto
  11. i currently have the submit name corresponding to the $row["id"] so I'm not sure if venturing away from that course is going to resolve the issue. The problem seems to be more with using the write IF statement to segregate the selected button.
  12. I believe this is a PHP issue and NOT an HTML question based on the source of my frustrations. I am populating a table with data from a database. if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["comment"]. "<br>"; echo "<input type='submit' name='submit' />" ; each row has a submit button for comments pertaining to the specific ID so that comments can be edited with an UPDATE statement. I have a success message that displays a
  13. @kicken I'm beginning to see your point. And thank you for your patience. One last thing, since you mention the temporary directory with random file naming: Assuming the same scenarios, are random names somehow discarded after use? Is there a possibility of a random name being repeated? If I used a naming convention of timestamp and sequence number and temp_name could a conflict STILL occur (albeit a slim chance) when multiple uploads occurred simultaneously? PS: I am realizing the benefit of using a db, but the addition will take some re-tooling. Thanks again for the
  14. @kickenMy example was only meant to indicate that the uploaded images for each person would be sequentially numbered as a full batch without interruption regardless of quantity. If Linda uploaded 4, her four files would remain together, if Ricky uploaded 132, all 132 would run the next sequence of numbers. So getting back to my original question, how will PHP handle an instance where two (or more) uploads occur at exactly the same time and create the same file name (which is possible even when using a timestamp or random number)? [I mean, I haven't actually tried it, but what
  15. @mac_gyver @kickenI guess I should elaborate somewhat, by clarifying that I want all the uploads in one single folder. For example, I go to a concert and stand at center of the audience. Linda is on the left aisle and Ricky on the right. We each take 20 photos that we all upload to a single folder. They will all be stored and renamed as "Concert" followed by the sequence number (ie. Concert_1, etc). My only real concern (at this point) is an attempt to avoid sequence conflict or shuffling of images. Ideally, I would want the total of 60 photos to be numbered so that the fi
×
×
  • 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.