PHP-Multiple if?

by =?iso-8859-4?B?TGF1cmkgVuRpbg==?= <optima(at)hot.ee>

 Date:  Sun, 9 Jul 2000 13:23:13 +0300
 To:  <hwg-languages(at)hwg.org>
  todo: View Thread, Original
Hello listers,
I'm quite new to PHP and PHP is the first programming language I'm
trying to learn. I'm the type of learner, who takes the code and the
manual and looks at both until understands, how it's done and then tries
to write some code himself. Unfortunately PHP is server side and I can't
get my hands on any code. Duering the first learning days I came across
a problem(at least it is one for me). Can I use the "if" statement twice
(look below)? I tried to search for it on the web, read through all the
manuals I could get my hands on but couldn't come up with anything.

<?php
if(strstr($HTTP_USER_AGENT,"MSIE")) {
    echo "<center><b>You are using Internet Explorer.
</b></center><br>";
}
if(strstr($HTTP_USER_AGENT,"Mozilla")) {
    echo "<center><b>You are using Netscape or a Mozilla compatible
browser. </b></center><br>";
}
else {
echo "<center><b>You aren't using Internet Explorer nor a Mozilla
comatible browser</b></center><br>";
}
?>

Well, actually I want to display a image for 'normal' browsers with this
code and a text based version to every other browser(not quite sure
whether I'll be using it in real life, but I want to know how it 'could'
be done, so I could stretch my knowledge in the future to correct a
similar problem). Can the 'if' statements be combined and a text
outputted "echo "You are using IE or a Mozilla compatible browser""

Now a MySQL related question. How can I create a PHP and combined MySQL
script which would add (append) the agent name of the browser to a
database along with the time it accessed the page(the user name would be
'nobody' and the host 'localhost')? Can the first visit
of the page create the database automatically?

Thanks in advance


Best wishes,
Lauri V�in
--
Lauri V�in
Your own .com .net .org domain name is the best
advertisement on the net. Click below to see if
your domain name is still available and register it!
http://www.virtualis.com/vr/lvin/domain_search.html

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA