Extreme newbie question alert:
I exported an Excel spreadsheet into a CSV file. I created a table with the same headings and was able to import the file with phpMyAdmin.
I am working on a site that currently has several static "database" information viewable by the public.
I want to be able to make these pages dynamic, thus I am going to put all the information from the static pages into tables using mySql.
I am using Cpanel 5 (provided by the ISP).
Okay, so far, I have one table created and imported. I now want to present this information via a webpage.
I created test webpage called test2.php.
This is my code for the page. I want to contact to the database and pull all the information deom the table called testtable.
<?php
$dbh=mysql_connect ("localhost", "lithuani_data", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("lithuani_LGGSonline");
$query = "SELECT * FROM testtable";
$result = mysql_query($query);
?>
I load this page and get a blank screen. I am assuming because I need to echo? the results. Right now, I just want to see if it works before I even think about putting the results into a HTML table form.
The $dbh string was provided by the sql admin page for this ISP. I created a user called lithuani_data without a password. Does this cause a problem?
Also, I tried putting using "SELECT * FROM 'testtable'"; but that did not work as well.
Any help would be greatly appreciated.
Also, if I already have template webpages set up, how can I call the query from the HTML page to display the results. Right now, the query simple shows up as text in the webpage when viewed. I also included the opening and closing tags for the php code.