PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hello Fellow Forum People, I'm kinda new to php/mysql world and well i made my own little site for my clan that i have on 5 different games but i dont want to duplicate the sites 5 different times is there any way i can make it where i could have a drop down menu that will select a database file like for something like
----Drop down menu----
Rainbow Six 3
Rainbow Six Lockdown
Rainbow Six Vegas 360
Rainbow Six Vegas PS3
Black Hawk Dwon Team Saber
Which will kinda select which database will be used see in my index.php
i have it where it selects db.php so how can i change that so it will come in effect the right way as well?
I hope you understand im not good at asking for help
what do you mean connection class? and see im going to have like index.php which where they will be asked what game they play then when they select what game they play it will take them to index2.php and thats where all the scripts are basicly set at and thats where the database is connected at or what ever
I am not completely understanding your question. What I posted was a way in which a user can select something that is fed by a database. When they select something from that list, it posts back to the page it is on and can be used to do whatever you want it to do.
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/www/diesquad.freehostia.com/header.php on line 35
Warning: mysql_query(): A link to the server could not be established in /home/www/diesquad.freehostia.com/header.php on line 35
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/diesquad.freehostia.com/header.php on line 38
Only thing thats getting me is the site comes up good and it shows a record of a news that i made which is in the database showing up so how can this be if its not connecting to the database?
You aren't showing us how the connection is made. Let us see that code so we can see the potential error in the code. Lines 30 to 40 would be particularly helpful.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
is this what your talking about??
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
If that is what you are trying to do then you need to set the $dbhost name (and related credentials) to the selected database before passing it to the connection function.