ChaosKnight Posted January 8, 2009 Share Posted January 8, 2009 Hi guys, I hope you'll be able to help me, I don't know wheter this is an MySQL or PHP related question, so I'll post it on both just for incase... I'm new to PHP and MySQL and I'm loving it, but stumbled upon a rather upsetting problem... Once again I don't know if it's a syntax problem or just browser differences, I will appreciate some help seeing that my deadline is approaching really fast! My web application is for a tourism website with a lot of data, I'm only using MySQL to store the info and retrieve it... firstly I have the index page which doesn't have any errors that I currently know about, next is a page include via php, this still works in all browsers, the next one is where I get my headache from! It's also an php include which contains the code that retrieves all the MySQL info... Unfortunately my clients web host only supports PHP 5.1.6 and MySQL 3.23.51, and I have to respect their decision to sticking with that web host... Here's how I'm currently connecting to the database: (PLEASE NOTE: due to client's concern for privacy I left out page names and other data) __________________________________________________________ //Connect to database $db_link = mysql_connect($[host], $[user], $[password]); if ( ! $db_link ) die( "Couldn't connect to mySQL Server<br />"); //echo( "Connected to mySQL Server<br />"); //Select database $db_select = mysql_select_db($db); if ( ! $db_select ) die("Couldn't connect to Database<br />"); //echo("Connected to Database<br />"); __________________________________________________________ And seeing that the 3rd include doesn't work in IE, im also going to add the code I use for that: (PLEASE NOTE: due to client's concern for privacy I left out page names and other data) __________________________________________________________ <?php include("[page name].php"); ?> __________________________________________________________ isn't this code supposed to include in IE?? next is the code in the 3rd include where I select the database and table and retrieve the info... Afterwards please correct my problem If you come accross it! (PLEASE NOTE: due to client's concern for privacy I left out page names and other data) __________________________________________________________ $table = "[table name]"; //Run query $query3 = "SELECT * FROM $table WHERE `object` = '".$object."' AND `active` = 'yes'"; $result3 = mysql_query($query3, $db_link); __________________________________________________________ later in the code is the print() function that I use to display the data in a table-like form on the web page... If you can help me or know where I can get help, please post a message!! Thanks in advance, ChaosKnight Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 9, 2009 Author Share Posted January 9, 2009 One last thing... The fact that it doesn't work in Internet Explorer is where my headache is coming from! I don't know of any browser differences with PHP or MySQL, please correct me if I'm wrong... I want to finish this big mess as soon as possible! Thanks Quote Link to comment Share on other sites More sharing options...
gevans Posted January 9, 2009 Share Posted January 9, 2009 Unfortunately your code problem has nothing to do with browsers. Php is a server side script and browsers will not affect its working. Post some full code extracts and we can see if there's a problem in your PHP or MySQL. Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 9, 2009 Author Share Posted January 9, 2009 Hi gevans, thanks for your reply, here is some full code, I hope you'll be able to trace the problem, once again thanks a lot! _________________________________________ Index page <?php if (!isset($_GET['page'])){ $page = "country"; }else{ $page = $_GET['page']; } switch($page){ case "home": include ("home.php"); break; case "about": include ("about.php"); break; case "country": include ("country.php"); //Next page included break; case "accomodation": include ("accomodation.php"); break; case "rental": include ("rental.php"); break; case "maps": include ("maps.php"); break; case "bookings": include ("bookings.php"); break; case "contact": include ("contact.php"); break; case "thankyou": include ("thankyou.php"); break; default: include ("home.php"); break; }?> ___________________________________________ Country page <?php if ( IsSet($_GET['country'])) { $country = $_GET['country']; }else{ $country = southafrica; } $db_link = mysql_connect($db_host, $db_user, $db_pass); if ( ! $db_link ) die( "Couldn't connect to mySql Server<br />"); //echo( "Connected to mySql Server<br />"); //Select database $db_select = mysql_select_db($db); if ( ! $db_select ) die("Couldn't connect to Database<br />"); //echo("Connected to Database<br />"); ?> <table width="780" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/<? print ($country) ?>_main.gif" width="780" height="119" /></td> </tr> <tr> <td class="content_bg"><table width="780%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="250" valign="top"><table width="780" height="250" border="0" cellpadding="0" cellspacing="0"> <tr valign="top"> <td align="left"><?php include("countries.php"); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table> ____________________________________________ Countries page <table width="780" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="content_bg"><table width="780%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="250" valign="top"><table width="780" height="250" border="0" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="190" align="center"><table width="180" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/spacer.gif" width="8" height="8" /></td> </tr> <tr> <td><img src="maps/<? print($country) ?>.gif" width="180" height="190" /></td> </tr> <tr> <td align="center"> <? $table = "countries"; //Run query $query3 = "SELECT * FROM $table WHERE `country` = '".$country."' AND `active` = 'yes'"; $result3 = mysql_query($query3, $db_link); //Number of rows $num_rows3 = mysql_num_rows($result3); if ( $num_rows3 < 1 ) { print( "<span class=\"error_text\">NO RESULTS FOUND. Please try again...</span>" ); } else{ //Display Country Description while ($row = mysql_fetch_array($result3)) { //Column names $area = $row[area]; $capital = $row[capital]; $currency = $row[currency]; $languages = $row[languages]; $time = $row[time]; $dial = $row[dial]; $voltage = $row[voltage]; $car = $row[car]; print (" <table width=\"180\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"> <tr> <td class=\"body_bold\">Area:</td> </tr> <tr> <td class=\"body_text\">$area</td> </tr> <tr> <td class=\"body_bold\">Capital:</td> </tr> <tr> <td class=\"body_text\">$capital</td> </tr> <tr> <td class=\"body_bold\">Currency:</td> </tr> <tr> <td class=\"body_text\">$currency</td> </tr> <tr> <td class=\"body_bold\">Languages:</td> </tr> <tr> <td class=\"body_text\">$languages</td> </tr> <tr> <td class=\"body_bold\">Time:</td> </tr> <tr> <td class=\"body_text\">$time</td> </tr> <tr> <td class=\"body_bold\">Dialing Code:</td> </tr> <tr> <td class=\"body_text\">$dial</td> </tr> <tr> <td class=\"body_bold\">Voltage:</td> </tr> <tr> <td class=\"body_text\">$voltage</td> </tr> </table> "); } } ?> </td> </tr> <tr> <td align="center"><img src="images/spacer.gif" width="8" height="8" /></td> </tr> <tr> <td align="center"><table width="180" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="headings/game.gif" width="180" height="32" /></td> </tr> <tr> <td> <? //Display Game Parks //Set Table $table = "countries"; //Run query $query5 = "SELECT * FROM $table WHERE `country` = '".$country."' AND `active` = 'yes' "; $result5 = mysql_query($query5, $db_link); //Number of rows $num_rows5 = mysql_num_rows($result5); if ( $num_rows5 < 1 ) { print( "<span class=\"error_text\">NO RESULTS FOUND. Please try again...</span>" ); } else{ //Display Country Description while ($row = mysql_fetch_array($result5)) { //Column names $parks = $row[parks]; print (" <table width=\"180\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"> <tr> <td class=\"body_text\" align=\"left\">$parks</td> </tr> </table> "); } } ?></td> </tr> </table></td> </tr> <tr> <td align="center"><img src="images/spacer.gif" width="8" height="8" /></td> </tr> <tr> <td align="center"><table width="180" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="55" align="center" class="banner_border"><span class="advertise">ADVERTISE HERE</span><br> <span class="body_text">Call +27 82 688 2419 </span></td> </tr> <tr> <td><img src="images/spacer.gif" width="8" height="8" /></td> </tr> </table></td> </tr> </table></td> <td width="400" align="center"> <table width="370" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <? //Display Middle Country Content //Set Table $table = "countries"; //Run query $query = "SELECT * FROM $table WHERE `country` = '".$country."' AND `active` = 'yes' "; $result = mysql_query($query, $db_link); //Number of rows $num_rows = mysql_num_rows($result); //Number of records $num_rec = 1; $startnum = ( IsSet( $_GET["startnum"] ) ? $_GET["startnum"] : 0 ); //Run query - limit records on page $query2 = "SELECT * FROM $table WHERE `country` = '".$country."' LIMIT $startnum, $num_rec"; $result2 = mysql_query($query2, $db_link); //Number of rows $num_rows2 = mysql_num_rows($result2); if ( $num_rows2 < 1 ) { print( "<span class=\"error_text\">NO RESULTS FOUND. Please try again...</span>" ); } else{ //Display Country Description while ($row = mysql_fetch_array($result2)) { //Column names $country2 = $row[country]; $description = $row[description]; $provinces = $row[provinces]; $cities = $row[cities]; $area = $row[area]; $capital = $row[capital]; $currency = $row[currency]; $cultural = $row[cultural]; $parks = $row[parks]; $languages = $row[languages]; $time = $row[time]; $dial = $row[dial]; $voltage = $row[voltage]; $car = $row[car]; $active = $row[active]; print (" <table width=\"370\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td><img src=\"images/spacer.gif\" width=\"12\" height=\"12\" /></td> </tr> <tr> <td valign=\"top\"><img src=\"headings/$country2.gif\" width=\"300\" height=\"18\" /></td> </tr> <tr> <td><img src=\"images/spacer.gif\" width=\"7\" height=\"7\" /> </td> </tr> <tr> <td class=\"body_text\">$description</td> </tr> <tr> <td align=\"center\"><img src=\"images/spacer.gif\" width=\"8\" height=\"8\" /></td> </tr> <tr> <td><img src=\"headings/cities.gif\" width=\"295\" height=\"16\" /></td> </tr> <tr> <td class=\"body_text\">$cities</td> </tr> <tr> <td align=\"center\"><img src=\"images/spacer.gif\" width=\"8\" height=\"8\" /></td> </tr> <tr> <td align=\"center\"><img src=\"images/spacer.gif\" width=\"8\" height=\"8\" /></td> </tr> <tr> <td><img src=\"headings/interest.gif\" width=\"295\" height=\"16\" /></td> </tr> <tr> <td class=\"body_text\">$cultural</td> </tr> </table> "); } } ?></td> </tr> <tr> <td><img src="images/spacer.gif" width="8" height="8" /></td> </tr> <tr> <td height="55" align="center" class="banner_border">hts banner</td> </tr> <tr> <td align="center"><img src="images/spacer.gif" width="8" height="8" /></td> </tr> </table></td> <td width="190" align="center"><table width="180" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/spacer.gif" width="12" height="12" /></td> </tr> <tr> <td width="180" height="18" valign="bottom"><table width="180" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <? //Display Premium Accomodation //Set Table $table = "hotels"; //Run query $query4 = "SELECT * FROM $table WHERE `country` = '".$country."' AND `homepage` = 'yes' AND `active` = 'yes' ORDER BY `name` ASC "; $result4 = mysql_query($query4, $db_link); //Number of rows $num_rows4 = mysql_num_rows($result4); if ( $num_rows4 < 1 ) { print( " <table width=\"180\" height=\"55\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"banner_border\"> <tr> <td class=\"advertise\">ADVERTISE HERE<br><span class=\"body_text\">Premium Hotel Listing</span></td> </tr> </table> " ); } else{ //Display Country Description while ($row = mysql_fetch_array($result4)) { //Column names $logo = $row[logo]; $name = $row[name]; $logo_width = $row[logo_width]; $logo_height = $row[logo_height]; print (" <table width=\"180\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"> <tr> <td class=\"body_bold\"><img src=\"hotels/logos/$logo.gif\" width=\"$logo_width\" height=\"$logo_height\" /></td> </tr> <tr> <td class=\"body_text\"><a href=\"index.php?page=accomodation&country=$country&hotel=$name\">$name</a></td> </tr> </table> "); } } ?></td> </tr> <tr> <td><img src="images/spacer.gif" width="8" height="8" /></td> </tr> <tr> <td><img src="headings/accomodation.gif" width="180" height="16" /></td> </tr> <tr> <td> <? //Display Accomodation //Set Table $table = "hotels"; //Run query $query6 = "SELECT * FROM $table WHERE `country` = '".$country."' AND `active` = 'yes' ORDER BY `name` ASC "; $result6 = mysql_query($query6, $db_link); //Number of rows $num_rows6 = mysql_num_rows($result6); if ( $num_rows6 < 1 ) { print( "<span class=\"error_text\">NO RESULTS FOUND. Please try again...</span>" ); } else{ //Display Country Description while ($row = mysql_fetch_array($result6)) { //Column names $logo = $row[logo]; $name = $row[name]; print (" <table width=\"180\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"> <tr> <td class=\"body_text\"><a href=\"index.php?page=accomodation&country=$country&hotel=$name\">$name</a></td> </tr> </table> "); } } ?></td> </tr> </table></td> </tr> <tr> <td align="left" valign="top"></td> </tr> <tr> <td width="180" align="left" valign="middle"><img src="images/spacer.gif" width="8" height="8" /></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> </table> Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 9, 2009 Author Share Posted January 9, 2009 Please let me know if you need any additional info Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 10, 2009 Author Share Posted January 10, 2009 And why doesn't the mySQL results display in Internet Explorer but it does in all the other, like Opera, Firefox, Safari and Google Chrome? Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 10, 2009 Share Posted January 10, 2009 bad html maybe? for your last question, and your script is too long and not syntax highlighted and I don't feel like looking through it for like 10 hours, please shorten it and show errorous areas, not the whole thing.. and include it in [ code] tags Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 10, 2009 Author Share Posted January 10, 2009 Hi, I just finished debugging it once more, it's even valid with XHTML strict... It's only in Internet Explorer that this happens... Internet Explorer says that the error is a funcion that was expected on line 96 char 541, but all that's on line 96 is the following: <tr valign="top"> Any advice? Thanks Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 10, 2009 Share Posted January 10, 2009 can I have a link? also its a javascript error, try using try {} catch (e) { } around certain parts until the issue disappears.. then look inside that try {} and locate your error but if you send me over a link, I'm a very big IE enthusiest and I'd love to help you resolve your issue Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 10, 2009 Author Share Posted January 10, 2009 Sure, my prototype is uploaded at http://www.hotels-tours-safaris.com/new_site/index.php Can you perhaps also look at the javascript for me, I don't know why it doesn't work, I used javascript to create a roll over drop down link for the countries tab, it doesn't even display in IE or Google Chrome... Thanks a lot, I appreciate it Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 11, 2009 Author Share Posted January 11, 2009 I just realised that if I try opening my javascript online with Internet Explorer, it throughs out runtime errors... Can this be the reason my include page doesn't work in Internet Explorer? Thanks Quote Link to comment Share on other sites More sharing options...
redarrow Posted January 11, 2009 Share Posted January 11, 2009 do it in css http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 11, 2009 Author Share Posted January 11, 2009 I just tried the try catch statement individually on the scripts, with no luck, then even on all the javascripts together, still no luck... Any other prepositions? Thanks Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 11, 2009 Author Share Posted January 11, 2009 Isn't there a javascript validator like W3C's HTML validator to fix all javascript bugs?? Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 11, 2009 Share Posted January 11, 2009 not sure, I looked over your code and line 96 isn't anything to do with javascript.. the image preloader opensource you have will probably not affect IE, but sumfin I did look @ (didn't investigate) is the only other script tag you have, is the s_loader.js you have.. remove that and see if the error still happens Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 11, 2009 Author Share Posted January 11, 2009 Thanks for your reply... I also can't find an error in the script, When i directly go the the external javascripts that gets included in Opera, Google Chrome, Safari and Firefox it runs sucessfully, but when I go directly to them in IE, I get numerous runtime errors ??? Can this maybe be the problem? There are 3 external files according to IE's Developer Tools, when I try to access them through IE I get the following 3 error messages... Please help me with their meaning, seeing that I never before got these errors.. 1) 'document' is undefined 2) Object expected 3) 's_eS' is undefined (All of these are Microsoft JScript runtime errors) Please advise if any other info is needed... Oh and there's another error on line 56 char 180, Expected ')', There is a ) on line 56 ??? Thanks Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 11, 2009 Share Posted January 11, 2009 document shouldn't be undefined.. lol that is a biiig error Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 11, 2009 Author Share Posted January 11, 2009 How can I fix this error? This error is in the external js file called s_loader, but when I remove this file as you suggested I still get the error when going to the website Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 11, 2009 Author Share Posted January 11, 2009 Luckily s_loader doesn't have that much code in it, so it'll be possible to debug relatively fast Quote Link to comment Share on other sites More sharing options...
gevans Posted January 11, 2009 Share Posted January 11, 2009 If it's a problem with your javascript you may want to try the javascript forum not the php one, also we'd need to see the code before we can help you. Quote Link to comment Share on other sites More sharing options...
ChaosKnight Posted January 11, 2009 Author Share Posted January 11, 2009 Okay thanks, I'll post a new thread to the JavaScript forum Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.