Wednesday, 15 July 2015

php - GET method for each table row having its own page -


Say I have a database table called "People" and under the column "Name", I have "Bill", "Karen". ", And" Ted "

In my php file, I just want to use a template and those lines, there is a separate page for each name (like" myfile.php? Name = bill ") I think I have to use GET, but I am still confused and I am inexperienced with it, how will I achieve my goal?

Post-lesson "itemprop =" text ">

If you want to create a page based on a common use name Area is basically the name and it takes the database and selects all the fields associated with that name, then you can echo varibles and place them where you want it.

  & lt ;? Php $ name = $ _GET ["name"]; // gives the value of the name from your URL which you have provided in your post $ con = mysqli_connect ("127.0.0.1", "db-username", "db-pass", "db-name"); Mysqli_real_escape_string ($ thor, $ name); $ Sql ​​= mysqli_fetch_assoc (mysqli_query ($ con, "select where people name = '$ name'")); $ Id = $ sql ['id']; The table of people in the // ID table will be $ age = $ sql ['age']; // will be field in the Era People table echo '& lt; H1 & gt; '. $ Name. ' & Lt; / H1> '; Echo '& lt; P & gt; $ Id '& Lt; Br / & gt; $ Era '& Lt; / P & gt; '; ? & Gt;    

No comments:

Post a Comment