Jump to content

Query not working on iPad?


rocky48

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 PHP code:

<?php
include("RelHol_connect.php");
doDB();

//verify the Event exists
$verify_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 Events.Event_Date = 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>";
	echo $display_block;
}else {
//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 Events.Event_Date = 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>";

}
?>

Is the iPad treating the data diferently than the PC?

 

I have cleared history on the iPad just incase it was caching the page.

 

I'm puzzled!

Link to comment
Share on other sites

Hi trq

 

The code is running on my ISP server.  I have developed a version that can be viewed on an iPad screen.  The index file in my case is index.php for the pc version and index1.php for the iPad version.  There is a php code at the beginning of the PC version that redirects to the index1.php if an iPad is detected.

 

The code above is within the html code on the home page.

 

It's really wierd that the code that works on the PC does not work on the iPad!

 

Any ideas are welcome.

Link to comment
Share on other sites

Don't understand what you mean?

PHP is SERVER based and the code is run at the server end and the output is parsed to the local machine.

 

Other PHP based scripts work on the iPad, it's just this one won't work and I can't see why.

 

Does this make it any clearer?

Link to comment
Share on other sites

because you have provided zero information about what it does or doesn't do, you haven't gotten any specific response. the statement "does not work" is meaningless because we are not standing right next to you and don't know what you saw that leads you to that conclusion.

 

there's a dozen different things that could go wrong in any php code that would cause it to not work. you need to clearly communicate what did happen in order to narrow down the possibilities.

 

p.s. you are still running the same query twice. that is wasteful. just run it once, test if it returned any rows, then simply loop over those rows.

Edited by mac_gyver
Link to comment
Share on other sites

Other PHP based scripts work on the iPad

Your issue has NOTHING AT ALL to do with the iPad.

 

It also has nothing at all to do with MySQL. I would suggest you post your actual question with a decent description of your issues in the appropriate board.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.