Jump to content

timphp

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by timphp

  1. Thanks sergei. That's fine, I can call a javascript function, which can in turn call a php function (something like below). My question is then, how do i make the php loader() function work? Ie make the page update the values taken from the sql server based on an input?

     

    //This bit outputs all the graphics. Only the first immage calls the php updater function. $whichpic defines the flag for the person, which is passed to the updater function.
    </p>
        <p class="bodytext"><a href="" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="updater(2); ?>"><img src="../Tutors/Photos/tim2.gif" name="Image15" width="100" height="100" border="0" id="Image15" /></a><a href="max.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','../Tutors/Photos/max1.gif',1)"><img src="../Tutors/Photos/max2.gif" alt="max" name="Image16" width="100" height="100" border="0" id="Image16" /></a><a href="nico.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image17','','../Tutors/Photos/nico1.gif',1)"><img src="../Tutors/Photos/nico2.gif" alt="nico" name="Image17" width="100" height="100" border="0" id="Image17" /></a><a href="sasha.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image18','','../Tutors/Photos/sasha1.gif',1)"><img src="../Tutors/Photos/sasha2.gif" alt="sasha" name="Image18" width="100" height="100" border="0" id="Image18" /></a>
    </p>
    
    
    // The updater function to call, which changes the information displayed
    <script language = "Javascript">
    
    function loader()
    {
    
    //a call to make the php updater function run, which just updates the text to be output
    }
    </script>
    
    //whats missing now is eaxctly what the php updater() function should say?
    
    

  2. Getting a bit desperate as I've tried a lot of things, so any help very appreicated!

     

    The concept im struggling with works like this:

    1.) There are graphics of people on a page. There is a textbox to the right of the screen which outputs data that corresponds to the tutor.

    2.) What i want is that when a user rolls his mouse over the picture, the data in the textbox immediately updates, which is done via php

    3.) The issue is thus calling a php function within onmouseover="" from a javascript command.

    4.) The function only changes the values that should be displayed (but doesnt work anyway) - is there a way to test whether a php function is being called correctly? And do i need to include some kind of page refresher?

     

    Thanks a lot for your help

     

    ******************************************

     

    The code as I have it currently is this.

     

    ...

     

    // Default setting to display a random persons data at page startup
    <?
    
    
    $username="removedforprivacy";
    $password="removedforprivacy";
    $database="tutors";
    
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $query="SELECT * FROM tutors";
    $result=mysql_query($query);
    
    $num=mysql_numrows($result);
    
    mysql_close();
    
    
    $i=rand(0,5);
    
    
    $id=mysql_result($result,$i,"id");
    $name=mysql_result($result,$i,"name");
    $degree=mysql_result($result,$i,"degree");
    $ib=mysql_result($result,$i,"ib");
    $subjects=mysql_result($result,$i,"subjects");
    $experience=mysql_result($result,$i,"experience");
    $style=mysql_result($result,$i,"style");
    $pic=mysql_result($result,$i,"pic");
    
    
    ?>
    
    
    
    //This bit outputs all the graphics. Only the first immage calls the php updater function. $whichpic defines the flag for the person, which is passed to the updater function.
    </p>
        <p class="bodytext"><a href="" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="<? php updater($whichpic=1); ?>"><img src="../Tutors/Photos/tim2.gif" name="Image15" width="100" height="100" border="0" id="Image15" /></a><a href="max.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','../Tutors/Photos/max1.gif',1)"><img src="../Tutors/Photos/max2.gif" alt="max" name="Image16" width="100" height="100" border="0" id="Image16" /></a><a href="nico.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image17','','../Tutors/Photos/nico1.gif',1)"><img src="../Tutors/Photos/nico2.gif" alt="nico" name="Image17" width="100" height="100" border="0" id="Image17" /></a><a href="sasha.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image18','','../Tutors/Photos/sasha1.gif',1)"><img src="../Tutors/Photos/sasha2.gif" alt="sasha" name="Image18" width="100" height="100" border="0" id="Image18" /></a>
    </p>
    
    
    
    
    //Where the php data is output
    <p class="sideheader">FEATURED TUTOR</p>
    <p><img src="<? echo " $pic"; ?>" width="200" height="200"></p>
        <p><strong>Name: </strong> <? echo "$name"; ?></p>
        <p><strong>Degree: </strong> <? echo "$degree"; ?></p>
        <p><strong>IB: </strong> <? echo "$ib"; ?></p>
        <p><strong>Subjects Taught: </strong> <? echo "$subjects"; ?></p>
        <p><strong>Teaching Experience: </strong> <br /> <? echo "$experience"; ?>
         </p>
        <p><strong>Teaching Style:<br /> </strong><? echo "$style"; ?>
    .</strong>    </p>
    <p><!-- end .sidebar2 --></p>
    </div>
    
    
    
    
    
    // The updater function to call, which changes the information displayed
    <?
    php
    
    function updater($whichpic)
    {
    
    $i = $whichpic;
    
    $id=mysql_result($result,$i,"id");
    $name=mysql_result($result,$i,"name");
    $degree=mysql_result($result,$i,"degree");
    $ib=mysql_result($result,$i,"ib");
    $subjects=mysql_result($result,$i,"subjects");
    $experience=mysql_result($result,$i,"experience");
    $style=mysql_result($result,$i,"style");
    $pic=mysql_result($result,$i,"pic");
    }
    ?>
    

     

     

×
×
  • 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.