php - Querying Class not showing results when called -
I am trying to create a square to create a function, anywhere by calling the function and Everything is in the tasting phase, so I do not pay attention to small issues like SQL injection, but this topic is not here. The class tested me, but I do not get any results because things look good for me, but I can lose some basic things. My PHP calss: My second file where I'm trying to display the results: Can someone help me Add to object : Change line in query action function: and from: $ Sql parameter in the method.
& lt; ? Php class questions {protected host = 'localhost'; Protected $ user = 'root'; Protected $ pass = 'root'; Protected $ db = 'test'; Public Function Connect Action ($ {= con = mysqli_connect ($ this- & gt; host, $ this-> user, $ this-> pass, $ this- & gt; db) or die (from 'db Can not be connected); Return $ Conn.; } Public Function Query Action ($ sql) {mysqli_query ($ this-> Connect Action (), $ sql); // $ count = mysqli_num_rows ($ query); / * If ($ query == true & amp;; & amp;; count & gt; 0) {} else {} * /}} $ execute = new query ();
& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; Welcome to & lt; / H1> & Lt; H3 & gt; & Lt ;? Php require_once ('query.php'); $ Sql = 'SELECT * tbl_user'; $ Execute-> QueryAction ($ SQL); Foreign currency (executed as $ $ item) {echo $ item ['user_pass']; }? & Gt; & Lt; / H3 & gt; & Lt; / Body & gt; & Lt; / Html & gt;
protected $ results;
$ this-> Result = mysqli_query ($ this-> connect action (), $ sql);
foreach ($ execute-> result as $ result) {} < / Div>
Comments
Post a Comment