|
Posted by Luigi Donatello Asero on 07/09/05 18:55
Hello to everybody!
I got some suggestions in the past about using a database. I agree that a
database might do things easier but I am having problems with using it
At present I am trying to use mysql but I might try to use other databases
in the future.
In order to connect to the database I tried to write the following code
on the page
https://www.scaiecat-spa-gigi.com/sv/test6.php
*******
<?php
$username = "here I wrote the username";
$password = "here I wrote the password";
$hostname = "here I wrote the hostname";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to mysql");
print "connected to mysql<br>";
$selected = mysql_select_db("scaiecat_?",$dbh)
or die("Could not select first_test");
if (mysql_query("SELECT *FROM Region values('')")) {
print "successfully selected records";
}
else {
print "Failed to select records";
}
mysql_close($dbh);
?>
**************************************************
Although I could connect to the database after some unsuccessul attempts, I
coud not show any data from the database itself.
In fact, the table in the database contained a row, so I am wondering
whether I made some mistakes in the php code or in creating the very short
table or may-be in both.
When creating the short table in the database I used an
administration program in the database and I am wondering whether I would
need create a table also on the webpage to show the data which are contained
in the table in the database.
Also, I noticed that the database seems to state the the table is ok but at
the same time, it tells me that primary must be the first key.
If you are of the opinion which I had better use another database, please
let me know which one and why you think it would be more suitable.
If you think that some other NG:s which I have access to should be more
suitable for the question which I asked above, please let me know which one.
--
Luigi Donatello (un italiano che vive in Svezia)
https://www.scaiecat-spa-gigi.com/it/svezia.html
Navigation:
[Reply to this message]
|