Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Retrieving data from database using php in different forms
- <?php
- $servername = "localhost";
- $username = "scse";
- $password = "scse";
- //Create connection
- $conn = mysqli_connect($servername, $username, $password);
- // Check connection
- if(!$conn)
- {
- die("Connection failed: " . mysqli_conenct_error());
- }
- if(!mysqli_select_db($conn, "scse"))
- {
- echo "Database not selected";
- }
- $sql = "SELECT * FROM register WHERE Name LIKE 's%'";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- // output data of each row
- while($row = mysqli_fetch_assoc($result)) {
- echo " Name: " . $row["Name"]." - Email: " . $row["Email"]. " - Website: " . $row["Website"]. " - Message " . $row["Message"]. "<br>";
- }
- } else {
- echo "0 results";
- }
- ?>
Add Comment
Please, Sign In to add comment