garydt Posted March 25, 2010 Share Posted March 25, 2010 This is part of my code- <?php require_once('Connections/gary.php'); ?> <?php $gary = mysql_connect("localhost","root") or die("Error connecting to database<br /><br />".mysql_error()); mysql_select_db("people") or die("Error selecting database<br /><br />".mysql_error()); $query_Recordset5 = "SELECT * FROM newtable"; It works fiine on my local pc/server. However when I went onto the online server to setup the database and table their mysql administrator only let me setup the table and not the database properties. I've connected support about creating the database properties but they don't seem to have a clue about it. What can I do? Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/ Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 Just to let you know, when i try the webpage i get- Warning: require_once(Connections/gary.php) [function.require-once]: failed to open stream: No such file or directory in /home/c/h/chichesterag/public_html/index.php on line 2 Fatal error: require_once() [function.require]: Failed opening required 'Connections/gary.php' (include_path='.://lib/php') in /home/c/h/chichesterag/public_html/index.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031707 Share on other sites More sharing options...
skurai Posted March 25, 2010 Share Posted March 25, 2010 try making the folder lowercase C, and doing the same in the code. Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031708 Share on other sites More sharing options...
JonnoTheDev Posted March 25, 2010 Share Posted March 25, 2010 What do you mean by 'database properties'. Also check you directory structure/naming is correct for your includes or use set_include_path() to set the parth. Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031709 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 I'm sorry, i'm confused. How do I connect the webpage to the table online without haviing a database? on my pc the mysql settings are connection - gary host address - localhost user name - root the database is called people. Don't i need to have these settings on the online server? Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031724 Share on other sites More sharing options...
JonnoTheDev Posted March 25, 2010 Share Posted March 25, 2010 You need the database name, username, password, hostname. The host is usually 'localhost'. Whoever set the database up for you should have set a user up also. if this is your server or you are paying for hosting on a shared server then do it yourself. mysql_connect('localhost', 'username', 'password'); mysql_select_db('database_name'); Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031728 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 i uploaded the connections folder and now i'm getting this- Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'root'@'localhost' (using password: NO) in /home/c/h/chichesterag/public_html/Connections/gary.php on line 9 Fatal error: Access denied for user 'root'@'localhost' (using password: NO) in /home/c/h/chichesterag/public_html/Connections/gary.php on line 9 This is line 9- $gary = mysql_pconnect($hostname_gary, $username_gary, $password_gary) or trigger_error(mysql_error(),E_USER_ERROR); Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031735 Share on other sites More sharing options...
JonnoTheDev Posted March 25, 2010 Share Posted March 25, 2010 Simple, READ THE ERROR! The username and password you are using is incorrect. 1. Do not use 'root' as the user for connecting to the database. If this password gets out you are in big trouble. 2. As I have said, you should have setup a username and password to use to connect to your database. 3. If you have access to the mysql server via SSH or whatever then setup a user for this database, otherwise get the server admin to do it. 4. Don't use persistent connections mysql_pconnect() use mysql_connect(). Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031739 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 Now I've put this- <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_gary = "localhost"; $database_gary = "people"; $username_gary = "new"; $password_gary = "garyt"; $gary = mysql_pconnect($hostname_gary, $username_gary, $password_gary) or trigger_error(mysql_error(),E_USER_ERROR); ?> and now i get- Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'new'@'localhost' (using password: YES) in /home/c/h/chichesterag/public_html/Connections/gary.php on line 9 Fatal error: Access denied for user 'new'@'localhost' (using password: YES) in /home/c/h/chichesterag/public_html/Connections/gary.php on line 9 What have I got to do now? Sorry to keep asking. Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031771 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 On the server it has a run sql where I can type in commands. Do I need to type in commands and, if so, what? Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031820 Share on other sites More sharing options...
GalaxyTramp Posted March 25, 2010 Share Posted March 25, 2010 Hi Do you have CPanel or Plesk on the server? Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031849 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 I have a cpanel with these options Security FrontPage SSL Error Page CGI Scripts mySQL Dialup Accounts DNS ADSL SubmitXtra Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031852 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 When I click on mysql i get mySQL mySQL is a powerful database server. mySQL databases can be integrated into web pages opening opportunities for advanced data driven sites and ecommerce. mySQL is currently set-up on this account. Change mySQL Password mySQL Administrator Remove mySQL Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031853 Share on other sites More sharing options...
GalaxyTramp Posted March 25, 2010 Share Posted March 25, 2010 If you login to CPanel you will be able to access phpmyadmin and to setup MySql databases. Are you sure that you have CPanel on the server?? Who are you hosted with? Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031856 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 Clicking on mysql administrator i get- List Tables Create Table Export Data Run SQL and Table List The tables within your database are shown below. Table Records Action newtablee 0 Browse Search Properties Insert Drop Empty Rename Add Create New Table Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031858 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 I'm hosted with Green on Red IT Ltd Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031859 Share on other sites More sharing options...
GalaxyTramp Posted March 25, 2010 Share Posted March 25, 2010 Seems likely that you do not have CPanel or Plesk. What you need to do is check in the MySql administrator that your table "people" exists, what the name of your database is and what the password is. This may be of use: http://www.ghacks.net/2009/12/09/creating-a-database-with-mysql-administrator/ Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031865 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 Thanks. So how do i use that program to connect to green on Red's server? Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031882 Share on other sites More sharing options...
GalaxyTramp Posted March 25, 2010 Share Posted March 25, 2010 The MySql administrator interface is already connected to the server. You just need to use it to manipulate the MySql database. From your previous post I see you have a table called "newtblee" with "0" records but what is the name of the database schema this is contained in? Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031903 Share on other sites More sharing options...
garydt Posted March 25, 2010 Author Share Posted March 25, 2010 the database is called people but the online server hasn't any options where i can create a database. Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1031918 Share on other sites More sharing options...
GalaxyTramp Posted March 26, 2010 Share Posted March 26, 2010 the database is called people but the online server hasn't any options where i can create a database. You have 2 options here I think. 1. Ask your host to explain how to do this step by step. 2. Find some better hosting for your site, with CPanel or Plesk which makes all this stuff a piece of cake. I think I would most certainly take the latter option. GT Quote Link to comment https://forums.phpfreaks.com/topic/196505-trouble-with-server/#findComment-1032141 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.