Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Looking at this code, it suggests that you're developing a larger application. First, read up on <a href="http://php.net/manual/en/language.oop5.php" rel="nofollow">PHP OOP</a>. Learning this rather than using old scripting methods will help you <em>tremendously</em> in the long run. The benefits of spending the time to do this now <em>far</em> outweigh the downside of not getting it working quite as quickly as you may want to.</p> <p>Having said that, whether or not you decide to class'ify this, I'd rip out the logic in the top part of your script and stick it in another file, accessible from your web server. Rather than echo out table-formatted data, dump out JSON-formatted content.</p> <p>Replace the top code in this page to <code>curl</code> wherever you stick the newly created file on your server and <code>json_decode</code> it to get an iterate-able object that you can use to construct your table. If you're dealing with a post-back, then do a <code>POST</code> (or better <code>DELETE</code>) <code>curl</code>.</p> <p>Now comes the tricky(ish) part. You want your script to <em>enhance</em> your server-driven functionality and not be obtrusive. Easiest way is to use a framework like <code>jQuery</code>, binding to click events and using <code>event.preventDefault()</code> functionality to prevent the server post-back. Within the function that your scripted event is bound to, make your <code>$.ajax</code> call there, displaying whatever data you want to in the continuation.</p> <p>Hope that helps. If you're unfamiliar with any of the terms, a quick google search will yield a ton of documentation on each subject. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload