How to link to MySQL Database?

Hello,

I have setup framework7 with a wamps server, as form the tutorial link on this website.
I have a mysql database inside that wamps icon, which I have used, and set up a very basic database (going to fill the rest later date once i can get it working, but its just a list of councils atm)

I want to do 2 things, the first was my main page has a search bar at the top, and I want to generate the options below such that user can search and get the council they want quickly from the 400+ or so in the UK. I am thus wanting to populate the dropdown option from my sql database row by row.

I have managed to connect however using sqli on a test.php file, this returns me a big list, but I cannot get it to link to my main website, because it seems to just throw a 404, which isn’t helpful and ive tried eveyrthign I can find but have little understanding so…

My SQL Database is currently hosted at localhost:port 3308 and my localhost that has my main PWA on, is port 8082

The second thing I want to do, is that once they have selected council, Ill have a button appear, which I should be fine to do, taking you to a new page, which retrieves further information form database, each council will has say Westminster, Y,Y,N,N,Y etc after it, correspinding to does it ahve a black bin for first location, blue for second, no green bin for 3rd etc… That sort of idea,
Then this data will determine which cards will be visible to the user.

thanks
jackyjoy

There are plenty of ways of doing this…
You could use F7’s Framework7.request.post (or get, for that matter) to fetch the data. But it’s a process that happens both on the app and the server, it’s not just something F7 does for you.

For instance…

on your app:

var url =“url/to/my/app”; //regardless if it’s a localhost on your computer
var data = {
action: ‘fetch-some-data’,
}
Framework7.request.post(url,data,
//success
function (responseData, status, xhr)
{
/* do something with fetched data */
},

//error
function (xhr, status, message)
{
/handle any errors/
},

“json”
);

and server-side, assuming you are using (for instance) PHP:

<?php
switch($_POST["action"])
{
	case "fetch-some-data":
		/* somehow fetch data from database*/
		die(json_encode($results));
		break;
}
?>

thanks my issue has been fixed.