Re: Help with php redirect.
| From: | Chris Carter | Date: | Sun, 10 Dec 2006 16:26:52 +0000 |
| Subject: | Re: Help with php redirect. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42813@lists.php.net to get a copy of this message | ||
this works ... but the table headings are getting displayed with the sorry
message.
Chris Carter wrote:
>
> I need to put an else condition in the below code. So that if a data is
> not found after the search is executed by the user, he/she is redirected
> to a sorry page. Don't know how to do it, please advice.
>
> Please note that this code is working absolutly fine, its just that I
> tried various combination of ifelse conditions but could not sort it out.
>
> The code:
>
> </tr>
> </thead>
>
> <tbody>
>
>
> <?php
>
> // database information
> $host = 'localhost';
> $user = 'xxxx';
> $password = 'xxxx';
> $dbName = 'xxxx';
> $hello = $_REQUEST['hello'];
>
> mysql_connect(localhost,$user,$password);
> @mysql_select_db($dbName ) or die( "Sorry But There Seems To Be A Problem
> Connecting To The Database");
>
> $query="SELECT * FROM xxxx WHERE hello = '$hello'";
> $result=mysql_query($query);
>
> $num=mysql_numrows($result);
>
> mysql_close();
>
> $i=0;
> while ($i < $num) {
>
> $showThis=mysql_result($result,$i,"showThis");
>
>
> echo "
> <tr>
> <td>$showThis</td>
>
> </tr>";
>
> $i++;
> }
> ?>
>
> </tbody></table></div>
>
> So, if the showThis is not achieved or if the user puts it wrong data ...
> he should be redirected to an error page or should get an error message on
> the same result page, instead of the blank table.
>
> How to achieve this, please advice.
>
> Thanks in advance
>
--
View this message in context: http://www.nabble.com/Help-with-php-redirect.-tf2789498.html#a7783269
Sent from the Php - Database mailing list archive at Nabble.com.