• Resolved ghostmiro

    (@ghostmiro)


    Hi,
    Maybe this is some stupid syntax-error of me but when i want to use \n (new rule in php) it doesnt work in the wp-page.

    this is the code i put in the snippet:

    <?php
    
    $mysqli = new mysqli("goatcup.be.mysql","goatcup_begoatcup","****","goatcup_begoatcup");
    
    if ($mysqli -> connect_errno) {
      echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
      exit();
    }
    
    $sql = "SELECT voornaam, naam FROM reeks_a ORDER BY naam";
    
    if ($result = $mysqli -> query($sql)) {
      while ($row = $result -> fetch_row()) {
        printf ( "%s %s\r\n", $row[0], $row[1]);
      }
      $result -> free_result();
    }
    
    $mysqli -> close();
    ?>

    Thx for the help!

    • This topic was modified 2 years, 10 months ago by ghostmiro.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can use the PHP newline characters \n or \r\n to create a new line inside the source code. However, if you want the line breaks to be visible in the browser too, you can use the PHP nl2br() function which inserts HTML line breaks before all newlines in a string.

    Thread Starter ghostmiro

    (@ghostmiro)

    Thx Sruthy that helped my problem!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘printf new rule doesnt work in wp’ is closed to new replies.