hi guys,
I have just been giving the keys to the new dedicated server.
I have mysql and php5 installed and running ok.
I have also setup phpmyadmin on the server without any problems.
The problem is when i try to run any of my own scripts from flash the returned result is the intire code that is in the php script. If i change the http vars from $_POST to $_GET and then try to access the same script via the browser i get a blank page, no echo’s no print’s nada.
i am new to this setting up dedicated server and apps so i am thinking that i might have missed a setting unknown to me in the php ini file.
This is really confusing since phpmyadmin works fine and a test script to pull information from the database works.
test script is:
$link = mysql_connect('localhost', 'root', '*****')or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_db') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM users';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<table>
";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo " <tr>
";
foreach ($line as $col_value) {
echo " <td>$col_value</td>
";
}
echo " </tr>
";
}
echo "</table>
";
// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
my script:
include('common.php');
$link = dbConnect();
$query = "SELECT * FROM contact_list";
//
$result = mysql_query($query);
if(!$result) {
fail("Error reteiving contacts");
}
$rows = mysql_num_rows($result);
//
var $output="";
$output = "&conCount=$rows";
//
for ($count = 0; $count < $rows; $count++){
$contact = mysql_fetch_array($result);
$conID = $contact['id'];
$conName = $contact['name'];
$conEmail = $contact['email'];
//------------------------------------------------------//
$output .= "&contact" . $count . "conID=" . $conID;
$output .= "&contact" . $count . "conName=" . $conName;
$output .= "&contact" . $count . "conEmail=" . $conEmail;
}
//
print "&retval=1&".$output."&";
And in the common file i have
dbHost = "localhost";
$dbUser = "root";
$dbPass = "*****";
$dbName = "my_db";
function dbConnect() {
// Access global variables
global $dbHost;
global $dbUser;
global $dbPass;
global $dbName;
// Attempt to connect to database server
$link = mysql_connect($dbHost, $dbUser, $dbPass);
// If connection failed...
if (!$link) {
// Inform Flash of error and quit
fail("We are having problems with mySQL today. We are working to find a resolution as quickly as possible.
Sorry for the inconvenience caused");
}
// Attempt to select our database. If failed...
if (!mysql_select_db($dbName)) {
// Inform Flash of error and quit
fail("Couldn't find database $dbName");
}
return $link;
}
My scripts work fine on the developer server.
Thanks for any help.
Paul