You are here: PHP SELECT Case and Passing Variable problem. « All PHP « IT news, forums, messages
PHP SELECT Case and Passing Variable problem.

Posted by cgkh.webservices on 12/08/07 09:57

Ok! I am going nuts!

I am migrating a client's website from one domain to another with the
same hosting provider.

On the old site I had a car hire page which offered data in 4
languages using a very basic php/mysql SELECT CASE syntax.

It can be seen here:

Default English version:

http://www.solpraiaferias.com/fred/index_template.php

Portuguese Version:

http://www.solpraiaferias.com/fred/index_template.php?option=pt

This works fine!

However, I am now trying to migrate the site to http:// www.paraisolpraia.com
with the same hosting company.

Default English version:

http://www.paraisolpraia.com/carhirealgarve/index_template.php

This works fine.

HOWEVER, and here is the rub:

When submitting the url for the Portuguese Version:

http://www.paraisolpraia.com/carhirealgarve/index_template.php?option=pt

The server ONLY serves up the Default English text. I have checked the
MYSQL database tables on both sites and they are both the same.

It appears that the variable '?option=pt' is not being passed on the
new site. The same happens with the other languages and I know the
data is in the MYSQL table.

I admit that I am not a very experienced programmer but have had the
old site working for 18 months without problems.

The relevant PHP code is here:

"

<?php

// Connects to your Database
require_once("../psp_lig.php");

$_POST['option'];

