Jump to content

PHP code to pull data our of mysql


billisnice

Recommended Posts

where exactly are you stuck at when you tried to do this? programming help forums are not here to find, give, or write code for you. without knowing what sort of problem you had when you tried this, the answer could range from a) you need to buy a good php/mysql book and/or take a programming class to z) you have a logic or syntax problem in your code that we could help with if you posted your code and told us what sort of error or symptom you got from that code.

 

the thing you stated you want, will require that you lean enough html, php, and mysql to do the following steps -

 

1) create a form or link(s) that let the user pick which item he wants, that submits the corresponding id value as a get request to the display page.

 

2) on the display page, detect and validate the id value that was passed in the get request.

 

3) create a database connection, checking for connection errors.

 

4) form and run the sql query statement to retrieve the correct row using the submitted id value, protecting against sql injection in the id value and checking for query errors.

 

5) check if the query matched a row and if so, fetch the row. if not, display a message to the user.

 

6) if a row was found, display the data from the fetched row the way you want it to be displayed.

Gathering data from a MySQL database is anything but impossible with PHP.

:qft:

 

It's pretty much the every day use of PHP these days.  also, here's a fiddle that emulates the behavior you are describing using a mock data set to prove your co worker is a muppet https://jsfiddle.net/7b4u37k7/1/

 

It's pretty much the every day use of PHP these days.  also, here's a fiddle that emulates the behavior you are describing using a mock data set to prove your co worker is a muppet https://jsfiddle.net/7b4u37k7/1/

 

Could have done a phpfiddle version.

Could have done a phpfiddle version.

 

I have only been there once to try and publish some code for someone and spent ages trying to get the link to work, then gave up with it.  So I'm not personally a fan of it for sharing, but it is very good for throwing up a prototype in a hurry.

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.