usmansultan
asked on
How do i link Web Pages with PHP?
We are in the process of migrating the website from our previous webhost to a new one, now i have transferred all the folders, and i have requested the webhost (i.e. netregistry) to provide us with a Temporary link until we redelgate our website to them, now on this website there is an SQL database which has around 8 tables, which i have created under the console-->php my admin, now when i uploaded all the files folders to the ftp, the website is working fine except where ever there is a PHP page it doesnt display it. The test link is http://rere6659.staging-zeus.netregistry.net/ , if you see under Announcements it says the database is down, how can i link it, or is there anything else needs to be done, Also under the Contact-->Make an enquiry it has a similar problem.
Any help would be much appreciated.
Any help would be much appreciated.
The database connector is most likely coded with a connection string to either your domain name or you old IP address. You need to edit the connection string to point to the new database.
ASKER
Where i can find the database connector and how can i do that, would it be under the console of my new web host account.
ASKER
I am under the PHP my Admin concole i have added a snapshot as well. Let me know if that helps.
PHP-My-Admin.JPG
PHP-My-Admin.JPG
You should have a file somewhere that contains the PHP that is used to open a connection and select a database (or it may be done on the fly each time a connection is required).
This file is not part of phpMyAdmin.
Take a look at one of your files that require to connect to the database, check for something like:
mysql_connect
This file is not part of phpMyAdmin.
Take a look at one of your files that require to connect to the database, check for something like:
mysql_connect
If you have not hard coded this page, I will first look on:
Check if there is any page included like
<?php
include './..............';
?>
Or,
<?php require_once("......"); ?>
If you find the file check the file and look on database connection defined like what Tchuki said above.
This is the normal practice otherwise you might have the db connection in the same page like index.php.
For Enquiry page check these lines in enquiry/index.php:
Notice: Undefined index: t in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/enquiry /index.php on line 2
Notice: Undefined index: p in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/enquiry /index.php on line 3
Hope this may help you.
Check if there is any page included like
<?php
include './..............';
?>
Or,
<?php require_once("......"); ?>
If you find the file check the file and look on database connection defined like what Tchuki said above.
This is the normal practice otherwise you might have the db connection in the same page like index.php.
For Enquiry page check these lines in enquiry/index.php:
Notice: Undefined index: t in /clientdata/clients/r/e/re
Notice: Undefined index: p in /clientdata/clients/r/e/re
Hope this may help you.
ASKER
I was not able to find any file which says mysql_connect, but on the main index page which is in php, i found a Php icon under Announcements, and on that icon the code is.
dbConnect("website");
$sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
$result = mysql_query($sql);
$i=0;
while ($i < 2) {
$subject = mysql_result($result,$i,"s ubject");
$subtitle = mysql_result($result,$i,"s ubtitle");
$i++;
So do i have to change the name where its say dbconnect ("website"), if i have to change that what should i insert in " ".
dbConnect("website");
$sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
$result = mysql_query($sql);
$i=0;
while ($i < 2) {
$subject = mysql_result($result,$i,"s
$subtitle = mysql_result($result,$i,"s
$i++;
So do i have to change the name where its say dbconnect ("website"), if i have to change that what should i insert in " ".
ASKER
I have found one file with the name mysql.server, and the code of it is like this........
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
# MySQL daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 20
# description: A very fast and reliable SQL database engine.
# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
# If you install MySQL on some other places than /usr/local/mysql-4.0.27, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
# [mysqld]
# basedir=<path-to-mysql-ins tallation- directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
# and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directo ry to the basedir variable
# below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
basedir=
# The following variables are only set for letting mysql.server find things.
# Set some defaults
datadir=/usr/local/mysql-4 .0.27/var
pid_file=
if test -z "$basedir"
then
basedir=/usr/local/mysql-4 .0.27
bindir=/usr/local/mysql-4. 0.27/bin
else
bindir="$basedir/bin"
fi
PATH=/sbin:/usr/sbin:/bin: /usr/bin:$ basedir/bi n
export PATH
mode=$1 # start or stop
case `echo "testing\c"`,`echo -n testing` in
*c*,-n*) echo_n= echo_c= ;;
*c*,*) echo_n=-n echo_c= ;;
*) echo_n= echo_c='\c' ;;
esac
parse_arguments() {
for arg do
case "$arg" in
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac
done
}
# Get arguments from the my.cnf file,
# groups [mysqld] [mysql_server] and [mysql.server]
if test -x ./bin/my_print_defaults
then
print_defaults="./bin/my_p rint_defau lts"
elif test -x $bindir/my_print_defaults
then
print_defaults="$bindir/my _print_def aults"
elif test -x $bindir/mysql_print_defaul ts
then
print_defaults="$bindir/my sql_print_ defaults"
else
# Try to find basedir in /etc/my.cnf
conf=/etc/my.cnf
print_defaults=
if test -r $conf
then
subpat='^[^=]*basedir[^=]* =\(.*\)$'
dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
for d in $dirs
do
d=`echo $d | sed -e 's/[ ]//g'`
if test -x "$d/bin/my_print_defaults"
then
print_defaults="$d/bin/my_ print_defa ults"
break
fi
if test -x "$d/bin/mysql_print_defaul ts"
then
print_defaults="$d/bin/mys ql_print_d efaults"
break
fi
done
fi
# Hope it's in the PATH ... but I doubt it
test -z "$print_defaults" && print_defaults="my_print_d efaults"
fi
#
# Test if someone changed datadir; In this case we should also read the
# default arguments from this directory
#
extra_args=""
if test "$datadir" != "/usr/local/mysql-4.0.27/v ar"
then
extra_args="-e $datadir/my.cnf"
fi
parse_arguments `$print_defaults $extra_args mysqld mysql_server mysql.server`
#
# Set pid file if not given
#
if test -z "$pid_file"
then
pid_file=$datadir/`/bin/ho stname`.pi d
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$datadir/$pid_fi le" ;;
esac
fi
# Safeguard (relative paths, core dumps..)
cd $basedir
case "$mode" in
'start')
# Start daemon
if test -x $bindir/mysqld_safe
then
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 &
# Make lock for RedHat / SuSE
if test -w /var/lock/subsys
then
touch /var/lock/subsys/mysql
fi
else
echo "Can't execute $bindir/mysqld_safe from dir $basedir"
fi
;;
'stop')
# Stop daemon. We use a signal here to avoid having to know the
# root password.
if test -s "$pid_file"
then
mysqld_pid=`cat $pid_file`
echo "Killing mysqld with pid $mysqld_pid"
kill $mysqld_pid
# mysqld should remove the pid_file when it exits, so wait for it.
sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaa ]
do
[ -z "$flags" ] && echo $echo_n "Wait for mysqld to exit$echo_c" || echo $echo_n ".$echo_c"
flags=a$flags
sleep 1
done
if [ -s $pid_file ]
then echo " gave up waiting!"
elif [ -n "$flags" ]
then echo " done"
fi
# delete lock for RedHat / SuSE
if test -f /var/lock/subsys/mysql
then
rm -f /var/lock/subsys/mysql
fi
else
echo "No mysqld pid file found. Looked for $pid_file."
fi
;;
'restart')
# Stop the service and regardless of whether it was
# running or not, start it again.
$0 stop
$0 start
;;
*)
# usage
echo "Usage: $0 start|stop|restart"
exit 1
;;
esac
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
# MySQL daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 20
# description: A very fast and reliable SQL database engine.
# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
# If you install MySQL on some other places than /usr/local/mysql-4.0.27, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
# [mysqld]
# basedir=<path-to-mysql-ins
# - Add the above to any other configuration file (for example ~/.my.ini)
# and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directo
# below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
basedir=
# The following variables are only set for letting mysql.server find things.
# Set some defaults
datadir=/usr/local/mysql-4
pid_file=
if test -z "$basedir"
then
basedir=/usr/local/mysql-4
bindir=/usr/local/mysql-4.
else
bindir="$basedir/bin"
fi
PATH=/sbin:/usr/sbin:/bin:
export PATH
mode=$1 # start or stop
case `echo "testing\c"`,`echo -n testing` in
*c*,-n*) echo_n= echo_c= ;;
*c*,*) echo_n=-n echo_c= ;;
*) echo_n= echo_c='\c' ;;
esac
parse_arguments() {
for arg do
case "$arg" in
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac
done
}
# Get arguments from the my.cnf file,
# groups [mysqld] [mysql_server] and [mysql.server]
if test -x ./bin/my_print_defaults
then
print_defaults="./bin/my_p
elif test -x $bindir/my_print_defaults
then
print_defaults="$bindir/my
elif test -x $bindir/mysql_print_defaul
then
print_defaults="$bindir/my
else
# Try to find basedir in /etc/my.cnf
conf=/etc/my.cnf
print_defaults=
if test -r $conf
then
subpat='^[^=]*basedir[^=]*
dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
for d in $dirs
do
d=`echo $d | sed -e 's/[ ]//g'`
if test -x "$d/bin/my_print_defaults"
then
print_defaults="$d/bin/my_
break
fi
if test -x "$d/bin/mysql_print_defaul
then
print_defaults="$d/bin/mys
break
fi
done
fi
# Hope it's in the PATH ... but I doubt it
test -z "$print_defaults" && print_defaults="my_print_d
fi
#
# Test if someone changed datadir; In this case we should also read the
# default arguments from this directory
#
extra_args=""
if test "$datadir" != "/usr/local/mysql-4.0.27/v
then
extra_args="-e $datadir/my.cnf"
fi
parse_arguments `$print_defaults $extra_args mysqld mysql_server mysql.server`
#
# Set pid file if not given
#
if test -z "$pid_file"
then
pid_file=$datadir/`/bin/ho
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$datadir/$pid_fi
esac
fi
# Safeguard (relative paths, core dumps..)
cd $basedir
case "$mode" in
'start')
# Start daemon
if test -x $bindir/mysqld_safe
then
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 &
# Make lock for RedHat / SuSE
if test -w /var/lock/subsys
then
touch /var/lock/subsys/mysql
fi
else
echo "Can't execute $bindir/mysqld_safe from dir $basedir"
fi
;;
'stop')
# Stop daemon. We use a signal here to avoid having to know the
# root password.
if test -s "$pid_file"
then
mysqld_pid=`cat $pid_file`
echo "Killing mysqld with pid $mysqld_pid"
kill $mysqld_pid
# mysqld should remove the pid_file when it exits, so wait for it.
sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaa
do
[ -z "$flags" ] && echo $echo_n "Wait for mysqld to exit$echo_c" || echo $echo_n ".$echo_c"
flags=a$flags
sleep 1
done
if [ -s $pid_file ]
then echo " gave up waiting!"
elif [ -n "$flags" ]
then echo " done"
fi
# delete lock for RedHat / SuSE
if test -f /var/lock/subsys/mysql
then
rm -f /var/lock/subsys/mysql
fi
else
echo "No mysqld pid file found. Looked for $pid_file."
fi
;;
'restart')
# Stop the service and regardless of whether it was
# running or not, start it again.
$0 stop
$0 start
;;
*)
# usage
echo "Usage: $0 start|stop|restart"
exit 1
;;
esac
ASKER
To give you guys more info, on the old webhost all the files were located under\www\htdocs\. but on the new webhost it was not reading the index.php file from htdocs, so i have copied all the files across to the main ftp folder, the rest of the website is working ok.its just the php stuff, thats not coming up as its suppose to......
Then perhaps php is not enable on the new host. In the htdocs directory create a new file called phptest.php. In that file type the following;
<? phpinfo() ?>
Open a web broswer and type the full path example: http://mydomain.com/phptest.php
If php is enabled you will see a page generated with the php information. If the page show the text above then php is not enabled.
<? phpinfo() ?>
Open a web broswer and type the full path example: http://mydomain.com/phptest.php
If php is enabled you will see a page generated with the php information. If the page show the text above then php is not enabled.
ASKER
Thanks for your reply....
PHP is enabled on the webhost, i have checked it under console, and as i have mentioned i have copied all the files across from htdocs to the main ftp directory that means there is no subdirectory.
The only thing that was disabled was CGI. Which i have enabled........
PHP is enabled on the webhost, i have checked it under console, and as i have mentioned i have copied all the files across from htdocs to the main ftp directory that means there is no subdirectory.
The only thing that was disabled was CGI. Which i have enabled........
ASKER
Ok one thing started working after enabling CGI, the enquiry page.......
Now the main index page is left...........on which the anouncement database is showing its down....
Now the main index page is left...........on which the anouncement database is showing its down....
ASKER
and the support centre as well...which is not working...
ASKER
So should i still create the webpage as "Net worker" suggested and try out if php is running or not...
The ftp directory should be the same physical location as your web root directory. So what you have done has no real effect and makes no actual change. If your web server is configured to use htdocs as the document root then your web cannot run. You mentioned that .html is working but .php is not and therefore it is reasonable to assume that php is not functioning on your server. The test that I have suggested will determine if this is the case.
If php is in fact working then you will need to find where the variable website is defined from the statement dbConnect("website"); This is usually defined in a file in your includes directory. look for a file called dbConnect.inc or dbConnect.php. In fact the extension is arbitrary and you can usually find a reference to in your index file.
I don't really understand what you mean when you said you found an icon with the dbConnect code but that code is the reference to your database and creates the connections. It uses the dbConnect("website"); variable and that is most likely causing your issue (on the basis that php is in fact working).
If php is in fact working then you will need to find where the variable website is defined from the statement dbConnect("website"); This is usually defined in a file in your includes directory. look for a file called dbConnect.inc or dbConnect.php. In fact the extension is arbitrary and you can usually find a reference to in your index file.
I don't really understand what you mean when you said you found an icon with the dbConnect code but that code is the reference to your database and creates the connections. It uses the dbConnect("website"); variable and that is most likely causing your issue (on the basis that php is in fact working).
ASKER
I will make the information more clear, on dbConnect issue the database is called "website", and i believe this function has been defined twice in the website.
1)/admin/db.php
2)/support/centre/db.php
The code is:
<?php // db.php
$dbhost = 'response-systems.com';
$dbuser = 'root';
$dbpass = 'queensarms';
function dbConnect($db='') {
global $dbhost, $dbuser, $dbpass;
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
or die('The site database appears to be down.');
if ($db!='' and !@mysql_select_db($db))
die('The site database is unavailable.');
return $dbcnx;
}
?>
So what would be the best approach, to rename the DB or change the code, if the option is renaming the DB where do i have to go and rename the DB.
Thanks.
1)/admin/db.php
2)/support/centre/db.php
The code is:
<?php // db.php
$dbhost = 'response-systems.com';
$dbuser = 'root';
$dbpass = 'queensarms';
function dbConnect($db='') {
global $dbhost, $dbuser, $dbpass;
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
or die('The site database appears to be down.');
if ($db!='' and !@mysql_select_db($db))
die('The site database is unavailable.');
return $dbcnx;
}
?>
So what would be the best approach, to rename the DB or change the code, if the option is renaming the DB where do i have to go and rename the DB.
Thanks.
The problem is with DB connection according to your code in db.php
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
or die('The site database appears to be down.');
Check if your DB host, DB user name and DB password is correct.
Error message is fetched from here die('The site database appears to be down.');
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
or die('The site database appears to be down.');
Check if your DB host, DB user name and DB password is correct.
Error message is fetched from here die('The site database appears to be down.');
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am still think your php is suspect as you have stated that no php pages appear correctly. What mekh has said is correct but this will only work with a functioning php. What I have suggested earlier is the quickest way to establish where your problem lies. If phpinfo() yeilds no results then you have to fix php. If it does only then should you start to mess with usernames and passwords.
Assuming that php is functioning you will need to change $dbhost = 'response-systems.com'; to suit the hostname of the server. From your earlier post you would probably need to have http://rere6659.staging-zeus.netregistry.net but phpmyadmin should clearly show you the correct hostname to be using.
Assuming that php is functioning you will need to change $dbhost = 'response-systems.com'; to suit the hostname of the server. From your earlier post you would probably need to have http://rere6659.staging-zeus.netregistry.net but phpmyadmin should clearly show you the correct hostname to be using.
The hostname should not include http://
ASKER
It had helped me, i have changed the DB Host name, User and Password, but still its not connecting....
oh I didn't notice .com in dbhost.
That could be the reason.
I can see php running in some pages like http://www.response-systems.com/enquiry/index.php
and there is also perl running in the page http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles
I assume php is functioning.
That could be the reason.
I can see php running in some pages like http://www.response-systems.com/enquiry/index.php
and there is also perl running in the page http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles
I assume php is functioning.
ASKER
Thanks for your replies,
Net Worker i will definetly try your suggestion and will let you know.....because even after changing the user and db details doesnt help.......
Net Worker i will definetly try your suggestion and will let you know.....because even after changing the user and db details doesnt help.......
ASKER
Mekh, i have enabled PHP on the console, but as networker said i should test it.
The link http://www.response-systems.com/enquiry/index.php is for the active website that is running, i am migrating it to a different webhost, and the link that they provided is http://rere6659.staging-zeus.netregistry.net/, on which i am testing the website, and over here the php connections are not working.
The link http://www.response-systems.com/enquiry/index.php is for the active website that is running, i am migrating it to a different webhost, and the link that they provided is http://rere6659.staging-zeus.netregistry.net/, on which i am testing the website, and over here the php connections are not working.
I've taken a closer look at your site and it appears that PHP is running. I say this because your support login gives a php error. I would still do the test for sanity sake but this looks to be a database authentication issue. It also looks as though your .htaccess files may be missing or may need to be updated for the new site.
ASKER
whats the purpose of .htaccess, and where i can locate it.
ASKER
I have tested the PHP its working, i have upload to the file in the main directory, that means it was not working when i uploaded it under /www/htdocs, but when i uploaded it under the root folder it started working, i have uploaded all of my files and folders under the root folder, it seems like the problem is somewhere else.........
PHPTest.JPG
PHPTest.JPG
ASKER
I am pasting the DB Connect Information.
$host = "MYSQL-3.my-domain.com";
$dbname = "rs_my_domain_com";
$username = "username";
$password = "password";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$c onnection) ;
/*
Check to see if connection was successful
*/
?>
So on the website under dbconnect variable which one should be the right one, MYSQL or rs.
$host = "MYSQL-3.my-domain.com";
$dbname = "rs_my_domain_com";
$username = "username";
$password = "password";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$c
/*
Check to see if connection was successful
*/
?>
So on the website under dbconnect variable which one should be the right one, MYSQL or rs.
Can you try this simple code that will connect to your database in a single php file rather than calling function.
Just a try:
<?php //test_db_connect.php
$hostname = "hostname"; //Change accordingly
$username = "db_user_name"; //Change accordingly
$password = "db_user_password"; //Change accordingly
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL";
//select a database to work with
$select_db = mysql_select_db("website", $dbhandle) //I changed to website (your db)
or die("Could not select website");
//If connected, execute some SQL query
//close the connection
mysql_close($dbhandle);
?>
Just a try:
<?php //test_db_connect.php
$hostname = "hostname"; //Change accordingly
$username = "db_user_name"; //Change accordingly
$password = "db_user_password"; //Change accordingly
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL";
//select a database to work with
$select_db = mysql_select_db("website",
or die("Could not select website");
//If connected, execute some SQL query
//close the connection
mysql_close($dbhandle);
?>
oh same time:
ASKER
So mekh should i try the code that you asked me to do,
but where should i include this code and how can i call it or test it.
but where should i include this code and how can i call it or test it.
it should be rs because according to your code:
$host = "MYSQL-3.my-domain.com";
$dbname = "rs_my_domain_com";
MYSQL-3.my-domain.com ==> This is Database host
(I never come up with .com in the db host is the host correct)
rs_my_domain_com ==> This is your database
$host = "MYSQL-3.my-domain.com";
$dbname = "rs_my_domain_com";
MYSQL-3.my-domain.com ==> This is Database host
(I never come up with .com in the db host is the host correct)
rs_my_domain_com ==> This is your database
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes the host name is correct i pasted it from the Console, can you please tell me what Networker meant by "database authentication issue" in is last post.....
What i meant was exactly what we are working through now. Run the code that mekh has given you so that you can test authentication to the database.
I still think you are using the wrong hostname and database details in your connection string. From the image you posted you should be using the following;
host:MYSQL-3.servers.netre gistry.com
database:rs_response_syste ms_com
Check that you have the correct user permissions in phpmyadmin for the database user you are using. You will need a user who has access to that database @localhost and/or @MYSQL-3.servers.netregist ry.com
I still think you are using the wrong hostname and database details in your connection string. From the image you posted you should be using the following;
host:MYSQL-3.servers.netre
database:rs_response_syste
Check that you have the correct user permissions in phpmyadmin for the database user you are using. You will need a user who has access to that database @localhost and/or @MYSQL-3.servers.netregist
ASKER
I have tested the code as you said, and it generated this error.
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'MYSQL-3.response-systems. com' (1) in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/dbtesti ng.php on line 9
Unable to connect to MySQL
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'MYSQL-3.response-systems.
Unable to connect to MySQL
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'MYSQL-3.response-systems. com' (1) in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/dbtesti ng.php on line 9
Unable to connect to MySQL
This error message clearly says that host name is NOT CORRECT.
Unable to connect to MySQL
This error message clearly says that host name is NOT CORRECT.
ASKER
I will check the user permissions pn phpmyadmin, just wanted to make one thing clear,
from console of the webhost its showing the host is
$host = "MYSQL-3.response-systems. com";
but as Net Worker suggested it should be
host:MYSQL-3.servers.netre gistry.com
So which one should i use.........
from console of the webhost its showing the host is
$host = "MYSQL-3.response-systems.
but as Net Worker suggested it should be
host:MYSQL-3.servers.netre
So which one should i use.........
You originally said this was a staging area till your transfer was complete. Once the DNS is transfered then you can use MYSQL-3.response-systems.c om but until then you have no DNS to resolve that host so you will need to use MYSQL-3.servers.netregistr y.com
where is your database?
Response-systems.com or servers.netregistry.com?
Response-systems.com or servers.netregistry.com?
Mekh response-systems.com is his domain and he has transferred to netregistry for his hosting. His DNS is not transferred which is causing his issues.
ASKER
My database is at Netregistry, so i will change my host name on all the files where its mentioned, but if i am not wrong i dont have to change the dbname.
Just change it on the test code that mekh gave you first. Don't mess with the web site till you actually know where the problem lies. Once the test code gives you success then make the appropriate changes.
Yeah thats the good practice.
Try the test code first and if it works... you can go for other changes.
Try the test code first and if it works... you can go for other changes.
ASKER
I have change the code, i have just pasted it to make sure i am not doing anything wrong
<?php //test_db_connect.php
$hostname = "MYSQL-3.servers.netregist ry.com"; //Change accordingly
$username = "username"; //Change accordingly
$password = "password"; //Change accordingly
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL";
//select a database to work with
$select_db = mysql_select_db("rs_respon se_systems _com",$dbh andle) //I changed to website (your db)
or die("Could not select website");
//If connected, execute some SQL query
//close the connection
mysql_close($dbhandle);
?>
but, Its still giving the same error
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'MYSQL-3.servers.netregist ry.com' (1) in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/dbtesti ng.php on line 9
Unable to connect to MySQL
<?php //test_db_connect.php
$hostname = "MYSQL-3.servers.netregist
$username = "username"; //Change accordingly
$password = "password"; //Change accordingly
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL";
//select a database to work with
$select_db = mysql_select_db("rs_respon
or die("Could not select website");
//If connected, execute some SQL query
//close the connection
mysql_close($dbhandle);
?>
but, Its still giving the same error
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'MYSQL-3.servers.netregist
Unable to connect to MySQL
Try using localhost as the hostname.
Code is fine.
The problem is with the host name.
Is this MYSQL-3.servers.netregistr y.com the right host name?
From netregistry.com support page: http://www.netregistry.com.au/customer-service/support/database/mysql_code.php
<?
$host = "mysql.yourdomainname";
$dbname = "dbname_domain_com";
$username = "dbusername";
$password = "dbpassword";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$c onnection) ;
/*
Check to see if connection was successful
*/
?>
The problem is with the host name.
Is this MYSQL-3.servers.netregistr
From netregistry.com support page: http://www.netregistry.com.au/customer-service/support/database/mysql_code.php
<?
$host = "mysql.yourdomainname";
$dbname = "dbname_domain_com";
$username = "dbusername";
$password = "dbpassword";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$c
/*
Check to see if connection was successful
*/
?>
ASKER
Doesnt want to connect same error.
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.so ck' (2) in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/dbtesti ng.php on line 9
Unable to connect to MySQL
Would it be helpful to anyone of you, if i will send you the username and password and u can check it out from your end.......
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.so
Unable to connect to MySQL
Would it be helpful to anyone of you, if i will send you the username and password and u can check it out from your end.......
try this in your dbhost
mysql.response-systems.com
mysql.response-systems.com
ASKER
same error if itry mysql.response-systems.com .
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'mysql.response-systems.co m' (1) in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/dbtesti ng.php on line 9
Unable to connect to MySQL
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'mysql.response-systems.co
Unable to connect to MySQL
As I said earlier you will need a DNS record pointing to that hostname or it will fail.
ASKER
I am pasting the Database information again,from the console of the webhost, hope it might help u guys........
<?
$host = "MYSQL-3.response-systems. com";
$dbname = "rs_response_systems_com";
$username = "username";
$password = "password";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$c onnection) ;
/*
Check to see if connection was successful
*/
?>
<?
$host = "MYSQL-3.response-systems.
$dbname = "rs_response_systems_com";
$username = "username";
$password = "password";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$c
/*
Check to see if connection was successful
*/
?>
try without .com
mysql.response-systems
mysql.response-systems
ASKER
As i said before that i am happy to provide the username and password to any one of you, through email.....if it will be helpful.......
also take out the MYSQL-3 portion.
ASKER
Networker which dns record should i redirect to this host.....because i cant redirect the original one until this is working........
and mekh i tried without.com, it generates the same error..
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'mysql.response-systems' (1) in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/dbtesti ng.php on line 9
Unable to connect to MySQL
and mekh i tried without.com, it generates the same error..
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'mysql.response-systems' (1) in /clientdata/clients/r/e/re
Unable to connect to MySQL
and with that portion removed put the .com back in.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so networker you are suggesting that the host should be "response-systems" or "mysql.response-systems"
ASKER
i have tried 'MYSQL.servers.netregistry .com' , doesnt work.......
According to netregistry it should be mysql.response-systems.com . The issue you have is that you are running from a staging host and its apparent that DNS is not yet working. The actual database host is MYSQL-3.servers.netregistr y.com which can be seen in your phpmyadmin console. The problem you face is that netregistry will have controls in place to force you to use mysql.response-systems.com but until your website is cut over correctly you will need some extra configuration to make it work.
Several options are setup a DNS host record as mentioned above. Ask netregistry to add an entry in the hosts file of the server and have it do local lookups or allow your account to connect to the database by IP address and provide you with that address.
Several options are setup a DNS host record as mentioned above. Ask netregistry to add an entry in the hosts file of the server and have it do local lookups or allow your account to connect to the database by IP address and provide you with that address.
You haven't yet tried mysql.response-systems.com have you?
ASKER
ok will do now.....
ASKER
I have tried 'mysql.response-systems.co m' it doesnt work,..
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'mysql.response-systems.co m' (1) in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/dbtesti ng.php on line 9
Unable to connect to MySQL
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'mysql.response-systems.co
Unable to connect to MySQL
Did you enable mysql?
http://www.netregistry.com.au/customer-service/support/database/mysql.php
Have you asked any support question to them?
There might be some configuration needed in netregistry server.
my guess.
http://www.netregistry.com.au/customer-service/support/database/mysql.php
Have you asked any support question to them?
There might be some configuration needed in netregistry server.
my guess.
ASKER
ok guys i have called up netregistry and they have given me this host address.
mysql-3.netregistry.net.
and it worked.
You can check it........
mysql-3.netregistry.net.
and it worked.
You can check it........
Nice to know that finally it is sorted...
Thats where we were digging till now...
Thats where we were digging till now...
ASKER
But right now its giving errors on Announcement page.....
ASKER
where would i have to go and change it......
ASKER
and support centre page as well....
what is on line 123 and 124 in index.php
ASKER
115 dbConnect("rs_response_sys tems_com") ;
117 $sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
118 $result = mysql_query($sql);
120 $i=0;
122 while ($i < 2) {
123 $subject = mysql_result($result,$i,"s ubject");
124 $subtitle = mysql_result($result,$i,"s ubtitle");
125 $i++;
117 $sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
118 $result = mysql_query($sql);
120 $i=0;
122 while ($i < 2) {
123 $subject = mysql_result($result,$i,"s
124 $subtitle = mysql_result($result,$i,"s
125 $i++;
Can you show me the whole function?
Do you have data in the table? Your tables look to be empty.
ASKER
Sure, i am pasting the codes for the whole index file, let me know if u need it with line numbers:
<?php
include_once 'admin/db.php';
include_once 'admin/common.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Site Copyright 2006 Response Systems -->
<head>
<meta name="author" content="Hadley Grindrod" />
<meta http-equiv="content-type" content="text/html;charset =iso-8859- 2" />
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Response Systems :: Home</title>
</head>
<!-- Begin Site Body -->
<body>
<div class="content">
<!-- Begin Header Section -->
<div class="header_top"></div>
<div class="header">
<!-- Begin Navigation Bar -->
<div class="header_right">
<div id="nav">
<p><a href="solutions/">Solution s</a> | <a href="support/">Support</a > | <a href="links/">Links</a> | <a href="contact/">Contact</a ></p>
</div>
<div class="header_search">
<form method="get" action="http://response-systems.com/cgi-bin/search/search.pl">
<p><input type="text" name="Terms" class="search" /> <input type="submit" value="Search" class="submit" /></p>
</form>
</div>
</div>
<!-- Begin Logo Placement -->
<div class="header_left">
<a href="#"><img src="images/responselogo.j pg" alt="Response Systems" /></a>
</div>
<!-- Finish Header Section -->
</div>
<div class="header_bottom"></di v>
<!-- Begin Banner Placement -->
<div class="spacer"></div>
<div class="header_top"></div>
<div class="subheader">
<a href="solutions/"><img src="images/banner.jpg" alt="Solutions" /></a>
</div>
<div class="header_bottom"></di v>
<div class="spacer"></div>
<!-- Begin Content Area -->
<div class="header_top"></div>
<!-- Column 1 : Left : Solutions -->
<div class="column">
<div class="box_top">
<h2><a href="solutions/">Solution s:</a></h2 >
</div>
<div class="box_icon">
<a href="solutions/cse/"><img src="images/icons/cseicon. gif" alt="CSE-Edit/Access" /></a>
<h2><a href="solutions/cse/">CSE- Edit/Acces s</a></h2>
<p><a href="solutions/cse/">AllF usion Gen Client Server Encyclopedia Solutions</a></p>
</div>
<div class="box_icon">
<a href="solutions/ce/"><img src="images/icons/ceicon.g if" alt="CE-Edit/Access" /></a>
<h2><a href="solutions/ce/">CE-Ed it/Access< /a></h2>
<p><a href="solutions/ce/">AllFu sion Gen Host Encyclopedia Solutions</a></p>
</div>
<div class="box_bottom"></div>
</div>
<!-- Column 2 : Centre : Support -->
<div class="column">
<div class="box_top">
<h2><a href="support/">Support:</ a></h2>
</div>
<div class="box_icon">
<a href="http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles"><img src="images/icons/base.gif " width="50" alt="Knowledgebase" /></a>
<h2><a href="http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles">Knowledgebase</a>< /h2>
<p><a href="http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles">For quick answers to the most common problems</a></p>
</div>
<div class="box_icon">
<a href="support/centre/"><im g src="images/icons/centre.g if" width="50" alt="Support Centre" /></a>
<h2><a href="support/centre/">Sup port Centre</a></h2>
<p><a href="support/centre/">Log in for access to technical support</a></p>
</div>
<div class="box_bottom"></div>
</div>
<!-- Column 3 : Right : Announcements -->
<div class="column">
<div class="box_top">
<h2><a href="announcements/">Anno uncements: </a></h2>
</div>
<?php
dbConnect("rs_response_sys tems_com") ;
$sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
$result = mysql_query($sql);
$i=0;
while ($i < 2) {
$subject = mysql_result($result,$i,"s ubject");
$subtitle = mysql_result($result,$i,"s ubtitle");
$i++;
?>
<div class="box_icon">
<a href="announcements/index. php#news_i tem<? echo $i ;?>"><img src="images/icons/news<? echo $i ;?>.gif" width="50" alt="<? echo $subject; ?>" /></a>
<h2><a href="announcements/index. php#news_i tem<? echo $i ;?>"><? echo $subject; ?></a></h2>
<p><a href="announcements/index. php#news_i tem<? echo $i ;?>"><? echo $subtitle; ?></a></p>
</div>
<?
}
?>
<div class="box_bottom"></div>
</div>
<!-- Finish Content Area -->
<div class="header_bottom"></di v>
<!-- Begin Footer -->
<div class="language">
<a href="fr/"><img src="images/Language/Franc e.png" alt="French" /></a>
<a href="de/"><img src="images/Language/Germa ny.png" alt="German" /></a>
<a href="es/"><img src="images/Language/Spain .png" alt="Spanish" /></a>
</div>
<div class="footer">
<p><a href="about/">About Response Systems</a> | <a href="privacy/">Privacy</a > | <a href="enquiry/">Feedback</ a> | <a href="contact/">Contact</a ><br />
© Copyright 2006 Response Systems</p>
</div>
</div>
</body>
</html>
<?php
include_once 'admin/db.php';
include_once 'admin/common.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Site Copyright 2006 Response Systems -->
<head>
<meta name="author" content="Hadley Grindrod" />
<meta http-equiv="content-type" content="text/html;charset
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Response Systems :: Home</title>
</head>
<!-- Begin Site Body -->
<body>
<div class="content">
<!-- Begin Header Section -->
<div class="header_top"></div>
<div class="header">
<!-- Begin Navigation Bar -->
<div class="header_right">
<div id="nav">
<p><a href="solutions/">Solution
</div>
<div class="header_search">
<form method="get" action="http://response-systems.com/cgi-bin/search/search.pl">
<p><input type="text" name="Terms" class="search" /> <input type="submit" value="Search" class="submit" /></p>
</form>
</div>
</div>
<!-- Begin Logo Placement -->
<div class="header_left">
<a href="#"><img src="images/responselogo.j
</div>
<!-- Finish Header Section -->
</div>
<div class="header_bottom"></di
<!-- Begin Banner Placement -->
<div class="spacer"></div>
<div class="header_top"></div>
<div class="subheader">
<a href="solutions/"><img src="images/banner.jpg" alt="Solutions" /></a>
</div>
<div class="header_bottom"></di
<div class="spacer"></div>
<!-- Begin Content Area -->
<div class="header_top"></div>
<!-- Column 1 : Left : Solutions -->
<div class="column">
<div class="box_top">
<h2><a href="solutions/">Solution
</div>
<div class="box_icon">
<a href="solutions/cse/"><img
<h2><a href="solutions/cse/">CSE-
<p><a href="solutions/cse/">AllF
</div>
<div class="box_icon">
<a href="solutions/ce/"><img src="images/icons/ceicon.g
<h2><a href="solutions/ce/">CE-Ed
<p><a href="solutions/ce/">AllFu
</div>
<div class="box_bottom"></div>
</div>
<!-- Column 2 : Centre : Support -->
<div class="column">
<div class="box_top">
<h2><a href="support/">Support:</
</div>
<div class="box_icon">
<a href="http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles"><img src="images/icons/base.gif
<h2><a href="http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles">Knowledgebase</a><
<p><a href="http://www.response-systems.com/cgi-bin/knowledgebase/search.pl?Terms=articles">For quick answers to the most common problems</a></p>
</div>
<div class="box_icon">
<a href="support/centre/"><im
<h2><a href="support/centre/">Sup
<p><a href="support/centre/">Log
</div>
<div class="box_bottom"></div>
</div>
<!-- Column 3 : Right : Announcements -->
<div class="column">
<div class="box_top">
<h2><a href="announcements/">Anno
</div>
<?php
dbConnect("rs_response_sys
$sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
$result = mysql_query($sql);
$i=0;
while ($i < 2) {
$subject = mysql_result($result,$i,"s
$subtitle = mysql_result($result,$i,"s
$i++;
?>
<div class="box_icon">
<a href="announcements/index.
<h2><a href="announcements/index.
<p><a href="announcements/index.
</div>
<?
}
?>
<div class="box_bottom"></div>
</div>
<!-- Finish Content Area -->
<div class="header_bottom"></di
<!-- Begin Footer -->
<div class="language">
<a href="fr/"><img src="images/Language/Franc
<a href="de/"><img src="images/Language/Germa
<a href="es/"><img src="images/Language/Spain
</div>
<div class="footer">
<p><a href="about/">About Response Systems</a> | <a href="privacy/">Privacy</a
© Copyright 2006 Response Systems</p>
</div>
</div>
</body>
</html>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
these are the tables...
Admin
+-------+-------------+--- ---+-----+ ---------+ -------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+--- ---+-----+ ---------+ -------+
| user | varchar(10) | YES | | NULL | |
| pass | varchar(12) | YES | | NULL | |
+-------+-------------+--- ---+-----+ ---------+ -------+
2 rows in set (0.04 sec)
Announcements
+----------+-------------+ ------+--- --+------- --+------- ---------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+ ------+--- --+------- --+------- ---------+
| id | int(11) | | PRI | NULL | auto_increment |
| subject | varchar(20) | YES | | NULL | |
| subtitle | varchar(80) | YES | | NULL | |
| content | text | YES | | NULL | |
| date | date | YES | | NULL | |
+----------+-------------+ ------+--- --+------- --+------- ---------+
5 rows in set (0.01 sec)
Downloads
+-------------+----------- --+------+ -----+---- -----+---- ---+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------- --+------+ -----+---- -----+---- ---+
| ptf | int(11) | YES | | NULL | |
| product | char(3) | YES | | NULL | |
| version | varchar(32) | YES | | NULL | |
| name | varchar(32) | YES | | NULL | |
| description | text | YES | | NULL | |
| issue | int(11) | YES | | NULL | |
| file | varchar(24) | YES | | NULL | |
| odbcfile | varchar(24) | YES | | NULL | |
| ora9file | varchar(24) | YES | | NULL | |
| ora10file | varchar(24) | YES | | NULL | |
+-------------+----------- --+------+ -----+---- -----+---- ---+
10 rows in set (0.01 sec)
Known Issues
+---------+-------------+- -----+---- -+-------- -+-------- --------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+- -----+---- -+-------- -+-------- --------+
| id | int(11) | | PRI | NULL | auto_increment |
| product | char(3) | YES | | NULL | |
| version | varchar(5) | YES | | NULL | |
| subject | varchar(64) | YES | | NULL | |
| content | text | YES | | NULL | |
| date | date | YES | | NULL | |
+---------+-------------+- -----+---- -+-------- -+-------- --------+
6 rows in set (0.00 sec)
Support Number
+-------+---------+------+ -----+---- -----+---- ---+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+ -----+---- -----+---- ---+
| ce | int(11) | YES | | NULL | |
| cse | int(11) | YES | | NULL | |
| other | int(11) | YES | | NULL | |
+-------+---------+------+ -----+---- -----+---- ---+
3 rows in set (0.00 sec)
Users
+---------+-------------+- -----+---- -+-------- -+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+- -----+---- -+-------- -+-------+
| user | varchar(6) | YES | | NULL | |
| pass | varchar(12) | YES | | NULL | |
| mail | varchar(32) | YES | | NULL | |
| name | varchar(32) | YES | | NULL | |
| phone | varchar(16) | YES | | NULL | |
| company | varchar(32) | YES | | NULL | |
| last | date | YES | | NULL | |
| count | int(11) | YES | | NULL | |
+---------+-------------+- -----+---- -+-------- -+-------+
8 rows in set (0.00 sec)
Admin
+-------+-------------+---
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+---
| user | varchar(10) | YES | | NULL | |
| pass | varchar(12) | YES | | NULL | |
+-------+-------------+---
2 rows in set (0.04 sec)
Announcements
+----------+-------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+
| id | int(11) | | PRI | NULL | auto_increment |
| subject | varchar(20) | YES | | NULL | |
| subtitle | varchar(80) | YES | | NULL | |
| content | text | YES | | NULL | |
| date | date | YES | | NULL | |
+----------+-------------+
5 rows in set (0.01 sec)
Downloads
+-------------+-----------
| Field | Type | Null | Key | Default | Extra |
+-------------+-----------
| ptf | int(11) | YES | | NULL | |
| product | char(3) | YES | | NULL | |
| version | varchar(32) | YES | | NULL | |
| name | varchar(32) | YES | | NULL | |
| description | text | YES | | NULL | |
| issue | int(11) | YES | | NULL | |
| file | varchar(24) | YES | | NULL | |
| odbcfile | varchar(24) | YES | | NULL | |
| ora9file | varchar(24) | YES | | NULL | |
| ora10file | varchar(24) | YES | | NULL | |
+-------------+-----------
10 rows in set (0.01 sec)
Known Issues
+---------+-------------+-
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+-
| id | int(11) | | PRI | NULL | auto_increment |
| product | char(3) | YES | | NULL | |
| version | varchar(5) | YES | | NULL | |
| subject | varchar(64) | YES | | NULL | |
| content | text | YES | | NULL | |
| date | date | YES | | NULL | |
+---------+-------------+-
6 rows in set (0.00 sec)
Support Number
+-------+---------+------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+
| ce | int(11) | YES | | NULL | |
| cse | int(11) | YES | | NULL | |
| other | int(11) | YES | | NULL | |
+-------+---------+------+
3 rows in set (0.00 sec)
Users
+---------+-------------+-
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+-
| user | varchar(6) | YES | | NULL | |
| pass | varchar(12) | YES | | NULL | |
| mail | varchar(32) | YES | | NULL | |
| name | varchar(32) | YES | | NULL | |
| phone | varchar(16) | YES | | NULL | |
| company | varchar(32) | YES | | NULL | |
| last | date | YES | | NULL | |
| count | int(11) | YES | | NULL | |
+---------+-------------+-
8 rows in set (0.00 sec)
ASKER
and when i imported them under phpmyadmin, thats how they look like.
An example of Announcement table....
Announcements-table.JPG
An example of Announcement table....
Announcements-table.JPG
Yes but is there any data in those tables?
See space usage? 0 Bytes.
ASKER
when i was migrating the website, i was given the tables that i pasted....
So there should be data in the tables..
what kind of...
So there should be data in the tables..
what kind of...
I suspect in the code:
Disable
// $subject = mysql_result($result,$i,"s ubject");
// $subtitle = mysql_result($result,$i,"s ubtitle");
in your below code and see if the result.
dbConnect("rs_response_sys tems_com") ;
117 $sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
118 $result = mysql_query($sql);
120 $i=0;
122 while ($i < 2) {
123 $subject = mysql_result($result,$i,"s ubject");
124 $subtitle = mysql_result($result,$i,"s ubtitle");
125 $i++;
Disable
// $subject = mysql_result($result,$i,"s
// $subtitle = mysql_result($result,$i,"s
in your below code and see if the result.
dbConnect("rs_response_sys
117 $sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 2";
118 $result = mysql_query($sql);
120 $i=0;
122 while ($i < 2) {
123 $subject = mysql_result($result,$i,"s
124 $subtitle = mysql_result($result,$i,"s
125 $i++;
Or better go step by step:
first only try to connect database only if that works start query if that works start fetching.
This way you can find out where ur problem is.
first only try to connect database only if that works start query if that works start fetching.
This way you can find out where ur problem is.
Tables and data export separately. You have no data as shown by the phpmyadmin image.
Because you are using different Mysql server now so there might be some migration issues between two server.
Are those mysql server same version?
some query does not work if the mysql version is different.
Are those mysql server same version?
some query does not work if the mysql version is different.
ASKER
i am bit confused here, because networker said the code is write and there is no data in the tables.....and you are suggesting to change the code....so what should i do first....
Get some data into the database and the index page issue will disappear.
As a test run this query in phpmyadmin
SELECT * from Announcments;
You will soon see if you have any data or not.
SELECT * from Announcments;
You will soon see if you have any data or not.
ASKER
networker what kind of data there should be in tables...
ASKER
i have run the query and it didnt return any result.
SQL-Query.JPG
SQL-Query.JPG
The data that shows up on the page. Subject, Subtitle, Content, Date, ID
SO there you go. No data.
Net Worker good start.
now usmansultan you need to insert the data in that table.
now usmansultan you need to insert the data in that table.
Well from you've said you only recieved the tables. You need to get an export of all the data and then import all data for all the tables.
ASKER
Thanks guys....
but what kind of data should i insert in these tables......
but what kind of data should i insert in these tables......
the data from the old database would be a good start ;)
ASKER
Did you mean by exporting all the fields from the table, and then importing them back again,
look up at the snap shot, you might get a better idea.
Export-Tables.JPG
look up at the snap shot, you might get a better idea.
Export-Tables.JPG
ASKER
I appreciate how early you are responding to my questions..
Thanks a ton.....
Thanks a ton.....
Your old database has this in it (exluding the ID because I don't know hats actual ID is)
ID;1
Subject; New Software Release
Subtitle; CSE-Access V7.6
Content; CSE-Edit/Access Version 7.6 is now commercially available with the following enhancements:
· Packaging Report. The Packaging Report has been revamped to detail the full packaged contents of a load module. This includes the dynamic link flag and member name value for all listed objects. The report is also now available from the Pick List so that the packaging details of multiple Load Modules/Procedure Steps can be returned in one operation.
· View Size Calculator. The View Size Calculator has been updated in line with the changes made to the Gen R7.6 Generation Consistency Checker. View Sizes are now calculated for both COBOL and C.
· Custom SQL. The ability to execute your own custom written SQL against multiple encyclopedia objects simultaneously is now available from the CSE-Access Pick List.
ID;1
Subject; New Software Release
Subtitle; CSE-Access V7.6
Content; CSE-Edit/Access Version 7.6 is now commercially available with the following enhancements:
· Packaging Report. The Packaging Report has been revamped to detail the full packaged contents of a load module. This includes the dynamic link flag and member name value for all listed objects. The report is also now available from the Pick List so that the packaging details of multiple Load Modules/Procedure Steps can be returned in one operation.
· View Size Calculator. The View Size Calculator has been updated in line with the changes made to the Gen R7.6 Generation Consistency Checker. View Sizes are now calculated for both COBOL and C.
· Custom SQL. The ability to execute your own custom written SQL against multiple encyclopedia objects simultaneously is now available from the CSE-Access Pick List.
You need to run that process in the image on the old database and save it to a file. You then run an import process on the new database.
Sorry that wasn't clear. Run the export you have shown on the old database. Copy the output into a file. Then run the import from the data in the file onto the new server.
ASKER
Ok will do.... the old webhost is on https://www.verio.com/,
I have to get the username and password to log in.
Before that let me get it right....
i have to export the tables and import them back in to the new webhost.
but how would i import into the new database...there is no option for importing, there is an option for insert for which i am pasting the snapshot.
Insert.JPG
I have to get the username and password to log in.
Before that let me get it right....
i have to export the tables and import them back in to the new webhost.
but how would i import into the new database...there is no option for importing, there is an option for insert for which i am pasting the snapshot.
Insert.JPG
No you don't need to export the tables you need to export the data. Once you export to an SQL file it should include all the insert statements. You simply paste that into phpmyadmin as an SQL query and let it insert all the data.
ASKER
Ok will do...i have contacted the people for verio webhost to send me user name and password to access the console, and regarding your post at 04:24PM , all of those reports, and sql quries would be there.
Thats correct. Whatever data is currently in the old database, once imported into the new one will show up as you expect it to.
ASKER
sorry for late reply, but i was waiting for them to send the username and password details, now i have the username and password, but they use telnet to access MYSQL database, so how can i export the data from telnet....
ASKER
Just one more quick question, in PHPMYadmin, when i click on the database name, it doesnt show any option to import/insert the database, but when i click on any table it give me an option to insert the fields, but the fields i believe are already there.......so what i am missing.....what i have to do....
Firstly i know i have to import the database from the old webhost in which i need help because that have to be done through telnet...
Firstly i know i have to import the database from the old webhost in which i need help because that have to be done through telnet...
I have not use Telnet but this article may be useful for you.
Have a look:
http://www.jtpratt.com/how-to-export-and-import-very-large-mysql-databases/
Have a look:
http://www.jtpratt.com/how-to-export-and-import-very-large-mysql-databases/
More relevant:
http://www.hostingmanual.net/other/mysql.shtml
For more result
Go to Google my best friend :-)
http://www.hostingmanual.net/other/mysql.shtml
For more result
Go to Google my best friend :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sure will try now.Thanks for your replies.....
ASKER
Bit strange when i enterred to the root directory of mysql, i enterred the name for the database,
which is "use website", and then after that i typed the name of the database and hit enter, it said database changed.
After that i issued the command "mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]" the cursos changed from ">" to "->" and nothing happend i guess, what should i do now.....
which is "use website", and then after that i typed the name of the database and hit enter, it said database changed.
After that i issued the command "mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]" the cursos changed from ">" to "->" and nothing happend i guess, what should i do now.....
If you entered the db name in connection then its already using it. Check that the output file has been created.
you should be typing at the linux prompt:
mysqldump -u adminame -p password website > backup.sql
You should then be sent back to your linux prompt. Then check for the file called backup.sql.
you should be typing at the linux prompt:
mysqldump -u adminame -p password website > backup.sql
You should then be sent back to your linux prompt. Then check for the file called backup.sql.
ASKER
what should i write to check where backup.sql is located.....
and how can i import it.....
and how can i import it.....
ASKER
should i issue this command...
mysql -uusername -ppassword dbname < backup.sql
but i think i dont have to specify the dbname, because as you said i am already there.
and is this command can be also used to restore the database, because i dont want to mess anything up, this is live website, not the test one.....
mysql -uusername -ppassword dbname < backup.sql
but i think i dont have to specify the dbname, because as you said i am already there.
and is this command can be also used to restore the database, because i dont want to mess anything up, this is live website, not the test one.....
No you should not be using mysql. Issue the command I showed you already. You need to use mysqldump.
Once the dump is complete type ls and look for your file. If you can't find the file issue the following command;
find / -name backup.sql
You then need to ftp or scp this sile across to the new server. Then follow the instructions I gave you to import into phpmyadmin.
Once the dump is complete type ls and look for your file. If you can't find the file issue the following command;
find / -name backup.sql
You then need to ftp or scp this sile across to the new server. Then follow the instructions I gave you to import into phpmyadmin.
ASKER
I am getting this error when iam using the sqldump comand that you gave me..
/usr/local/mysql/bin/mysql dump: Got error: 1049: Unknown database 'password' when selecting the database
So it means its not able to find the database, i have tried different combination with the database name, but everytime same error......
/usr/local/mysql/bin/mysql
So it means its not able to find the database, i have tried different combination with the database name, but everytime same error......
No it means that you forgot the -p switch and have entered the word password instead of the database name. Look, if the database is website the user is root and the password is letmein the command would be;
mysqldump -u root -p letmein website > backup.sql
Try again with the proper switches and use the command from my first example. You need to use your own login infor you can't just copy what I write here it has to be the proper user for the database.
mysqldump -u root -p letmein website > backup.sql
Try again with the proper switches and use the command from my first example. You need to use your own login infor you can't just copy what I write here it has to be the proper user for the database.
ASKER
I am enterring the code in right parameters, i am not copying and pasting.
I am enterring the command.
response-systems% mysqldump -u root -p qms website > backupfile.sql
when i enter that it ask me for the password, and when i enter the password that i have mentioned it produces the error that i have posted.......
Now i can enter this command
mysql h response-systems.com u root p
enter the password and then it goes under
my sql>
I have tried enterring the sqldump comand in both areas, it gives error at response-systems % but when i enter the same command on mysql> it doesnt say anything...and ls command doesnt work under mysql as well...
I am enterring the command.
response-systems% mysqldump -u root -p qms website > backupfile.sql
when i enter that it ask me for the password, and when i enter the password that i have mentioned it produces the error that i have posted.......
Now i can enter this command
mysql h response-systems.com u root p
enter the password and then it goes under
my sql>
I have tried enterring the sqldump comand in both areas, it gives error at response-systems % but when i enter the same command on mysql> it doesnt say anything...and ls command doesnt work under mysql as well...
OK your version is not allowing the password to be appended to the string. In that case your command will be;
response-systems% mysqldump -u root -p website > backupfile.sql
then enter the password when requested to.
response-systems% mysqldump -u root -p website > backupfile.sql
then enter the password when requested to.
ASKER
Thanks..That file "backupfile.sql"is created.
I used the ls command and now i can see it, so how can i export it.......
which command can i use, to export it........
I used the ls command and now i can see it, so how can i export it.......
which command can i use, to export it........
ASKER
I downloaded the file through ftp...so how can i import that to the new website......
ASKER
Should i delete all the tables that are in phpmy admin and import this backup file.....
I am assuming that means the file is on the new server. Follow the instruction from my earlier post at 02:46PM EST.
ASKER
will do...should i delete all the tables....so that when i import this file it will create everthing....all the tables...i am thinking if i import this it might conflict/import wrong fields into different tables....thats why i was wondering should i do it or not.....
Take a look at the file. You will see that it will have a statement to drop the database and it will the then rebuild the database, create the tables, and insert the data.
I am working on the basis that your database structure is unchanged and if that is the case you can chose to either leave the drop statement in there or you can remove it which will then just import the data.
If you chose to remove the drop statement and import the data only search the file for 'create table' entries to find which tables the file wants to create and delete them also.
I am working on the basis that your database structure is unchanged and if that is the case you can chose to either leave the drop statement in there or you can remove it which will then just import the data.
If you chose to remove the drop statement and import the data only search the file for 'create table' entries to find which tables the file wants to create and delete them also.
Just to clarify if you only want to insert the data, make sure the file only has statements which begin with INSERT INTO and no statements that begin with DROP or CREATE
ASKER
It has started working, but if click on Announcements page, its giving an error, on the left side,
"Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/announc ements/ind ex.php on line 75
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/announc ements/ind ex.php on line 76
and on the bottom of the page its giving an error.
"Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/announc ements/ind ex.php on line 104
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re sponse-sys tems.com/w ww/announc ements/ind ex.php on line 105
Should i paste those lines over here.......
"Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re
and on the bottom of the page its giving an error.
"Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 2 on MySQL result index 4 in /clientdata/clients/r/e/re
Should i paste those lines over here.......
ASKER
68 dbConnect("rs_response_sys tems_com") ;
70 $sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 3";
71 $result = mysql_query($sql);
73 $i=0;
74 while ($i < 3) {
75 $subject = mysql_result($result,$i,"s ubject");
76 $subtitle = mysql_result($result,$i,"s ubtitle");
77 $i++;
78 if ($subject != "") {
79 ?>
70 $sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 3";
71 $result = mysql_query($sql);
73 $i=0;
74 while ($i < 3) {
75 $subject = mysql_result($result,$i,"s
76 $subtitle = mysql_result($result,$i,"s
77 $i++;
78 if ($subject != "") {
79 ?>
ASKER
101 $i=0;
103 while ($i < 3) {
104 $subject = mysql_result($result,$i,"s ubject");
105 $content = mysql_result($result,$i,"c ontent");
106 $i++;
103 while ($i < 3) {
104 $subject = mysql_result($result,$i,"s
105 $content = mysql_result($result,$i,"c
106 $i++;
ASKER
If you want to see the whole function.....
<?php
include_once '../admin/db.php';
include_once '../admin/common.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Site Copyright 2006 Response Systems -->
<head>
<meta name="author" content="Hadley Grindrod" />
<meta http-equiv="content-type" content="text/html;charset=iso-8859-2" />
<link rel="stylesheet" href="../style.css" type="text/css" />
<title>Response Systems :: Announcements</title>
</head>
<!-- Begin Site Body -->
<body>
<div class="content">
<!-- Begin Header Section -->
<div class="header_top"></div>
<div class="header">
<!-- Begin Navigation Bar -->
<div class="header_right">
<div id="nav">
<p><a href="../solutions/">Solutions</a> | <a href="../support/">Support</a> | <a href="../links/">Links</a> | <a href="../contact/">Contact</a></p>
</div>
<div class="header_search">
<form method="get" action="http://response-systems.com/cgi-bin/search/search.pl">
<p><input type="text" name="Terms" class="search" /> <input type="submit" value="Search" class="submit" /></p>
</form>
</div>
</div>
<!-- Begin Logo Placement -->
<div class="header_left">
<a href="../"><img src="../images/responselogo.jpg" alt="Home" /></a>
</div>
<!-- Finish Header Section -->
</div>
<div class="header_bottom"></div>
<div class="spacer"></div>
<!-- Begin Content Area -->
<div class="header_top"></div>
<!-- Column 1 : Left : News Links -->
<div class="column">
<div class="box_top">
<h2>Announcements</h2>
</div>
<?php
dbConnect("rs_response_systems_com");
$sql = "SELECT * FROM announcements ORDER BY id DESC LIMIT 3";
$result = mysql_query($sql);
$i=0;
while ($i < 3) {
$subject = mysql_result($result,$i,"subject");
$subtitle = mysql_result($result,$i,"subtitle");
$i++;
if ($subject != "") {
?>
<div class="box_icon">
<a href="index.php#news_item<? echo $i ;?>"><img src="../images/icons/news<? echo $i ;?>.gif" width="50" alt="<? echo $subject; ?>" /></a>
<h2><a href="index.php#news_item<? echo $i ;?>"><? echo $subject; ?></a></h2>
<p><a href="index.php#news_item<? echo $i ;?>"><? echo $subtitle; ?></a></p>
</div>
<?
}
}
?>
<div class="box_bottom"></div>
</div>
<!-- Column 2 : Right : Content -->
<div class="column2">
<h2>Announcements</h2>
<?
$i=0;
while ($i < 3) {
$subject = mysql_result($result,$i,"subject");
$content = mysql_result($result,$i,"content");
$i++;
?>
<!-- News Item <? echo $i ;?> -->
<p id="news_item<? echo $i ;?>"><b><? echo $subject; ?></b></p>
<p><? echo nl2br($content); ?></p>
<?
}
?>
</div>
<!-- Finish Content Area -->
<div class="header_bottom"></div>
<!-- Begin Footer -->
<div class="language">
<a href="../fr/"><img src="../images/Language/France.png" alt="French" /></a>
<a href="../de/"><img src="../images/Language/Germany.png" alt="German" /></a>
<a href="../es/"><img src="../images/Language/Spain.png" alt="Spanish" /></a>
</div>
<div class="footer">
<p><a href="../about/">About Response Systems</a> | <a href="../privacy/">Privacy</a> | <a href="../enquiry/">Feedback</a> | <a href="../contact/">Contact</a><br />
© Copyright 2006 Response Systems</p>
</div>
</div>
</body>
</html>
ASKER
Should i use "mysql_fetch_assoc " instead of "$subject = mysql_result($result,$i,"s ubject")
This looks to me as though its trying to get to i=4 but the function is supposed to stop at i=2.
Given that we have now resolved your original question and you are now able to connect to your database, you should close this thread and open a new question in the PHP zone. You will likely get a PHP guru give you an answer within minutes.
Given that we have now resolved your original question and you are now able to connect to your database, you should close this thread and open a new question in the PHP zone. You will likely get a PHP guru give you an answer within minutes.
ASKER
ok...will do....can you please tell me how should i start a new question, means how much details will be needed over in the new question, or would you be able to help me in the new question as well.......
In your new question, take everything from your last 3 posts, the 2 with errors and the code. The question just needs to ask for help on the specific issue:
website and database has been moved to a new server. No changes were made to the code but I am now getting this error.
website and database has been moved to a new server. No changes were made to the code but I am now getting this error.
ASKER
Thanks a lot Networker and Mekh, you have given great in diagnosing the issue and pointing me to right direction.
ASKER
Hi Networker, i have posted the question but havent received any reply in the last 2 hours...Can you have a look at it please.....Its posted under PHP zone, and the link is
https://www.experts-exchange.com/questions/23478184/PHP-and-MySQL-errors-during-Website-Transition.html
Thanks.
https://www.experts-exchange.com/questions/23478184/PHP-and-MySQL-errors-during-Website-Transition.html
Thanks.
Nice to know that part of your problem is sorted