Results 1 to 5 of 5

Thread: PHP and HTML code that is not working

  1. #1
    Join Date
    Nov 2009
    Posts
    36

    PHP and HTML code that is not working

    I am currently developing a small website as part of a final project review and I must absolutely use tomcat5.5. So I used the web application PHP/Java bridge template. So my problem is that not only the PHP code does not run, but also the HTML that is after the HTML code and also ignored.

    Here is the code I typed:
    PHP Code:
    .... 
    <div class="text"> 
    <?php 
    mysql_connect 
    'localhost''root''admin') or die ( 'Error connecting to MySQL'); 
    mysql_select_db 'Oreka') or die ( 'Error Oreka selection'); 
    response mysql_query 'SELECT * FROM rectape') or die ( 'Error query'); 
    while ($ 
    data mysql_fetch_array ($ answer)) 
    {echo $ 
    data 'id'].'< br/>'
    }
    mysql_close (); 
    ?> 
    <p> resumption of HTML </p> 
    </div> 
    ....
    All that is before this part of code works perfectly. But from what I have written here, nothing appears, neither the query results or error messages. When I display the source code of that page, "<p> resumption of HTML </p> </div>" and everything after that there does not appear. I do not know if I made a syntax error or if there is another problem.

  2. #2
    Join Date
    Nov 2008
    Posts
    1,022

    Re: PHP and HTML code that is not working

    I'd say you have an error somewhere in your php code. Specifically, if you have an error in the mysql_connect, mysql_select_db mysql_query or you do a die () and blow the rest does not play. A "trick" to find the line in error:
    PHP Code:
      <? php 
      
    echo "connect"
      
    mysql_connect 'localhost''root''admin') or die ( 'Error connecting to MySQL'); 
      echo 
    "- OK <br /> select DB"
      
    mysql_select_db 'Oreka') or die ( 'Error Oreka selection'); 
      echo 
    "- OK <br /> query"
      $ 
    response mysql_query 'SELECT * FROM rectape') or die ( 'Error query'); 
      echo 
    "- OK <br />"
      while ($ 
    data mysql_fetch_array ($ answer)) 
      (Echo $ 
    data 'id']. "<br/> '; 
      ) 
      mysql_close (); 
      ?>
    And if not, it gets even better with the log file errors of php

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: PHP and HTML code that is not working

    Hello and a quick question before: What do you know about coding? If you've tried to make a simple

    echo 'test';

    refer history to see if it appears. I also think there is an error, which is not displayed. Add the line error_reporting (0); in your PHP code.

  4. #4
    Join Date
    Nov 2009
    Posts
    36

    Re: PHP and HTML code that is not working

    Thank you all. CitricAcid I tried your code. It does gives me "connect". In the log file I found "PHP Fatal error: Call to undefined function mysql_connect ()" which is odd, because if the connection settings were wrong, normally it would display "Error connecting to mysql" too.

    To answer the Praetor question, I am doing research in telecommunications.

  5. #5
    Join Date
    May 2008
    Posts
    685

    Re: PHP and HTML code that is not working

    Quote Originally Posted by Macadrian View Post
    "PHP Fatal error: Call to undefined function mysql_connect ()"
    There is nothing odd in this error message. This kind of error message might occur if mysql extension is not installed on your server. Check this and see if you can solve your problem.

Similar Threads

  1. How to convert Javascript code to Html code
    By Bosch in forum Software Development
    Replies: 3
    Last Post: 21-09-2009, 01:20 PM
  2. JavaScript code outside html page
    By Gefry in forum Software Development
    Replies: 3
    Last Post: 30-04-2009, 03:53 PM
  3. How To Know HTML Code of a Color ?
    By ALEXANDRO in forum Customize Desktop
    Replies: 4
    Last Post: 06-03-2009, 06:59 PM
  4. How do I get the HTML code to display as HTML code?
    By NAYASA in forum Software Development
    Replies: 3
    Last Post: 26-12-2008, 01:35 PM
  5. HTML or PHP code for Playlist
    By JiJi in forum Software Development
    Replies: 3
    Last Post: 22-11-2008, 03:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,061,671.69534 seconds with 17 queries