Reply to strange problem with php

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация