Monday, March 2, 2020

Create a Website Link From a MySQL Database With PHP

Create a Website Link From a MySQL Database With PHP Often people new to working with databases  are able to fetch the information they need and echo it onto a page, but then they struggle with figuring out how to link the results for use on a website. This is a simple process in which you echo the appropriate HTML and call the URL in the middle of it.  You can use PHP to connect to and manipulate databases. The most popular database system used with PHP is MySQL. Together, PHP and MySQL are cross-platform. Create a Link From a MySQL Database With PHP In this example, you fetch an array and assign it to $info, and one of the fields holds email addresses. while($info mysql_fetch_array( $data )) { Print $info[name] . ; Print Note that this code called .$info[email] twice- once to display the email and once to be used in the link. The actual href linking code is placed around the information using print or echo and separated with dots. Here is another example using a web address and website name. while($info mysql_fetch_array( $data )) { Print .$info[sitetitle] . ; } Again you first print the. The URL generated with this code can be used on your website to provide a link to the information contained in the MySQL database.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.