Jump to content

If weirdness


rawky1976

Recommended Posts

Hello all

 

Im struggling with a blank page that is solved by commenting out a while loop within an if statement.

 

The first line is a conditional that checks if a hidden field is TRUE. If the page is 'first load' it should be false and drop straight down to display a form. If the form has been submitted it should handle.

 

Bit strange that it's blank. Did some testing and if I comment out a while loop that's nested in the if...handle bit it diplays OK.

 

Can you see what it is from this or do you need more code/info?

 

(There are some single comment lines in there too but you can see which 'while block' i mean.

 

<?php

			error_reporting(E_ALL);
			ini_set('display_errors', '1');	
			if (isset($_POST['submitted'])) {
				include ('./includes/config.php');
        			include ('./includes/opendb.php');
				$ec = $_POST['ec'];
				//$query = "SELECT CONCAT(client_lname, ', ',client_fname) AS name FROM clients ASC WHERE client_lname='$ec'";
				$query = "SELECT CONCAT(client_lname, ', ',client_fname) AS name FROM clients WHERE client_lname='$ec'";
				$result = @mysql_query ($query);
					if ($result) {
						echo '<table style="width: 80%" cellpadding="5px" border="0">
						<tr>
						<td align="left">Users Name</td>
						</tr>';
							/*while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
								//echo '<tr><td align="left">' . $row['name'] . '</td></tr>';
								//$id = $row["name"];
								echo "<tr><td align=\"left\"><a href=\"editSearcheduser.php?userid=$row\"> . $row['name'] . </a></td></tr>";
							}*/

						echo '</table>';
						mysql_free_result ($result);
						//include ('./includes/addclientfooter.html');
						//exit();
						//echo 'Or select another surname below: -';
					} else {
						echo '<p>Sorry, no users match your search.</p>';
					}
			mysql_close();
			}

			?>

 

Thank you all, Mark

Link to comment
https://forums.phpfreaks.com/topic/68275-if-weirdness/
Share on other sites

Archived

This topic is now archived and is 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.