Jump to content

All Activity

This stream auto-updates

  1. Today
  2. I decided to go with just one language, as I don't know Javasript well enough. Thank you for your response.
  3. You seem to be using two different languages here.
  4. Is it possible to take: $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $divebefore = $_POST['divebefore']; $HowMany = $_POST['party']; $mysqli = new mysqli('localhost', 'root', '', 'scuba'); $stmt = $mysqli->prepare("INSERT INTO bookings (name, email, phone, divebefore, HowMany, date) VALUES (?,?,?,?,?,?)"); $stmt->bind_param('ssssss', $name, $email, $phone, $divebefore, $HowMany, $date); $stmt->execute(); $msg = "<div class='alert alert-success'>Booking Successfull</div>"; $stmt->close(); $mysqli->close(); and then add it to this script if(return_data=='OK'){ $('#display_msg').html('Validation is ok') }else{ reload(); $('#display_msg').html('Validation failed') } $("#display_msg").show(); setTimeout(function() { $("#display_msg").fadeOut('slow'); }, 3000); }); Right after the validation is ok..... With the form button below that would send it. <Form type=post action=captcha-demo-data.php id=f1><input type=text name=t1 id=t1> <img src=captcha-image-adv.php id="capt"><input type=button id='reload' value='Reload image'><input type=button id=b1 value=Submit></form> <div id=display_msg></div> With all of this being on one page. basically I want the sql inserted into the database using javascript when they have the captcha correct.
  5. Yesterday
  6. Psycho - I would support your decision if you locked this topic. The OP just doesn't make sense even in his writing and certainly isn't showing any programmer's intelligence. Never knew of people who played games like you are describing on these forums.
  7. Programming, like any skills, is a matter of Crawl, Walk, Run. You learn by doing the very simple things, then build on that to learn intermediate skills, then (after a sufficient amount of time) you can learn to do more complex things. But, here's the thing. If you already know how to run a query against the database, you should already know how to work with an array and to build an output from it. Plus, the fact that you state you've been working with this language for two years and don't know these fairly easy tasks is incomprehensible to me. In fact, I am leaning towards the fact that you are a troll and just trying to get people mad based on your "not" understanding these things. I've even considered locking the thread.
  8. Of course it's possible as you say, but how else can I learn to understand it, for example, I don't write long code when it's confusing for any beginner, I always want to write shorter code in the first steps.
  9. @forum It appears you are of the expectation that when retrieving the results of a Database query, that you should be able to just do an "echo" of the results and have it written to the page in some way. That's not how this works (with PHP/MySQL or any similar languages as far as I know). If you think about this logically, you would understand that would not be very useful for the majority of use cases. Here are just a couple of reasons; How should the results be formatted? What works for one scenario would not work for the other 9,999 scenarios. Not all DB queries would be output to the page without other "post-processing". E.g. maybe the results should include sub-totals for different categories, or some records should be displayed differently (e.g. a negative amount in red. It would be extremely difficult if the results were returned in an "echo" ready format to do anything with the data. A database returns DATA in a logical data type that a programming language or other resource can work with. It is up to the receiving application to determine what to do with the data. If you want to run a query and have it output to the page in some standard format. Then just create a simple function and you can call that function every time you call a query. That is the beauty of programming, you can write a little bit of code to do something repetitive and reuse that code whenever and wherever you choose. You only have to figure out how to do it one. Also, there is a VERY easy way to output a multi-dimensional array in a readable format (albeit not in a table). I do this all the time to be able to debug output from a query. $query=$db->query("SELECT * FROM msg"); echo "<pre>" . print_r($query, TRUE) . "</pre>";
  10. I realized that now it’s very difficult to explain to beginners that they understood and remembered the form of writing code, I personally don’t understand this now, maybe when I don’t understand how to write correctly, but it’s all difficult and not clear, for example, as I wrote code, it's a bit clear to me what's going on in the code and it's easier to remember.
  11. You didn't follow what I wrote then. I specifically told you to use quotes on the array elements which you are not doing. And NO - you did not output all the values ... into columns. There is no html formatting there at all. How can you even think that you have put anything into a column??? I think you have more than a php problem. I made my post as simple as one can write this exercise in order to help you to follow my explanation as to what you have to do here. If you can't read it and follow it then I think my work here is wasted.
  12. yes, i read your post, in the last line i output all the values from the table into columns.
  13. Did you Read what I already posted before (or after) you wrote the recent post? It is not correct. And once again I don't understand what you are writing in that last line.
  14. I understand that this is very difficult. I wrote the code as it is clear to me and the result is also there, $query=$db->query("SELECT * FROM msg"); foreach($query as $row){ echo "$row[id]: $row[msg]: $row[login]: $row[time_msg]<br>"; } although for me it would not suit) but what to do if it was invented to write this php code
  15. Huh? Not sure what you are trying to say. But - did my last post help at all to make it clearer what and why the code should look like that? FYI - If you think that this little exercise is a lot of code you should realize that most php programmers write this kind of code all of the time, surrounded by a lot of other code that creates the data thru manipulation, calculation or concatenation with other data. This is programming. And wait until you get to the point that you want to write really fancy looking output and have to learn CSS. And then add some JS or JQ to add some client-based interactions with the user. That is what you have to look forward to.
  16. Yes, I know html, but I also thought that I knew PHP, but I decided to display the entire table and it turned out that I don’t know how to do it,))) I thought that I would write the variable into which we make the request in the echo, and that’s all, and then it turned out that not everything is so simple, the brain does not want to perceive what is already in the row table, but they need to be connected through a sampling cycle, so many actions are not clear why, I understood when it was necessary to compare something line by line or something look in the table, but why such difficulties in the usual output here is not yet possible to understand, you just need to agree this is how it should be)
  17. well, Thank you, Kicken. I have worked very hard on this project. Honestly, i learned on my own how to do this reader/scanner. I did not use anything from your code. Your code does not read addresses and jump to their offsets. I had to think about it and i came up wih a solution. I am proud of my work because i am not a programmer. I am very happy that i am reading and scanning a jpeg and accurately extracting data. I laugh because my Windows 10 does not show a date for the Blacksmith image but i have the datetime stamp from the exif data. I beat MS at this game, LOL. I am not arrogant or anything like that. I am surprised that i am able to do this. I still have to extract a few things, then i need to optimize the code etc. I started from scratch because i tried to upload an image that my Wife made using an old Motorola phone and your script almost crashed my Edge browser. I found out that the image has extra data after the EOI marker, so your code took almost 12 seconds to display the data. I decided that i need to build my own script from scratch. I needed the Motorola image to learn how the byte order works. I now process her image with no problems and even extract the exif data. the scanner is meant to be used with my upload script. I made another video to show the script in action. I tested with several code injected images and tried various file violations to see how my code handles the situation. anyway, i have learned alot by reading exif metadata turorials and thinking about how to extract this data. I finally learned how to unpack the various data types. I still need to learn how to unpack the cm resolution since it is different. I will do that eventually, my next step is getting the image dimensions, then processing the thumbnail data. Best wishes, John
  18. hi, I have installed java 8 twice in my MacBook Pro, that I downloaded from here, https://www.java.com/en/download/manual.jsp (a fairly new MBP, running Ventura 13.2.1) but when I do "javac" in the terminal it cannot find a java installation.. so I looked in Library/Java/ only to realize all it's "installed" is two empty folders: Library/Java/JavaVirtualMachines/ (this is EMPTY) (and another one, I don't remember the name of the it, also in Library/Java/, it's also empty.. I have since deleted Library/Java..) now I just tried installing it again a third time, and this time it did not install anything, there's no "Java" dir in Library/ I would appreciate some help.. I have installed java before, both on windows and macs... I don't know what could be the problem here... thank you..
  19. Here is a slight reworking of the previous code that might make it easier to follow: $sql = "SELECT * FROM msg"; // write a query $results = $db->query($sql); // run the query using a database connection // already made somewhere previously // Start an HTML table to display the results echo "<table>"; echo "<tr> <th>ID</th> <th>Message</th> <th>Sender</th> </tr>"; // output the table headings row // Loop through the rows of data and add them to the table while ($row = $results->fetch(PDO::FETCH_ASSOC)) { // begin the loop code // process the currently fetched row of query results echo "<tr>"; // start an html table row echo "<td>" . $row["id"] . "</td>"; // put an element into the row echo "<td>" . $row["message"] . "</td>"; // another element echo "<td>" . $row["sender"] . "</td>"; // another element echo "</tr>"; // end the current row } // end of the while loop // Close the HTML table echo "</table>"; exit(); Note the use of semicolons at the end of each php line except the while line which relies on the {} to end the line. Note also the use of periods to concatenate elements of the echo statements. Note the user of the brackets and quotes to access each element of the $row array (which fetch provides you). Don't know what else I can do to make this easier to comprehend other than a strong recommendation to RTFM. Programmers have to do that.
  20. Actually this last post of the possible code for you is SO simple. It is using very little PHP and more of HTML. 1 - Query - the command that runs a query statement to produce the results you want to see 2 - echo - a statement that sends output to the client 3 - while - a loop starting statement which allows one to repeatedly process a given set of data. In this case that data is a result row from the query. The code included in this loop is wrapped, aka, contained, by a set of braces, ie, {}. 4 - Fetch - the command that returns one row of the query results to you for processing Look up these commands in the manual. If you don't know how yet, here is the link to the Functions chapter of the manual: https://www.php.net/manual/en/funcref.php There is a search box/field in the upper right of the page. Have at it. So simple - just three php commands being used. Now how long can that possible take to learn. Basically this little block of code runs a query to : - collect some data; - begin an html table - start loop on the query results that gives the script one row to read at a time - the loop code outputs a line of an html table The table elements (HTML) are <table>, <tr>, <th> and <td>. - at the end of the loop the html table is closed. The rest of the code is using more echo statements to send the necessary HTML table elements to the client to present the output in a readable format. I am going out on a limb and stopping here since I hope you understand html.
  21. I'm not sure what you're talking about with storing two copies of the image. None of my code does that, at worst the version with the hex dump stores one copy. The version without the hex dump doesn't store anything, as shown by the low memory usage above. The hex dump stuff was there purely as part of the example/demo to help see how the data is structured, of course it's not something you'd be putting into a final result so why complain about it? Maybe you think it's storing multiple copies because the functions read data into an array and return it, which then gets copied into another array, but that's not how PHP works. PHP uses something called copy-on-write, which means if you just assign a value to another variable then both variables refer to the same data in memory. The data is only copied if you attempt to change one of the variables values in some way. Since my code never modifies the contents of those array's after their initial creation, they are never duplicated and thus there's only one copy of them in memory. Of course, my code was never intended to be a full parser, just a small demo for your benefit to show how one goes about reading and parsing the binary data of a file. Since the file reference guide only showed details on the JFIF header, that's all I bothered to implement. It is enough of a demo that you should be able to extrapolate from it how to parse whatever other structures you want. Congrats, it's always nice when you can finally see something working.
  22. Oh, I'm completely confused here, I won't be able to write this for a long time))))
  23. Yes, this code format is hard to remember, it seemed that everything would be simple, but no, everything is somehow complicated
  24. I always look at the result. This is a language I have been studying for 2 years, and still I don’t understand how many students do some moments, that’s why I ask questions because I don’t understand it,
  25. That appears to be an unfixed compatibility issue in the extension.
  26. CommonMark is not compatible with PHP 8 yet. https://github.com/krakjoe/cmark/issues/21 Uninstall, then try downloading this version and phpize ./configure make install
  1. Load more activity
×
×
  • 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.