July 13, 201412 yr Good morning, I am new to this forum and hope you. Can help me solve an issue I have. I am a graphic designer who has taken an interest in web design as a hobby and have become adequate in using html/CSS. I really struggle with the server side coding etc and have the following question regarding access to an SQL database. If I have the following SQL database/table set up on my server: Server: 000.000.000.000 Database: dw132_db User: dw132 Password: password Table: testable What EXACT code would I have to add to my html page to publish data from the table on my web page? I don't seem to be able to find this basic information anywhere? Or am I asking the wrong question? Thank you in advance
July 15, 201412 yr You would need to break it down into a few areas. First you would login to the database then insert data into the relevant tables. The syntax is different between MySQL and MSSQL so that is quite important. There are articles out there to explain how to do this. Here's one that shows you how to do this https://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059
July 22, 201412 yr What server-side language are you using? You'll need to set up a connection to your database first, then use a query to select and return information from the database to your script. For example, a VERY simple PHP application could be <?php // Connect to the database $link = mysqli_connect("000.000.000.000","dw132","mypassw","dw132_db"); // Create a query $query = "SELECT * FROM testable"; // Execute the query $result = $link->query($query); // Present the results while($row = mysqli_fetch_array($result)) { echo $row["id"] . "<br>"; } ?>
Create an account or sign in to comment