Created
July 21, 2017 02:53
-
-
Save joeljerushan/686454b52688f3d4d3b5319cc3b68d3c to your computer and use it in GitHub Desktop.
sample fetch i created for now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once 'connection.php'; | |
$price = new database(); | |
$get_type_1 = "SELECT * from 01_premium_poster_230_matt"; | |
$get_type_1_fetch = $price->get($get_type_1); | |
$get_type_2 = "SELECT * from 02_premium_poster_260_semi_gloss"; | |
$get_type_2_fetch = $price->get($get_type_2); | |
$fetch_prices = array(); | |
$type_01 = array(); | |
$type_02 = array(); | |
while ($row = mysqli_fetch_assoc($get_type_1_fetch)){ | |
$type_01[] = array( | |
'id' => $row["id"], | |
'1' => $row["pages_1"], | |
'2' => $row["pages_2"], | |
'3' => $row["pages_5"], | |
'4' => $row["pages_10"], | |
'5' => $row["pages_25"], | |
'info' => $row["info"], | |
'title' => $row["title"] | |
); | |
} | |
while ($row = mysqli_fetch_assoc($get_type_2_fetch)){ | |
$type_02[] = array( | |
'pages_1' => $row["pages_1"], | |
'pages_2' => $row["pages_2"], | |
'pages_5' => $row["pages_5"], | |
'pages_10' => $row["pages_10"], | |
'pages_25' => $row["pages_25"], | |
'info' => $row["info"] | |
); | |
} | |
$get_all = "SELECT * from poster_paper_size, poster_paper_type, poster_qty, poster_type"; | |
$get_all_fetch = $price->get($get_all); | |
while ($row = mysqli_fetch_assoc($get_all_fetch)){ | |
$type_02[] = array( | |
'pages_1' => $row["pages_1"], | |
'pages_2' => $row["pages_2"], | |
'pages_5' => $row["pages_5"], | |
'pages_10' => $row["pages_10"], | |
'pages_25' => $row["pages_25"], | |
'info' => $row["info"] | |
); | |
} | |
$fetch_prices['01_premium_poster_230_matt'] = $type_01; | |
$fetch_prices['02_premium_poster_260_semi_gloss'] = $type_02; | |
$fetch_prices['get_all'] = $type_02; | |
$fp = fopen('results.json', 'w'); | |
fwrite($fp, json_encode($fetch_prices)); | |
fclose($fp); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment