Newbie - Insert data into table.
I am using PHP 5.4.9 and MYSQL 5.7. I have a php file created that shows I am connecting to the database, yet I am unable to insert data into the table using a PHP file. Could someone point me to a good sample script?
//set up static variables
$page_name = "WEB Index"
$Page_desc = "This is a sample."
$date_added = date("mm-dd-yy");
//set up table and database names
$db_name = "countdb";
$table_name = "hit_table";
//connect to server and select database
$connection = mysql_connect('localhost', 'root', '0304Phreq');
$db=mysql_select_db ($db_name, $connection);
//build and issue query
$sql = "insert into $table_name values(",'$page_name', '$Page_desc', '$date_added')";
$result = mysql_query ($sql, $connection);
$count_sql = "select count(page_name) from $table_name
where page_name = '$page_name'";
$count_res = mysql_query($count_sql, $connection);
$count = mysql_result($count_res, 0 , "count(page_name)");
<TITLE>Sample Page </TITLE>
<P>This serves no purpose</p>
<P>Accesses: <? echo "$count"; ?></p>