problem for showing output of php file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • curi444
    New Member
    • Jan 2010
    • 18

    problem for showing output of php file

    i installed wamp5 in windows xp.it shows all services are working.but when am opened a php file using browser it show a white page only,not show the out put. what is the reason?
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    What code you have written.? Can you post the code you have written.?

    Regards
    Dheeraj Joshi

    Comment

    • curi444
      New Member
      • Jan 2010
      • 18

      #3
      Code:
      <?php
      $a=5;
      $b=10;
      $c=$a+$b;
      echo "vale is"$c;
      ?>
      Last edited by Dormilich; Jan 5 '10, 10:42 AM. Reason: Please use [code] tags when posting code

      Comment

      • Dheeraj Joshi
        Recognized Expert Top Contributor
        • Jul 2009
        • 1129

        #4
        Put that PHP in <body></body> tags of HTML

        Code:
        <html>
        <body>
        <?php
        $a = 4;
        $b = 6;
        $c = $a+$b;
        echo $c;
        ?>
        </body>
        </html>

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          i think line 5 in post #3 throws an error which can be fixed with:
          Code:
          echo "vale is".$c;
          since the operator for the string concat is missing.

          kind regards

          Comment

          • curi444
            New Member
            • Jan 2010
            • 18

            #6
            am tried another way also...iis ,php,mysql and windows xp.
            using this also when am connecting to mysql db don't showing any errors.the browser page only shows blank.wt is the reason

            this is the code am runned in browser

            Code:
            <html>
            <body>
            <?php
            //remember to change the password to whatever you set
            //it to in mysql instance configuration
            
            //first parameter is server name, 2nd username 'root', 3rd is password
            $rst = @mysql_connect("localhost","root","root");
            
            if (!$rst)
            {
            	 echo "<p>Unable to connect to database manager.</p>" ;
                     die ('Could not connect: '. mysql_error());
            	 exit();
            }
             else 
            {
              echo "<p>Successfully Connected to MySQL Database Manager!</p>" ;
            }
            
            if (! @mysql_select_db("mysql") )
            {
            	 echo "<p>Unable to  connect database...</p>";
            	 exit();
            } 
            else 
            {
              echo "<p>Successfully Connected to Database 'MYSQL'!</p>" ;
            }
            ?>
            </body>
            </html>
            Last edited by Dormilich; Jan 5 '10, 12:03 PM. Reason: Please use [code] tags when posting code

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              If you right-click on the page and select 'View Source' (or something like that), what do you see? Do you see the PHP code?

              Comment

              • curi444
                New Member
                • Jan 2010
                • 18

                #8
                it shows only<html><body >only

                Comment

                • Markus
                  Recognized Expert Expert
                  • Jun 2007
                  • 6092

                  #9
                  So the PHP is being parsed - a good start.

                  Place this at the very beginning of your page:

                  Code:
                  <?php
                  echo "<h1>It works!</h1>";
                  ?>
                  Do you see anything?

                  Comment

                  • curi444
                    New Member
                    • Jan 2010
                    • 18

                    #10
                    the above code is working(ur code).

                    but y my code is not working?

                    Comment

                    • curi444
                      New Member
                      • Jan 2010
                      • 18

                      #11
                      i think their is some roblem in mysql connection..tha ts am not get my code...thank u 4 helping

                      Comment

                      • curi444
                        New Member
                        • Jan 2010
                        • 18

                        #12
                        for mysql-php connection what i want to do? mysql and php is working seperately working..anybod y help??

                        Comment

                        • Markus
                          Recognized Expert Expert
                          • Jun 2007
                          • 6092

                          #13
                          Okay - let's see what MySQL is complaining about.

                          Try this code, remember to fill in your MySQL server credentials.

                          Code:
                          <?php
                          
                          print("Attempting to connect to MySQL<br />");
                          
                          /** Change these to your correct details */
                          $link = mysql_connect("localhost", "root", "root");
                          
                          if (!$link) {
                              printf("Unable to establish connection to MySQL. Reason:<br /><br />%s",
                                      mysql_error());
                          }
                          else {
                              print("Connection successful.<br />");
                          }

                          Comment

                          • curi444
                            New Member
                            • Jan 2010
                            • 18

                            #14
                            not display output in browser(white page only )

                            can u give example for "localhost"

                            Comment

                            • curi444
                              New Member
                              • Jan 2010
                              • 18

                              #15
                              sorry
                              it display another error

                              Attempting to connect to MySQL

                              Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwr oot\my.php on line 6

                              Comment

                              Working...