Jump to content

Sql query output


BigDaddy13

Recommended Posts

ok, so I have my insert form set up and its working properly.

Now, I would like to be able to output an sql query to html.

I want to be able to choose say a date range or by a name.

For example, I want to run an sql to see how many people

are signed up to play a ball game on a certain date.

I want to be able to click a button for a this particular query

and have a box pop up or a box available for a date range.

Then according to the range it will output the results to an

html. Hope this makes sense! Thanks in advance!

 

 

BD

Link to comment
https://forums.phpfreaks.com/topic/162754-sql-query-output/
Share on other sites

Are you trying to 'retrieve' data from the database?

Example:

$mysqli_con = mysqli_connect('hostname', 'username', 'password', 'databasename');

$sql = "SELECT * FROM 'tablename'";
$query = mysqli_query($mysqli_con, $sql);

while ($result = mysqli_fetch_assoc($query))
{echo "$result[user] is signed up on $result[game_ids] games";
}

Link to comment
https://forums.phpfreaks.com/topic/162754-sql-query-output/#findComment-858894
Share on other sites

Yes, I want to pull the info from a db and display

the output to an html page.

I want to be able to put in a date or name

for the results.

 

 

The best way to approach this is to have 3 drop down menus for each date.  This approach allows you can control the range, input, and almost eliminate mistakes.  You would submit the values either to the same page or a processing page, and use the POST values in the query.  You mentioned earlier that you already had a working form, so you should be familiar with this.  There are also plenty of examples and tutorials from Google.

Link to comment
https://forums.phpfreaks.com/topic/162754-sql-query-output/#findComment-858907
Share on other sites

If you run across a good tut for this..please point me in the right direction.

I have searched and searched.

 

Thanks for your help!

 

 

BD

 

I'm sure there are a few examples out there that do exactly what you want, but I don't feel like searching, that's your job.  What you can do is search for each component, like forms, drop downs, submitting your page to itself, the POST method, MySQL & PHP, etc...  Good luck, come back if you have a specific question.

Link to comment
https://forums.phpfreaks.com/topic/162754-sql-query-output/#findComment-858943
Share on other sites

Thanks for your response. Please note that I was not asking for

you to search for this tutorial. I was asking that if you came

across one that you would please point me to it. 

 

 

BD

 

I understand that.  But I have faith in you, and I'm sure you'll be able to find something  ;)

Link to comment
https://forums.phpfreaks.com/topic/162754-sql-query-output/#findComment-858950
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.