Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created LAMP server in my ubuntu desktop. I've also made a sample database in Mysql having 6 columns. I can access it through the terminal. I've also created a php script for accessing the same. But when I'm not able to run it in the web browser....

It just shows me a blank page....and nothing else !!!!

Below is my code:

// I'd typed http://_MY_IP_ADDRESS_/_FILE_NAME_.php in the browser to run this file


include('db_login.php');            // include the login info of the user
$connection = mysql_connect($db_host, $db_username, $db_password); // make the connection

if( !$connection )
    die("Couldn't connect to the database: <br />", mysql_error());

$db_select = mysql_select_db($db_database);// select the database

if( !$db_select )
    die("Couldn't select the database: <br />", mysql_error());

// developing the query

$select = 'select';
$coloumn = ' * ';
$from = 'from';
$table = 'table';

$query = $select.$coloumn.$from.$table;                     
$result = mysql_query($query);                          

if( !$query )
    die("Couldn't query the database: <br />", mysql_error());

// fetching and displaying the result

while($result_row = mysql_fetch_row($result))
    echo "A".$result_row[1]."<br />";
echo "B".$result_row[2]."<br />";
echo "C".$result_row[3]."<br />";
echo "D".$result_row[4]."<br />";
echo "E".$result_row[5]."<br />";
echo "F".$result_row[6]. "<br /><br />";

// closing the connection

share|improve this question

Syntax problems on line 8:

die("Couldn't connect to the database: <br />", mysql_error());

. is used as concatenation, not ,

Same problem on line 15 and 30.

Also, turn on error reporting. To do so:


This will turn on all errors.

share|improve this answer
Also, the query results will start at $result_row[0] not $result_row[1] and end at $result_row[5] – douggro Jan 28 '14 at 19:04
Thanks Flukey and douggro for your quick responses....!!!! They solved everything. – dhruvil25 Feb 6 '14 at 15:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.