Trouble moving site to new server. Unsure what the problem was

Hi everyone, I hope someone can help me with this issue.

I’ve recently moved my site from a university server, copied the database to the new server and uploaded all of the content. For some reason I’m now not getting any of my database images/information on the site even though ive changed the connect_to_mysql.php pages username, password and database name to match the data on the new server.

The error messages that appear can be seen here: www.talenthound.co.uk

This is how the site should look on the original server http://newmedia.leeds.ac.uk/ug09/cs09j2h/project/index.php

Does any have any idea where I’ve gone wrong?.. Very confused

Make sure that the user info is the same for the database and not some stupid add on name like joeblows.users. /home/talentho/public_html/scripts/indexmemberdisplay.php on line 10 usually means that the query didn’t work.

Thanks for the input Richei

The user info is the same for the database i think. The database name on phpmyadmin appears as talentho_project so I have inserted this into my connect_to_mysql.php file. The username and password are correct as the page loads.

My connect_to_mysql.php page

[php]<?php

$db_host = 'localhost';  

$db_username = '*********'; //'your username for mysql; 
$db_password = '*********'; //'Your password for MYsql'; 

$db_name = 'talentho_project'; //'Your database name' 

//Run the connection here

@mysql_connect("$db_host", "$db_username","$db_password")or die("could not connect to mysql");
@mysql_select_db("$db_name")or die("no database (somethings gon wrong mate!)");

?>[/php]

This error i get Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/talentho/public_html/scripts/indexcommentingdisplay.php on line 16 is beacause of this line of code.

[php]while($row = mysql_fetch_array($sql_mem_data)){
[/php]

I did not see your SQL statement but you have the use mysql_query(yoursqlstatement) and generally set that to a variable before you fetch the array. mine usually look something like this.

[php]$sql = "
SELECT * FROM table";

$result = mysql_query($sql) or die(mysql_error());

while ($row = mysql_fetch_array($result)) {
echo $row[‘tablerow’]."
";
}
[/php]

Hi Andrew, thanks for the input

When I try to echo row i get the response: Query was empty.

[php]$sql = mysql_query(“SELECT id FROM myMembers WHERE email_activated=‘1’ ORDER BY RAND()”);

$result = mysql_query($sql) or die(mysql_error());

while ($row = mysql_fetch_array($result)) {
echo $row[‘id’]."
";
}[/php]

This says to me that somehow its not picking up the database. I’m really confused as everything was working code wise before the switch over. I thought by just changing the username and password to match those kept on my new server would be all i had to do. Very confused and frustrated.

Sponsor our Newsletter | Privacy Policy | Terms of Service