PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 16, 2022

[FIXED] Output of php into html not shown

 March 16, 2022     html, lamp, mysql, php, printing     No comments   

Issue

I am writing a simple php application with mysql integration.
I have a simple html page in which I am connecting with the database and then for verification, I want to print the host info.

I have this in the html file.
The output are the two horizontal bars with nothing between them.

What's wrong with the code?

I am writing at ubuntu 12.10, at aptana studio (also using lamp).


Solution

All indications are that your PHP is not being executed period. Your DB code may still be off, but we're not even at that point yet. This implies one of two things are going on. Either your extension is wrong, or your PHP is not configured.

First, try this script (save it as info.php):

<?php
    phpinfo();
?>

If that doesn't work, then you are not configured. If that does work, then try this slightly longer bare-bones example; it's your code, sans the database connectivity. You should see a stub message between the lines. Again, don't forget the .php extension when saving it:

<!DOCTYPE html>
<html>
    <head>
        <title>Database Management Systems II - 2nd assignment</title>
    </head>
    <body>
        <hr>
        <?php
            $link = 'link';
            printf("Host information: %s\n", $link);
        ?>
        <hr>
    </body>
</html>


Answered By - RonaldBarzell
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing