[Chugalug] another LAMP problem

Garrett Gaston garrett85 at hotmail.com
Thu Mar 14 17:17:39 UTC 2013


Having overcome my last LAMP problem I've hit another problem almost immediately. My apache server seems to be working just fine as does php, I'm able to execute phpinfo() without a problem. I wrote a little php to query a few lines in a VERY simple MySQL database. When the page loads it's a blank web page, no errors and no results. There are two entries in the table that I'M trying to query so I would expect to see two lines outputted as html. The code is below. Any ideas? Note that fname & lname are just variable I retrieved from an html form via $_POST.

// Create connection
$con=mysqli_connect("localhost","lrngsql","xyz","bank");

// Check connection
if (mysqli_connect_errno($con))
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con, "SELECT fname, lname FROM person");

if(!$result)
{
    echo "MySQL Error: " . mysqli_error($con) . "\n";
}

else
{
    while($row = mysqli_fetch_array($result))
    {
        echo $row['fname'] . " " . $row['lname'];
        echo "<br />";
    }
}
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://chugalug.org/pipermail/chugalug/attachments/20130314/c76db5d1/attachment.html>


More information about the Chugalug mailing list