Hi,

I have been writing a PHP code. As I couldn't execute it locally (installation issue), I moved it to my server as a '.php' file. I haven't executed or run a php file in server before. Can anyone please say me how I can view the output of my script in the browser please?

Thanks!

Recommended Answers

All 10 Replies

Just go to the page in the browser, the same way you would locally except replace localhost with the domain name.

Hi.. Thanks for the quick reply..
But when I am opening it, even now its showing me a blank page. No error nothing! It was the same what I was viewing back in my local machine also.

Show us the source of the page

This is what I was trying to do..

<?php


# BEGIN SCRIPT

    $XYZDBC=XYZDBConnect();
    $query="SELECT * from example";
    $result=mysql_query($query);
    $num=mysql_numrows($result);
    mysql_close();



    $i=0;
    while($i<$num)
          {
              $infoCourse=mysql_result($result,$i,"course");
              $infoAssign=mysql_result($result,$i,"assignment");
              $infofirstName=mysql_result($result,$i,"firstName");            
              $infolastName=mysql_result($result,$i,"lastName");              

              echo "<b>Data</b><br><br><b>Users</b>";
              echo "$infofirstName $infolastName";
              $i++;
          }

?>

Right below # BEGIN SCRIPT place

error_reporting(E_ALL);

Then follow the FAQ on the main page of the PHP forums

Hi..

I paced the 'error_reporting(E_ALL);' ... but couldn't find the FAQ that you were saying about...

Hi..

I paced the 'error_reporting(E_ALL);' ... but couldn't find the FAQ that you were saying about...

After you placed that in the code refresh the page. Instead of a white page you should see errors. If you get errors that mention something about a MySQL result resource follow the FAQ. If it is a different error post the error here.

Hi..

Its the same.. thats what I was saying.. Its blank page still.

Thanks..

Also put

ini_set('display_errors', 'On');

Below error_reporting(E_ALL);
If you still don't see any errors it could be because you're trying to call a function which obviously does not exist ( XYZDBConnect() )

@ShawnCplus

That worked.. Thanks..
It was the DB connection error. Let me try it once now..

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.