Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- $db = new db;
- ...
- $sql = "select * from `news`;
- $db->query($sql);
- while($result = $db->fetch_array()) {
- $data[] = $result;
- }
- ...
- ...
- function query($sql) {
- ... sql validation etc...
- ... connection happens in a nother function but for my example i wrote it down here...
- $connection = mysqli_connect($host,$db_user,$db_password);
- mysqli_select_db($database);
- return mysqli_query( $connection , $sql);
- }
- function fetch_array($resp = 0, $assoc = 1) {
- ...validity checks of resp and assoc...
- return mysqli_fetch_array($rp, $assoc);
- }
- ...
Add Comment
Please, Sign In to add comment