|
Posted by Dave on 08/15/07 09:59
Hi guys,
I have just set up a duplicate server running:
apache 2.54, mysql 5.04 and php 5.04
This is the same setup as as the server we are using now, apart from
the hardware inside. I have copied across the database and website,
with exact same permissions as the first server.
The problem is that part of the php code is executing but others
arent:
example:
------------------------
<?php
// Make the connection
mysql_connect("localhost", "dailyuser", "hidupituindah") or
die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("sales") or die(mysql_error());
echo "Connected to Database<br />";
$query = mysql_query("SELECT product_name FROM `code_tbl` WHERE `code`
='P191")
or die(mysql_error());
$result = mysql_fetch_array($query);
echo "The name of the product is " .$result['product_name']. " ";
?>
-----------------
This will work with no problems
But when i change it to:
-----------------
<?php
// Make the connection
mysql_connect("localhost", "user", "pass") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("sales") or die(mysql_error());
echo "Connected to Database<br />";
$query = mysql_query("SELECT product_name FROM `code_tbl` WHERE `code`
='$code")
or die(mysql_error());
$result = mysql_fetch_array($query);
echo "The name of the product is " .$result['product_name']. " ";
?>
-----------------
and select the page with /test.php?code=P191
It connects to the database, but the result is empty, leaving the
line:
The name of the product is
I am completely lost with this!!
Not sure if its apache, php or sql... i am assuming this is php,
although i know one shouldnt assume anything.
Any help would be much appreciated, before i have no hair left to pull
Dave.
[Back to original message]
|