Jump to content

SQL Query outputs a result on PC but not on iPad version?


rocky48
Go to solution Solved by Psycho,

Recommended Posts

I run a query that queries the database to see if there are any events happening today and if so outputs the lines into a table.  If there are no events it echos a message saying there are no events.

 

The query works on my PC, but the version that runs on the iPad does not work.

 

The php part of the web page is exactly the same, as I copied and pasted the whole PHP part of the code into the iPad version from the working version.  Here is the code:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
    <meta name="dcterms.created" content="Sat, 02 Mar 2013 20:21:23 GMT">
    <meta name="description" content="">
    <meta name="keywords" content="">
	<meta name="viewport" content="width=768px, minium-scale=1.0, maximum-scale=1.0" />
    <title></title>
    <link rel="stylesheet" href="stylesheets/ipad.css" />
    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>
  <body>
  <div id="fb-root"></div> <!end fb-root>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="wrap"> <!Start wrap>
   <div id="header"> <!Start header>
   		
		<img src="images/BattleAbbeygatehouse.jpg" width="100" height="100" alt="" title="" border="0" />
		<img src="images/1066Green.jpg" width="600" height="100" alt="" title="" border="0" />
   </div> <!end header>
   <div id="content"> <!Start content>
      <div id="main"> <!Start main>
	  <h1>WELCOME TO OUR SITE</h1>
             
		
		<p>We are passionate about card making and we would like to invite you to share your interests in card making with us.</br> 
		</br>
		On our Website we have many interesting items on our site that we think will be of interest to you.
		
		<ul TYPE=SQUARE>
		<li>Some links to suppliers websites</li>
		<li>Many articles on card making techniques</li>
		<li>A unique utility which allows you to print greetings verse for your cards</li>
		<li>Database of nearly 1000 verses</li>
		<li>The ability to type in your own verse</li>
		<li>Videos on card-making techniques in our Gallery</li>
		<li>Feedback facility to allow visitors to comment on our site</li>
		</ul>
		</p>
		</br>
		<p>We hope that you will enjoy our site and you will visit us again SOON!</p>
<br/>
<h3> TODAYS RELIGIOUS & HISTORICAL EVENTS
<br/>
	</h3>
<br/>
<div id= "php-code"> <! Start php-code>
<?php
include("RelHol_connect.php");
doDB();

//verify the Event exists
$verify_Event_sql = "SELECT Events.ID, Events.Event_Date, Events.Event_Description, Religion.ID, Religion.Religion
	FROM Events
	LEFT JOIN Religion
	ON Events.Faith_ID = Religion.ID
	WHERE DAY(Events.Event_Date)= Day(Now()) And MONTH(Events.Event_Date)=Month(Now()) And YEAR(Events.Event_Date)=YEAR(Now())
	ORDER BY Events.Event_Date ASC";
$verify_Event_res =  mysqli_query($mysqli, $verify_Event_sql) or die(mysqli_error($mysqli));

if (mysqli_num_rows($verify_Event_res) < 1) {
	//this Event does not exist
	$display_block = "<p><em>No Religious festivals or holidays today.</em></p>";
}

//gather the Events
	$get_Event_sql  = "SELECT Events.ID, Events.Event_Date, Events.Event_Description, Events.Faith_ID, Religion.ID, Religion.Religion
	FROM Events
	LEFT JOIN Religion
	ON Events.Faith_ID = Religion.ID
	WHERE DAY(Events.Event_Date)= Day(Now()) And MONTH(Events.Event_Date)=Month(Now()) And YEAR(Events.Event_Date)=YEAR(Now())
	ORDER BY Events.Event_Date ASC";
	$get_Event_res = mysqli_query($mysqli, $get_Event_sql) or die(mysqli_error($mysqli));
//create the display string
	$display_block .= "
<table width=\"100%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\" >
	<tr>
	<th>RELIGION</th>
	<th>EVENT</th>
	</tr>";	
	while ($Event_today = mysqli_fetch_array($get_Event_res)) {
		$Rel_Date = $Event_today['Event_Date'];
		$Rel_Event = $Event_today['Religion'];
		$Event_text = ($Event_today['Event_Description']);

//add to display
$display_block .= "
<tr>
<td width=\"8%\" valign=\"top\">".$Rel_Event."<br/></td>
<td width=\"25%\" valign=\"top\">" .$Event_text."<br/></td>";	
		
	}	

//free results
	mysqli_free_result($get_Event_res);

//close connection to MySQL
	mysqli_close($mysqli);
	
//close up the table
$display_block .="</table>";
?>
</div> <! php-code>
      </div>   <! No coresponding 'div' ??????>   		
		<br /><br /><br />
		<div class="fb-like" data-href="http://www.1066cards4u.co.uk" data-send="true" data-layout="box_count" data-width="300" data-show-faces="true" data-font="arial"></div> <! end fb-like
   </div> <!end main> 		
   
   
      <div id="side"> <!Start side>
         <div id="sidea"> <!Start sidea>
		 <h3>Main Menu</h3>
           <p><ul>
                <li><a href="index1.html">Home</a></li>
                <li><a href="iLinks.html">Links</a></li>
                <li><a href="iTechniques.html">Techniques</a></li>
				<li><a href="iVerse_Menu.html">Verse's</a></li>
                <li><a href="icontact.html">Contact Us</a></li>
				<li><a href="iNews.html">News</a></li>
				<li><a href="iAboutUs.html">About Us</a></li>
				<li><a href="iGallery.html">Gallery</a></li>
				<li><a href="iRegHol.html">Religious Holiday's</a></li>
            </ul></p>
</br>
		 </div> <!end sidea>
         <div id="sideb"> <!Start sideb>
		 <h2 style="text-decoration:blink; color: red">NEWS FLASH!</h2>
<!--<h4><font color="red">Just added! You can now type your own verses and print them!!</h4> -->
<!--<h4><font color="red">NEW LOOK website!</br>Smarter looking site, but unfortunately as the Forum has not been used since the launch we have decided to remove it.</br>However if you have any ideas or suggestions please use the Feedback Form on the contact us tab.</h4>-->
<h4><font color="blue">We have made many minor changes - so please see NEWS page for details (Bulletin #.</font> </h4>
<h4><font color="blue"> </br>For instructions on how to use the Verse Printing Utility! SEE NEW INSTRUCTION PDF file. ( Version 2.9 - 28th November 2012)</font> </h4>
<h4><font color="blue"></br>A form for adding verses has been added to the Contact Us page! </font> </h4>
		 </div> <!end sideb>
         <div id="sidec"> <!Start sidec>
		 
		 </div> <!end sidec>
      </div> <!end side>
   </div> <!end content>
   <div id="footer"> <!Start footer>
    <p>© 2012 Content:1066 Cards 4U. All rights reserved.   <br />
	With thanks to Matt Taylor - matthewjamestaylor.com</p>
		
   </div> <!end footer>
</div> <!end wrap>
  </body>
</html>

I thought it may be unequal Div tags so I have marked the start and end tags with comments and I found that there were unequal munber of tags, but when I removed the ofending tag it upset the layout of the screen.  The sides a & b disappeared and the footer was at the bottom of thr side bar.  The main content was in the right place, but again it does not print the output of the query.  The Facebook content is shown OK.

 

As an experiment I stripped the rest of the html content and div's and just left the php code plus some html to display the result and this output the query OK.

 

I am sure the problem is with the DIV's, but I can't see where.

 

Can anyone spot the error, cos I must be missing it?

Link to comment
Share on other sites

  • Solution

This would not be a PHP problem and should be in the HTML forum (Moving).

 

I do see that you don't appear to have a closing TR tag for the data rows. That could be the problem. Plus, you can run the page through an HTML validator to find errant/invalid tags.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.