How to change the appearance of paragraphs in php files
P粉596191963
P粉596191963 2024-01-29 15:04:44
0
1
441

I tried making the file as an html file, or putting <link rel="stylesheet" type="text/css" href="mystyle.css"> directly, but It doesn't work. I want to be able to change the pharagraph producten font size.

This is my code so far (about the last part())

<?php
  include('DatabaseConnector.php');
  $database = new DatabaseConnector("test", "root", "");
  <link rel="stylesheet" type="text/css" href="mystyle.css">

    $email = $database->selectValue("SELECT emailadres FROM klant WHERE naam = 'Bibiche' AND achternaam = 'Laarakkers'");
      echo "Het emailadres van Bibiche Laarakkers is $email.";

    $productInfo = $database->selectSingleRow("SELECT gewicht, prijs, calorieen FROM product WHERE naam = 'Sausage Muffin with Egg Whites'");
      echo "<h2> Sausage Muffin with Egg Whites </h2>";
      echo "<p>Gewicht: " . $productInfo['gewicht'] . "<br>";
      echo "Prijs: " . $productInfo['prijs'] . "<br>";
      echo "Aantal Calorieën: " . $productInfo['calorieen'] . "</p>";

      $producten = $database->selectRows("SELECT naam, prijs FROM product");
          foreach($producten as $product) {
            echo "<p class='pruducten'> Product:" . $product['naam'] . "<br>";
          echo "Prijs:" . $product['prijs'] . "</p>";

          }
?>

P粉596191963
P粉596191963

reply all(1)
P粉726234648

If you are trying to print a link in php code, could you try something like this and see if it works?

The reason I use echo is that it prints out the code of the stylesheet. If I put the code directly into the middle of php without echoing it or wrapping it in '' , it won't display or print correctly.

';

    $email = $database->selectValue("SELECT emailadres FROM klant WHERE naam = 'Bibiche' AND achternaam = 'Laarakkers'");
      echo "Het emailadres van Bibiche Laarakkers is $email.";

    $productInfo = $database->selectSingleRow("SELECT gewicht, prijs, calorieen FROM product WHERE naam = 'Sausage Muffin with Egg Whites'");
      echo "

Sausage Muffin with Egg Whites

"; echo "

Gewicht: " . $productInfo['gewicht'] . "
"; echo "Prijs: " . $productInfo['prijs'] . "
"; echo "Aantal Calorieën: " . $productInfo['calorieen'] . "

"; $producten = $database->selectRows("SELECT naam, prijs FROM product"); foreach($producten as $product) { echo "

Product:" . $product['naam'] . "
"; echo "Prijs:" . $product['prijs'] . "

"; } ?>

If this doesn't work, since css links are best used within the section of the document, you can print the code directly into it by echoing the code so it prints it correctly to the page. like this:


    .pruducten {
        font-size:1rem;
    }
    ';
    $email = $database->selectValue("SELECT emailadres FROM klant WHERE naam = 'Bibiche' AND achternaam = 'Laarakkers'");
      echo "Het emailadres van Bibiche Laarakkers is $email.";

    $productInfo = $database->selectSingleRow("SELECT gewicht, prijs, calorieen FROM product WHERE naam = 'Sausage Muffin with Egg Whites'");
      echo "

Sausage Muffin with Egg Whites

"; echo "

Gewicht: " . $productInfo['gewicht'] . "
"; echo "Prijs: " . $productInfo['prijs'] . "
"; echo "Aantal Calorieën: " . $productInfo['calorieen'] . "

"; $producten = $database->selectRows("SELECT naam, prijs FROM product"); foreach($producten as $product) { echo "

Product:" . $product['naam'] . "
"; echo "Prijs:" . $product['prijs'] . "

"; } ?>

If you absolutely must print every aspect of the page in php code, the above is how I would do it.

There are other ways to achieve this by using html directly in the php file, such as making sure it has a section etc. But I want to work along the path you're on to better help you solve your problem.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!