Hi,

I developed a website with PHP version 5.1.4 and MySQL - 5.0.22. I tested the web on my localhost and it worked perfectly well. However, when I uploaded the website, I could not have access to all have to all the data inserted in my database. I could not understand the reason for this. However, after complaining to the hosting company, it was suggested that probably there is a difference in the php.ini of my localhost and that of the hosting company. The php.ini of the web hosting company is Debian, MySQL Version: 5.0.91, Perl Version: 5.8.8. Being a newbie in this, is it possible that the difference in this developmental portal and the hosting portal could lead to my inability to access of my data in the database of the hosting company?

Thanks.

Recommended Answers

All 4 Replies

I suggest you to create a simple file and try the connection and a query to your database, something like this:

<?php

# config parameters
$host = '';
$user = '';
$pass = '';
$db = '';
$table = '';

$conn = mysql_connect($host,$user,$pass);
if (!$conn)
{
        die('connection error: ' . mysql_error());
}

mysql_select_db($db, $conn) or die('database error: '.mysql_error());

$q = mysql_query("select * from $table") or die('query error: ' .mysql_error());
echo 'result: ' . mysql_num_rows($q);
?>

This is very basic, try if it works and if you're in doubt, post back any error you get.
P.S. remember to set the correct config parameters.

Thanks Cereal. I have done this in my localhost and it works well. I copied this same file to the hosting company, with some modifications, taking into cognizance their host. It was from here that I am having issues. I am open to further suggestions.

Ok, when you've tried this on your hosting did you got any errors? If yes, can you paste the output here? I suggested you this test just to check if the connection with the database of the hosting was working fine.

Otherwise post your code or at least a simplified version of it in which the problem is occurring. If I don't understand which kind of error you get I cannot help.

Member Avatar for iamthwee

What is the php version of your hosting company? You mentioned perl or was that a typo?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.