Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function db_query($query) {
- global $connection;
- $result = mysql_query($query, $connection);
- if ($result) {
- $output = array();
- while ($row = mysql_fetch_array($result)) {
- if (mysql_num_rows($result) == 1 ) {
- $output = $row;
- } else {
- array_push($output, $row);
- }
- }
- return($output);
- }
- else {
- die ("Bad MySQL Request");
- }
- }
- //Funcion que te ahorra muchas lineas para hacer un request...
- //Ahora, invocas la funcion y te devuelve los resultados en un Array para tu comodidad :D
- ?>
Add Comment
Please, Sign In to add comment