954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to execute

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!

kripssmart
Newbie Poster
12 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

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

ShawnCplus
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
 

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.

kripssmart
Newbie Poster
12 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Show us the source of the page

ShawnCplus
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
 

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 "Data

Users";
echo "$infofirstName $infolastName";
$i++;
}

?>

kripssmart
Newbie Poster
12 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Right below # BEGIN SCRIPT place

error_reporting(E_ALL);


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

ShawnCplus
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
 

Hi..

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

kripssmart
Newbie Poster
12 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

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.

ShawnCplus
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
 

Hi..

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

Thanks..

kripssmart
Newbie Poster
12 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

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
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
 

@ShawnCplus

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

Thanks!

kripssmart
Newbie Poster
12 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You