Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $category = $_POST['category'];
- $recipe = $_POST['recipe'];
- $connection = pg_connect("host=localhost port=5432 dbname=recipes user=postgres password=xxxxx") or die("Connection Error");
- $result = pg_query($connection,"SELECT recipeID, description, keywords FROM recipesystem.recipe WHERE recipename = '$recipe' AND category = '$category';");
- while ($row = pg_fetch_array($result)) {
- $recipeID = $row['recipeID'];
- $description = $row['description'];
- $keywords = $row['keywords'];
- echo json_encode(array("recipeID" => $recipeID, "category" => $category, "recipe" => $recipe, "description" => $description, "keywords" => $keywords));
- };
- ?>
- CREATE TABLE recipesystem.recipe
- (
- recipeid integer NOT NULL DEFAULT nextval('recipesystem.recipe_recipeid_seq'::regclass),
- whencreated timestamp without time zone NOT NULL,
- recipename character varying(200) COLLATE pg_catalog."default" NOT NULL,
- description text COLLATE pg_catalog."default",
- meal character varying(75) COLLATE pg_catalog."default",
- category character varying(75) COLLATE pg_catalog."default",
- keywords text COLLATE pg_catalog."default",
- isselected boolean,
- notes text COLLATE pg_catalog."default",
- CONSTRAINT recipe_pkey PRIMARY KEY (recipeid)
- )
- WITH (
- OIDS = FALSE
- )
- TABLESPACE pg_default;
- ALTER TABLE recipesystem.recipe
- OWNER to postgres;
- -- Index: idxrecipenamecategory
- -- DROP INDEX recipesystem.idxrecipenamecategory;
- CREATE UNIQUE INDEX idxrecipenamecategory
- ON recipesystem.recipe USING btree
- (recipename COLLATE pg_catalog."default", category COLLATE pg_catalog."default")
- TABLESPACE pg_default;
- echo $num;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement