pr0cz pr0cz - 3 months ago 38
PHP Question

Insert a link into php crashes my site

I am faceing the problem, that my

is not displayed. If I insert the lines described below, the site won't load anymore. The following code works properly.


$mysqli = new mysqli('host', 'name', 'psw', 'db');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
if ($result = $mysqli->query("SELECT user_level FROM users WHERE user_level = 1 ")) {

/* determine number of rows result set */
$row_cnt = $result->num_rows;

printf("Result set has %d rows.\n", $row_cnt);

if ($result->num_rows == 1) {
printf ("Adminpanel");



/* close connection */

When I add this line

$link = 'AdminLayout.php';
printf ("<a href="' .$link. '">Adminpanel </a>");

instead of

printf ("Adminpanel");

nothing works anymore. What have I done wrong?


try this: its a quotes problem. if you need double quotes"" with href try with single quotes' at start and end.

$link = 'AdminLayout.php';
    printf ('<a href="' .$link. '">Adminpanel </a>');