Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Issues with Basic PHP echo

$
0
0

I am having issues with a basic PHP echo script. I am trying to echo all titles in a table, the table name is right and the database is connecting as I am getting a "connected" message appearing on screen, apart from that i'm getting absolutely nothing being output.

 

I have removed the passwords for obvious reasons.

<?php
	$host = 'localhost';
	$user = '';
	$db = '';
	$password = '';
	
	// Create connection
$con=mysqli_connect($host,$user,$password,$db);

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  else echo "connected";
  ?>
  
  
  
  <?php
  
$result= mysql_query("SELECT * FROM jos_content");
 while($row = mysql_fetch_array($result)){
      echo $row['title'];
 }
?>

Viewing all articles
Browse latest Browse all 13200

Trending Articles