How do i know if there are records stored in my mysql database? : <p>I have 2 php files. One of them creates a table and inserts data into MySql using php. The other php selects the table in the database and outputs the data from the table. The table is outputting 0 results as in there aren't any record being stored into the table.</p>

<p><strong>Need help, Thanks!</strong></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>//select from table
			      
				$sql = "SELECT * FROM post02";
                $result = mysql_query($link, $sql);
				echo 'selecting table works';
				
				//output from table
			
				if (mysql_num_rows($result) &gt; 0) {				    
				    while($row = mysql_fetch_assoc($result)) {
					
                    
                    echo "id: " . $row["id"]. " - Name: " . $row["title"]. " " . $row["content"]. ""  . $row["date"]."&lt;br&gt;";
                        
                        
                    }
				} else {
				    echo "0 results";
				}	
			</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>// create a table


	$sql="create table post02(id INT(6) unsigned auto_increment primary key , title varchar(30) not null, content varchar(255) not null, date TIMESTAMP)";



	$result = mysql_query($sql);

	if (! $result ) {

	    die ( 'Cant create table : '  .  mysql_error ());

	}

	 echo  'Created a table successfuly' ;


//insert to table
	echo'insert table - initializing';

	if($_POST['submit']){
	$title = $_POST['title'];
	$content = $_POST['content'];
	$date = date('l jS \of F Y h:i:s A');
	}
	
	$sql = "INSERT INTO post02(title, content, date) VALUES ($title, $content,$date))";

	if($title =="" || $content=="" ){
	    echo "please compelete your post!";
	    return;
	     
	}
	echo'insert table completed';

    
    	mysql_query($db ,$sql);
   	header("location: viewblog.php");</code></pre>
</div>
</div>
</p>
