Jump to content

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

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.