473,666 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help me fix this, echo statment

117 New Member
Ok, i am making a mail system so i can mail users, and i have the table all set up no errors as of yet.

But my question is how do i make an else statment 2 times.
So if there is mail it will show it, if no mail "No messages found"
and if there not logged in the { else } stament..

[PHP]<? if (logincheck($ui d, $upwd)) {
echo ("<p align=\"left\"> <br /><font color=\"#666666 \" size=\"1\" face=\"Arial\"> <a href=\"{$_SERVE R['PHP_SELF']}\">Check Mail</a></font>&nbsp;<fon t color=\"#666666 \" size=\"1\" face=\"Arial\"> |</font>&nbsp;<fon t color=\"#666666 \" size=\"1\" face=\"Arial\"> <a href=\"newmessa ge.php\">Send Message</a></font>
<hr size=\"1\" />");

$message_sql = "SELECT `title, message, date` FROM `usermail` WHERE `userid` = '".(int)$uid."' ";

$message_result = mysql_query($me ssage_sql ,$db);
$message_data = mysql_fetch_ass oc($message_res ult);

echo ("<table width=\"100%\" border=\"0\" cellspacing=\"0 \" cellpadding=\"0 \">
<tr><td><font color=\"#000000 \" size=\"1\"><b>< font color=\"#FF0000 \"> ".$message_ data["title"]." </font></b>");
echo ("<td><font color=\"#000000 \" size=\"1\"><b>< font color=\"#FF0000 \">" .$message_data["message"]." </font></b></td>");

echo ("</font></b><br /></td>
<td><font color=\"#000000 \" size=\"1\"><b>< font color=\"#FF0000 \"> ".$message_ data["date"]." </font></b></td></tr></table><br />");


echo ("<hr size=\"1\" />");
} else {
echo ("<p align=\"center\ "><br /><b>Error:</b> <font color=\"#FF0000 \">Guests Not Allowed!</font><br /><br />
Please login befor checking your mail<br />
<font face=\"Arial\" size=\"1\">---------------------------------------------------</font>
<br />
<a href=\"login.ph p\">Login</a>&nbsp;&nbsp;& nbsp;&nbsp;or&n bsp;&nbsp;&nbsp ;&nbsp;<a href=\"newuser. php\">Register</a><br />
<font face=\"Arial\" size=\"1\">----------------------------------------------------</font></p>");
}
?>[/PHP]
Sep 8 '07 #1
2 1298
Atli
5,058 Recognized Expert Expert
Hi. What do you mean?

The way I understand your question, you are asking from something like this?
Expand|Select|Wrap|Line Numbers
  1. if(/*User is logged in*/) {
  2.   if(/* User has mail */) {
  3.     # Show user's mail
  4.   }
  5.   else {
  6.     # Show 'You got no mail'
  7.   }
  8. }
  9. else {
  10.  # Ask user to log in
  11. }
  12.  
Sep 9 '07 #2
kovik
1,044 Recognized Expert Top Contributor
But my question is how do i make an else statment 2 times.
You don't. An else statement means ANYTHING else. It accounts for all outcomes that haven't be handled by the if and else-if statements that it is connected to. I think you need to use "else if" statements.

i.e.
[php]if ($value == 0) {
echo 'No objects.';
} else if ($value == 1) {
echo 'An object.';
} else if ($value > 1) {
echo 'Multiple objects.';
} else {
echo 'Error.';
}[/php]
Sep 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2458
by: fartsniff | last post by:
Hello all. Can someone help out ? I found this PHP code that works just fine, however, I am trying to put it back into its original Javascript form. I am still learning the syntax, etc. for Javascript, so I'm not really sure what needs to be removed and kept. I was trying the basic search/replaces, but always ended up with Javascript errors.
3
3263
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old scripts working on a new server with the most recent version of PHP. I've pretty much taken care of all the various errors that were popping up. Most only pointed out out non-fatal undefined or assumed variables. I've been able to cure most of...
0
1317
by: Kyle | last post by:
<?php echo "a href=\"index.php?alp=a\">A</a> ] " ."- " ."- "; if (isset($_GET)) { // Now what must i make the sql statment so that it will display all the names that starts with a $_GET ( a ) //
6
2047
by: NotGiven | last post by:
session_start(); if (isset($HTTP_SESSION_VARS))&&($HTTP_SESSION_VARS != '') echo "hello"; It doesn't throw an error it just doesn't display anything However, this works: session_start(); if (isset($HTTP_SESSION_VARS))
4
2869
by: michaaal | last post by:
I have two folders in my website... Folder1 (this is where my #include file is, this is where the style.css is) --Folder2 (Folder2 is inside of Folder1) Folder2 contains a file that has this #include statement... <!--#include file="../include.inc"-->
2
1958
by: Andrew | last post by:
I have a windows 2000 sv, with exchange 2000 running with IIS as well. I am tring to send an email with an attachment with CDO. Set cdoConfig = CreateObject("CDO.Configuration") with cdoConfig.Fields .Item(sch & "sendusing") = 2 ' cdoSendUsingPort .Item(sch & "smtpserver") = "spiternet.com" .update End With
1
1766
Chrisjc
by: Chrisjc | last post by:
I am currently working on a form I need a few things from this form. First of all here is the link to what I have so far... ( http://www.triplesource.net/php/Decal%20Offer.html ) And posted below is the code for ( submit.php ) Now the first part of the form is just a HTML page with an action pointing to ( SUBMIT.php ) Now a problem I am having is one the e-mailing... the whole form to me... but also befor that I think I should say I have * as...
5
3211
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used at conventions. I have a main form with two subforms. On the main form, there is a text box that displays the sum of total orders entered in the subform, . I'm trying to create another text box on the main form, that looks at the subtotal...
1
1125
by: orfiyus | last post by:
Hi Im working with php and an oracle database. Anyway I am having a user input into a text field. The input is then stored into a variable and used in a query to the database. I am currently testing this program and I am trying to see the exact result of the query by just echoing the result using var_dump. So the problem is I cant get the actual result of the query out on the screen. For example I type in "59" into the input field...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.