View Full Version : Newbie

02-02-2005, 06:54 AM
Would someone help me under stand how this php/mysql works?
For example if i was going to install a calendar on my site i would have to edit this in the php script right?

$Host = "localhost";
$User = "";
$PassWord = "";
$DataBaseName = ""; <------and what would go here?
$TableName = "agenda";

And what would i edit in the mysql?



02-02-2005, 07:28 AM
$DataBaseName would be the name of the database :)

But you would need to create a database. When MySQL is first installed, it will install with (from memory) 3 database:
mysql - this database is used for the admin side of MySQL
spheradb - this is possibly used by the VDS system
test - just a dummy database that you can use if you want to.

How to create a database? The easiest way is to install PhpMyAdmin and use that to create and manipulate databases. If you don't want/need to install that, you can login using your shell and use the mysql client.


02-02-2005, 07:48 AM
I found where the spheradb is in the phpmyadmin and it had a place to create a name for the new database,which i make up a name right?
It also has a place for fields what do i put in the fields?

02-02-2005, 08:03 AM
After i create a new database do i need to edit the database?

02-02-2005, 08:55 AM
There should have been something like a README file or INSTALL file with the calendar program you are trying to install. It should give information on what the database needs. From your first post it looks like you are going to have to create a table called "adenda" but there is no way for us to know what that table would have in it.

Where did you get this calendar program? Can you give us a link?

02-02-2005, 09:04 AM
I forgot to save the link i will have to search for it this tomorrow when i have more time.
What about this field that its asking me about?When i'm trying to create a new database?

02-02-2005, 09:15 AM
That should be part of what you can find in the README or INSTALL file. Is this something you got to work with phpBB2 or phpNuke?

02-02-2005, 11:30 AM
No i was trying to install a calendar on my site threw the phpmyadmin.
I'm not going to work on my nuke site until i learn it.
I had a database installed on there that had nothing in it called test so i used that and it worked fine but the calendar dont work right. http://m3-hq.com/index.php?id=diplo
I found the link. http://scripts.franciscocharrua.com/agenda-calendar.php
I did not change the color of the carlendar yet was waiting to see if it worked first.

02-02-2005, 01:17 PM
I think the problem is that you have inserted what you found at the site you listed right into your index.php file. Is that right? The script is designed to work by it self. Put the text that you found with your changes in a file called agenda-calendar.php. Upload that to your root www directory where your index.php file is. Then go to. (http://m3-hg.com/agenda-calendar.php) and see what happens. I think this may be designed to work with the other php scripts that where listed on the page you found it on so not sure if everything is going to work but give it a try. Hope that all makes a bit of sense.

02-02-2005, 01:56 PM
I just tested the script on one of my sites and it does work if you put it in it's own file as I suggested. If you want to incorporate it into what you use for your site then you are going to have to do some modifications of it to get it to integrate.

02-03-2005, 08:05 AM
Thanks alot that did the trick your awesome!
I think i just learnt how to install my first php script useing the phpmyadmin :D

02-03-2005, 08:55 AM
The database that i used for the calendar was already in there,the preson that installed the nuke for me put that in there.
Now i need to learn how to create a new database?
So i can install other things on my site.

To create a new database you have to fill this out what goes in the fields?

Create new table on database
Name :
Fields :

02-03-2005, 09:49 AM
To create a new database you should not have to put any tables in it at first. simply type the name of your new database into the field under Create new database and hit create. You are then taken to the page where you can set up your tables.

Pretty sure that is what you are wondering about because it has a Create new table on database NAMEOFDATABASE: At this point it depends on what program you are going to use this database with. Look at your php page for the Agenda calendar. You should see something like this:

$create = "create table " . $TableName .
"(" .
"id int primary key auto_increment, " .
"text text, " .
"day int, " .
"month int, " .
"year int " .
Ok the $TableName in this was filled in with the value you set it to above in the php file. The default was agenda. So if you did not change it then it created a table by that name in your phpNuke database. Next look at the lines that come after that. The very first word on each line should be fields that where set in the table agenda. id, text, day, month, year. The words after that are how each of those fields are used. See if you can see how it compares to what you now have.

If you where going to set this table up manually what you would have done is this. On that page where it ask for Name and Fields you would have entered:
Name: agenda
Fields: 5
You then hit GO. Now you have a page where you need to enter the info for each field.

1) id - INT-blank-blank-not null-blank-auto_increment-primary-the rest is left unselected.
2) text-text-blank-blank-null-the rest is left blank or unselected.
3) day-int-blank-blank-null-the rest is left blank or unselected.
4) month-int-blank-blank-null-the rest is left blank or unselected.
5) year-int-blank-blank-null-the rest is left blank or unselected.

Again look at what you see in the php agenda and see if you can figure out how I arrived at that. Do be aware that this is a pretty simple script and database set up. Many require alot more. It is always best when you are starting out to try and find php scripts that are going to either install the database for you like this one or give you full details on how to to set up the database. Some by supply what is called an SQL query that you can run in phpMyAdmin or from SSH. In phpMyAdmin you click on the SQL tab to get to a screen that allows you to type or past in the query you want to run. I think the new version of phpMyAdmin may have a bit of a diffrent interface so it may not be a tab anymore. When you run a query just make sure you are on the database you want to add the table to.

Hope that helps. If you can find a book on PHP and MySQL that will go a long way to helping you figure things out. I normally pick up books by Wrox publishers but there are many good publishers out there. I also spend alot of time looking at tutorials that I can find on the internet. Many times something that I have not been able to grasp form a book has made more sense once I have read one of these.

You should be able to experiment and play around with it in phpMyAdmin. Just don't do it on a database that you use. Create a dummy database.... you can call it dummy. :)

02-04-2005, 04:40 PM
O Dang i'm going to have to work on that lol
Is there a way to change the pass on the calendar its the same pass as my site manager?

02-04-2005, 06:46 PM
The best thing to do would be to create a new user and password via phpMyAdmin and use that to connect to the database instead of the one you are using now. Other then that you would need to alter the script itself to check against a password other then the one you use for your database which is the same for Site Manager.

I should point out that the script you are useing may not be the most secure as is. It is nice and simple as are the others on the site where you got it but I think the person who created thought they would be used by advanced users not beginners.

02-05-2005, 06:26 AM
Its ok to have a different pass on the phpmyadmin then the site manager?
If so i dont see a place to change the pss in the phpmyadmn?

02-05-2005, 07:23 AM
The password to phpMyAdmin is different then the password to MySQL itself. When you log in to phpMyAdmin it does you what ever password that you have set for Site Manager. If you changed the password for Site Manager then your password for PhpMyAdmin changes. It has to do with .htaccess. This could be changed but is getting a bit advanced for where you are at this point.

If you want to create a new user for MySQL then you can do that via phpMyAdmin. Log in to phpMyAdmin and then click on Permissions there should be a link to add a new user.

02-23-2005, 01:27 PM
Can anyone help with setting up the config.inc.php file for phpAdmin? in the instructions it states to change the values for host, user, password and authentication mode. Is it line 102-104 that these changes need to be adjusted? Also, when I installed MySQL4 no user id was given, only the user password was prompted. what is used? Thanks in advance for your assistance in helping a new user.

02-23-2005, 03:30 PM
The user id for MySQL is 'root'. With the user password that you supplied.

I just installed PhpMyAdmin and there was no need to change anything, it just installed OK. You shouldn't need to mess with config.inc.php at all.