SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2009
    Location
    israel
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error messages takes the user out of page

    Hi everyone,
    Here is a simple PHP code aimes to connect into a MySql server.
    I'm trying to format error messages in a way my page will continue working despite errors that occure.
    PHP Code:
    <?php
    $con
    =mysqli_connect("localhost","root","root4qpines","tivonidb");
    if (
    mysqli_connect_errno($con))
      {
           echo
           
    '<p class="SQLerror">';
                echo 
    "Failed to connect to MySQL: " mysqli_connect_error();
                echo
            
    '</p>';
      }
    else
      {
           echo
           
    '<p class="SQLerror">';
             echo 
    "Success connecting to MySQL! " ;
             echo 
           
    '</p>';
      }
    ?>
    Here's the css code:
    Code:
    p.SQLerror
    	{
    		width:447px;
    		height:363px;
    		background-color: #fd0303;
    	}
    In return I get error messages that take me out of my page and is inconsistent with the css as shown in the screenshot attachedto_forum2.jpg

  2. #2
    SitePoint Enthusiast -RT-'s Avatar
    Join Date
    May 2014
    Location
    London, United Kingdom
    Posts
    41
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Have you tried running it in different browsers?

    Have you run simple scripts that don't try to connect to a database?

    Code:
    <?php
    echo 'Hello World';
    ?>


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
  •