Hi,

Okay let me explain what I want to do.

Now I have a variety of queries to do to the database
and echo's to echo out and how to output on the PHP
page.  But I am not sure how to get my code (below)
sucessfully to work in the example in the previous
email.  (found lower)  Could someone point me in the
right direction please?  I need the echo's shown in
the queries to be outputed on the page as it says. 
But I need only that part of the page to be refreshed
once every 5 seconds and not the enitre page to
reload.. Just the data from the database.

Here is my code:

<?

require('header.php');

// delete user if user=admin and action=deleteuser

        if ($username == $adminloginname AND $action
== "deleteuser")

        {

                $sql = "DELETE from user WHERE
naam='$delname'";

                mysql_query($sql, $conn);

                //also delete his/her messages

                $sql = "DELETE from message WHERE
sender = '$delname' OR recipient = '$delname'";

                mysql_query($sql, $conn);

        }



//get all users

                $sql = "SELECT naam, lastlogin FROM
user where naam <> '$username'";

                $result=mysql_query($sql, $conn);

// toon lijst met users

                while ($myrow =
mysql_fetch_array($result))

                {

                // show name of friend

                        echo "<a
href=send.php?recipientname=" .
htmlentities(urlencode($myrow[naam])) . "><font
color=\"$linkcolor\">$myrow[naam]</font></a>";

                // count all mesages for this user

                        $sql = "SELECT count(*) as
aantal FROM message where recipient =
'$username' AND sender = '$myrow[naam]'";

                       
$messageresult=mysql_query($sql, $conn);

                // toon aantal messsages per vriend

                        $myrow2 =
mysql_fetch_array($messageresult);

                        if ($myrow2[aantal] <> 0)

                        {

                // kijk of er nog nieuwe messages zijn

                                $sql = "SELECT isread
FROM message where recipient =
'$username' AND sender = '$myrow[naam]' AND isread=0";

                               
$readmessageresult=mysql_query($sql, $conn);

                                $myrow3 =
mysql_fetch_array($readmessageresult);

                                echo " <a
href=\"messages.php?sender=" .
htmlentities(urlencode($myrow[naam])) . "\">";

                                if ($myrow3[isread] ==
null)

                                {

                                        echo "<font
color=\"$oldmessagecolor\">(".
$myrow2[aantal] . ")</font></a>";

                                }else{

                                        echo "<font
color=\"$newmessagecolor\">(".
$myrow2[aantal] . ")</font></a>";

                                }

                        }

                // show online/offline status

                        if ($timestamp -
totime($myrow[lastlogin]) > $isonlineseconds)

                        {

                                echo " <font
color=\"$offlinecolor\">$langisoffline</font>";

                        }else{

                                echo " <font
color=\"$onlinecolor\">$langisonline</font>";

                        }

                // give admin delete possibility

                        if ($adminloginname ==
$username)

                        {

                                echo " <a
href=\"index.php?action=deleteuser&delname=" .
htmlentities(urlencode($myrow[naam])) . "\"><font
color=\"$linkcolor\">x</font></a><br>";

                        }else{

                                echo "<br>";

                        }

                }


?>

Now maybe I need to do each query seperately to work
in the example below?  But how.. And remembering to
output the echo's and not what the database provides. 
As I need it to be formated as in the echo.  Unless I
remove the echo's and put the results as defined in
the example below.

