Jump to content

Trouble with server


garydt

Recommended Posts

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?

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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');

Link to comment
Share on other sites

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); 

Link to comment
Share on other sites

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().

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.