switch ($option) {

// default car hire page

case "":

$lang="en";
$data = "SELECT * FROM LUZCAR WHERE fora = 'active' LIMIT 0, 30";
$title = "SELECT * FROM CAR_HIRE_TITLES WHERE lang = '$lang' ";
$result = mysql_query($data);
$result_2 = mysql_query($title);
$info_2 = mysql_fetch_array( $result_2 );
Print "<tr>";
Print "<td valign=\"top\">";
Print "</td>";
Print "<td colspan=\"4\" align=\"center\">";
Print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=
\"95%\">";
Print "<tbody>";
Print "<tr height=\"5\">";
Print "<td colspan=\"2\" valign=\"middle\"><hr width=\"250\" size=\"2\
align=\"center\" NOSHADE></td>";
Print "</tr>";
Print "<tr>";
Print "<td colspan=\"1\" valign=\"middle\"><p class=\"luzcargreettxt
\">".$info_2[ 'pg_greet' ] . "</p><p class=\"luzcargreettxt\">".
$info_2[ 'oferta' ] . "</p></td>";
Print "<td align=\"center\"><img alt=\"\" src=\"images/luzcar_logo.jpg
\" width=\"100\" height=\"84\"></td>";
Print "</tr>";
Print "<tr height=\"5\">";
Print "<td colspan=\"2\" valign=\"middle\"><hr width=\"250\" size=\"2\
align=\"center\" NOSHADE></td>";
Print "</tr>";
while($info = mysql_fetch_array( $result ))
{
Print "<tr>";
Print "<td style=\"background:#e6e6e6\" align=\"center\"><div class=
\"luzcargrouphd\">".$info_2['group_title'] . " ".$info['group'] . "</
div></td>";
Print "<td rowspan=\"2\"><div class=\"textbodyluzcar\"><img src=
\"images/".$info['lz_car_img']."\" hspace=\"2\" vspace=\"2\"></div></
td>";
Print "</tr>";
Print "<tr>";
Print "<td align=\"center\"><div class=\"luzcarmodeltxt\">".
$info['model_en'] . "</div></td>";
Print "</tr>";
Print "<tr>";
Print "<td valign=\"top\" align=\"center\">";
Print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=
\"100%\">";
Print "<tbody>";
Print "<tr>";
Print "<td style=\"background:#e6e6e6\" colspan=\"2\" align=\"center
\"><div class=\"luzcarpricehd\">".$info_2['price_title'] . " </div></
td>";
Print "<tr>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info_2['low_season_price_title'] . " </div></td>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info['low_season'] . "</div></td>";
Print "<tr>";
Print "<td style=\"background:#e6e6e6\" align=\"center\"><div class=
\"textbodyluzcar\">".$info_2['mid_season_price_title'] . " </div></
td>";
Print "<td style=\"background:#e6e6e6\" align=\"center\"><div class=
\"textbodyluzcar\">".$info['mid_season'] . "</div></td>";
Print "<tr>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info_2['high_season_price_title'] . " </div></td>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info['high_season'] . "</div></td>";
Print "</tr>";
Print "</tbody>";
Print "</table>";
Print "</td>";
Print "<td align=\"center\"><a class=\"luzcargrouphd\" href=\"form.php?
opt_form=en\" >Click to book</a></td>";
Print "</tr>";
Print "<tr height=\"20\">";
Print "<td colspan=\"2\" valign=\"middle\"><hr size=\"2\ align=\"center
\" NOSHADE width=\"200\"></td>";
Print "</tr>";

}

Print "</tbody>";
Print "</table>";
Print "</td>";
Print "<td valign=\"top\">";
include("lang_menu_carros.php");
Print "</td>";
Print "</tr>";


break;

case "pt":

$lang="pt";
$data = "SELECT * FROM LUZCAR WHERE fora = 'active' LIMIT 0, 30";
$title = "SELECT * FROM CAR_HIRE_TITLES WHERE lang = '$lang' ";
$result = mysql_query($data);
$result_2 = mysql_query($title);
$info_2 = mysql_fetch_array( $result_2 );
Print "<tr>";
Print "<td valign=\"top\">";
Print "</td>";
Print "<td colspan=\"4\" align=\"center\">";
Print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=
\"95%\">";
Print "<tbody>";
Print "<tr height=\"5\">";
Print "<td colspan=\"2\" valign=\"middle\"><hr width=\"250\" size=\"2\
align=\"center\" NOSHADE></td>";
Print "</tr>";
Print "<tr>";
Print "<td colspan=\"1\" valign=\"middle\"><p class=\"luzcargreettxt
\">".$info_2[ 'pg_greet' ] . "</p><p class=\"luzcargreettxt\">".
$info_2[ 'oferta' ] . "</p></td>";
Print "<td align=\"center\"><img alt=\"\" src=\"images/luzcar_logo.jpg
\" width=\"100\" height=\"84\"></td>";
Print "</tr>";
Print "<tr height=\"5\">";
Print "<td colspan=\"2\" valign=\"middle\"><hr width=\"250\" size=\"2\
align=\"center\" NOSHADE></td>";
Print "</tr>";
while($info = mysql_fetch_array( $result ))
{
Print "<tr>";
Print "<td style=\"background:#e6e6e6\" align=\"center\"><div class=
\"luzcargrouphd\">".$info_2['group_title'] . " ".$info['group'] . "</
div></td>";
Print "<td rowspan=\"2\"><div class=\"textbodyluzcar\"><img src=
\"images/".$info['lz_car_img']."\" hspace=\"2\" vspace=\"2\"></div></
td>";
Print "</tr>";
Print "<tr>";
Print "<td align=\"center\"><div class=\"luzcarmodeltxt\">".
$info['model_en'] . "</div></td>";
Print "</tr>";
Print "<tr>";
Print "<td valign=\"top\" align=\"center\">";
Print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=
\"100%\">";
Print "<tbody>";
Print "<tr>";
Print "<td style=\"background:#e6e6e6\" colspan=\"2\" align=\"center
\"><div class=\"luzcarpricehd\">".$info_2['price_title'] . " </div></
td>";
Print "<tr>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info_2['low_season_price_title'] . " </div></td>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info['low_season'] . "</div></td>";
Print "<tr>";
Print "<td style=\"background:#e6e6e6\" align=\"center\"><div class=
\"textbodyluzcar\">".$info_2['mid_season_price_title'] . " </div></
td>";
Print "<td style=\"background:#e6e6e6\" align=\"center\"><div class=
\"textbodyluzcar\">".$info['mid_season'] . "</div></td>";
Print "<tr>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info_2['high_season_price_title'] . " </div></td>";
Print "<td align=\"center\"><div class=\"textbodyluzcar\">".
$info['high_season'] . "</div></td>";
Print "</tr>";
Print "</tbody>";
Print "</table>";
Print "</td>";
Print "<td align=\"center\"><a class=\"luzcargrouphd\" href=\"form.php?
opt_form=en\" >Click to book</a></td>";
Print "</tr>";
Print "<tr height=\"20\">";
Print "<td colspan=\"2\" valign=\"middle\"><hr size=\"2\ align=\"center
\" NOSHADE width=\"200\"></td>";
Print "</tr>";

}

Print "</tbody>";
Print "</table>";
Print "</td>";
Print "<td valign=\"top\">";
include("lang_menu_carros.php");
Print "</td>";


break;

}

?>
"

I have tried with a close database statement as well to no avail.

I have also cleared my cache and tried accessing the page on different
browsers and machine. No result.

I would really appreciate any advice that anyone could give.

Many Thanks

Chris

 

Navigation:

[Reply to this 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

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