> function DoOnLoad(){
>       ele=PSGetElementById(parent.frames[0],"text");
>       ele.innerHTML="<?=date("Y-m-d H:i:s");?>";
                       ^^^^^^^^^^^^^^^^^^^^^^^^^

With "myrow['whatever']"

I'm not sure, new to this stuff, but thought I'd post
my code, maybe someone could whack up a code that
functions.... The code of the refreshing part is below
with all pages relevant to it.

(please note i emailed the person that gave me the
code below and replied with my code but they have not
replied as of yet of how to get it to function so that
is why i posted on here also.)

Jerry

 --- Bronislav Klucka <[EMAIL PROTECTED]>
wrote: > ****index.php
> <html>        
>       <frameset rows="100%,*" border="0"
> frameborder="no">
>               <frame name="first" src="first.php" noresize>
>               <frame name="second" src="second.php" noresize>
>       </frameset>     
> </html>
> ****first.php
> <html>
> <body>
>       <div id="text"></div>
> </body>
> </html>
> ****second.php
> <html>
> <head>
>       <meta http-equiv="refresh"
> content="10;URL=second.php">
> <script>
> function PSBrowser(){
>       this.ns4 = (window.document.layers);
>       this.ie4 = (window.document.all &&
> !window.document.getElementById);
>       this.ie5 = (window.document.all &&
> window.document.getElementById);
>       this.ns6 = (!window.document.all &&
> window.document.getElementById);
>       this.op =
> window.navigator.appName.indexOf('Opera')!=-1;
> }
> 
> function PSGetElementById(frame,id){
>       var b=new PSBrowser();
>       var new_obj=null;
>       if(b["ns4"]){
>               new_obj=frame.document.layers[id];
>       } else if(b["ie4"]){
>               new_obj=frame.document.all[id];
>       } else if(b["ie5"] || b["ns6"]){
>               new_obj=frame.document.getElementById(id);
>       }       
>       return new_obj;
> }
> 
> function DoOnLoad(){
>       ele=PSGetElementById(parent.frames[0],"text");
>       ele.innerHTML="<?=date("Y-m-d H:i:s");?>";
> }
> </script>     
> </head>
> <body OnLoad="javascript:DoOnLoad();">
> 
> </body>       
> </html>
> 
> 
> is that clear?
> 
> > 
> > Hi,
> > 
> > I am not familiar with DHTML and how it can be
> used to
> > talk to PHP to update a certain part of a page. 
> That
> > is all I need, is one section of the page, not the
> > entire page, to be refreshed.  The part is just
> text
> > from a database.  However on the page I want
> > backgrounds, images etc but I don't want these to
> > refresh, just the text from the database.
> > 
> > What you have said below seems exactly what I
> want. 
> > But I have never used DHTML.  Could you show me a
> > example of both frames (just the source) of how
> one
> > talks to another please?
> > 
> > Jerry
> > 
> >  --- Bronislav Klucka
> <[EMAIL PROTECTED]>
> > wrote: > > I want to have a PHP website that feeds
> > > information
> > > > off a mysql database.  But generally changes
> > > occour
> > > > and instead of asking users to refresh the
> page to
> > > get
> > > > the updates is there a way to provide the
> updates
> > > > without them needing to refresh the page?
> > > >
> > > > E.G. For like shooping Carts, Chat rooms,
> etc...
> > > >
> > > > Is there a way in PHP or something to make
> updates
> > > > show up live as they happen instead of the
> yucky
> > > meta
> > > > refresh tag in HTML?
> > > >
> > > > Thanks for your time in advance.
> > > 
> > > I'm sorry, I always dissapoint you, but what
> ever
> > > you want to send to
> > > browser must be demend by the browser. I mean
> you
> > > can tell browser to reload
> > > part of the page, browser has to ask for it, you
> can
> > > send more information
> > > to the browser and then use DHTML to provide the
> > > showing, or hiding...
> > > 
> > > There is only one way how to do, what you want
> (but
> > > it always ask the
> > > server, only user will not see reloading). The
> way
> > > is to have 2 frames: 1st
> > > for showing the content and the second to
> refresh
> > > every 1 min. (or as you
> > > want), receive informations and using DHTML
> change
> > > the content of the first
> > > frame, the secomd frame could be at the bootom
> of
> > > the browser, 1pixel
> > > height, to be "invisible"
> > > 
> > > 
> > > 
> > > Brona
> > >  
> > 
> > http://personals.yahoo.com.au - Yahoo! Personals
> > New people, new possibilities. FREE for a limited
time. 

http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to