PHP site problems
Posted: Sat Jun 07, 2008 8:40 am
Hi there,
I'm having a few problems with a site conversion.
I previously created an access database and connected it to an ASP site - all worked fine
I wanted to convert it to PHP so it could be used on an SQL-based website .....
I altered the PHP and have it working fine on my PC (IIS localhost), so the PHP itself i assume is correct
BUT
When i change the connection values (to have my db name pass etc) and upload the php files, i get either errors or only the HTML showing. The database has been converted to SQL without a problem and is residing on my server.
I inserted the following to hopefully glean some answers about why it won't work:
ini_set ("display_errors", "1");
error_reporting(E_ALL);
But it gives me no information. It just seems to skip the if and print the not available line.
Why would it not do the same as the offline localhost version.
I tried switching the two print statements round and that gives me an error with one of the mysql functions.
Code below without most of the html so i don't make the post any longer than necessary.
The site basically runs through a set of pages to reach a final picture destination and this is the first page (i.e. the gallery page allows the user to select the type of picture, this carries forward to the next page where they choose the style and so on).
Working local version:
----------------------------------------
-----------------------------------------------------------------------------------------
Not working online version:
Could be something simple or stupid, but i've been coding so much recently my eyes are going funny. Now if i had hair i'd be pulling it out, so i'm settling for a sense of humour failure, which is most unlike me.
Any assistance would be greatly appreciated.
I'm having a few problems with a site conversion.
I previously created an access database and connected it to an ASP site - all worked fine
I wanted to convert it to PHP so it could be used on an SQL-based website .....
I altered the PHP and have it working fine on my PC (IIS localhost), so the PHP itself i assume is correct
BUT
When i change the connection values (to have my db name pass etc) and upload the php files, i get either errors or only the HTML showing. The database has been converted to SQL without a problem and is residing on my server.
I inserted the following to hopefully glean some answers about why it won't work:
ini_set ("display_errors", "1");
error_reporting(E_ALL);
But it gives me no information. It just seems to skip the if and print the not available line.
Why would it not do the same as the offline localhost version.
I tried switching the two print statements round and that gives me an error with one of the mysql functions.
Code below without most of the html so i don't make the post any longer than necessary.
The site basically runs through a set of pages to reach a final picture destination and this is the first page (i.e. the gallery page allows the user to select the type of picture, this carries forward to the next page where they choose the style and so on).
Working local version:
----------------------------------------
Code: Select all
<?php
$CategoryID=$_GET["CategoryID"];
$CategoryName=$_GET["CategoryName"];
$ManufacturerID=$_GET["ManufacturerID"];
$ManufacturerName=$_GET["ManufacturerName"];
$ManufacturerCategoryID=$_GET["ManufacturerCategoryID"];
$conn=odbc_connect('Gallery','','');
$sql="SELECT Group.GroupID, Group.GroupName, Group.GroupImg FROM [Group] ORDER BY Group.GroupName";
$rs=odbc_exec($conn,$sql);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" cool gridx="8" gridy="8" showgridx showgridy usegridx usegridy><tr height="8"><td align="center"><img src="images/CGLLogoSmall.jpg"></td></tr></table>
<hr />
<br />
<table width="100%">
<tr><td align="center" class="subheading"><strong>Welcome to the Gallery</strong> </td></tr>
<tr><td> </td></tr>
<tr><td colspan="4" align="center"><strong>Please select your style from the options below: </strong></td></tr>
<tr><td colspan="4" align="center">
<table width="90%" border="0"><tr><td><table class="heading" width="500px" border="0">
<?php if (!($rs==0))
{
?>
<?php while(odbc_fetch_row($rs))
{
?>
<?php print "<tr><td align='left'><a href='Group.php?GroupID=".odbc_result($rs,"GroupID")."&Group=".odbc_result($rs,"GroupName")."' class='heading'>".odbc_result($rs,"GroupName")."</a></td><td><img src='' /></td></tr>";?>
<?php //$rs=odbc_fetch_array($rs_query);
?>
<?php }
}
else
{
print "<tr><td>Not Available</td></tr>";
}
odbc_close($conn);
?>Not working online version:
Code: Select all
<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
/*$CategoryID=$_GET["CategoryID"];
$CategoryName=$_GET["CategoryName"];
$ManufacturerID=$_GET["ManufacturerID"];
$ManufacturerName=$_GET["ManufacturerName"];
$ManufacturerCategoryID=$_GET["ManufacturerCategoryID"];
*/
echo "Microsoft.Jet.OLEDB.4.0";
$conn=mysql_connect("localhost","XXXX","XXXX");
mysql_select_db("XXXX",$conn);
$rs=mysql_query("SELECT Group.GroupID, Group.GroupName, Group.GroupImg FROM [Group] ORDER BY Group.GroupName");
$GroupID = ("GroupID");
$Group = ("GroupName");
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" cool gridx="8" gridy="8" showgridx showgridy usegridx usegridy><tr height="8"><td align="center"><img src="images/CGLLogoSmall.jpg"></td></tr></table>
<hr />
<br />
<table width="100%">
<tr><td align="center" class="subheading"><strong>Welcome to the Gallery</strong> </td></tr>
<tr><td> </td></tr>
<tr><td colspan="4" align="center"><strong>Please select your style from the options below: </strong></td></tr>
<tr><td colspan="4" align="center">
<table width="90%" border="0"><tr><td><table class="heading" width="500px" border="0">
<?php if (!($rs==0))
{
?>
<?php while(!($rs=0))
{
?>
<?php print "<tr><td align='left'><a href='Group.php?GroupID=".mysql_result($rs,"GroupID")."&Group=".mysql_result($rs,"GroupName")."' class='heading'>".mysql_result($rs,"GroupName")."</a></td><td><img src='' /></td></tr>";
?>
<?php //$rs=odbc_fetch_array($rs_query);
?>
<?php }
}
else
{
print "<tr><td>Not Available</td></tr>";
}
mysql_close($conn);
?>
Any assistance would be greatly appreciated.