jhylands

Attempt at automating PHP SQL

Jun 16th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. function make(){
  3. var select = document.getElementById('select');
  4. var from =  document.getElementById('from');
  5. var where = document.getElementById('where');
  6. document.getElementById('result').innerHTML = '$query = "SELECT ' . select . ' FROM ' . from . ' WHERE ' . where . '";
  7.        $result = mysqli_query($this->link, $query);
  8.        if(!$result){return array();}
  9.        while($row=  mysqli_fetch_array($result)){
  10.            //code
  11.        }';
  12. }
  13. </script>
  14.  
  15. SELECT<input id="select" value="*"  type="text" style="width: 36px;" />FROM<input id="tables" type="text" /> WHERE <input type="text" id="where" /><input type="button" value="make" onclick="make()"><br />
  16.  
  17. <textarea id="result"></textarea>
Advertisement
Add Comment
Please, Sign In to add comment