Jump to content


  • Posts

  • Joined

  • Last visited


Posts posted by PatPHP

  1. Cool;-) I found a solution;-)


    Just add a hidden field to the form and assign value to it before you send it;-)


    <form name="frm" method="post">
       <input type='hidden' name='participations'/>
    <button onclick="tlist2.update(); send();">Send</button>
    <script language="JavaScript">
        function send() {
    	window.document.frm.participations.value = $F('multiselectlist-demo');
    	window.document.frm.action = "get.php"

  2. Hi Guys


    I'm not very experienced with Javascript. But I found a pretty cool AJAX Script which allows text auto completion like you have seen in fb or google search. It's called Proto!MultiSelect. Now this script works perfect but the example page also only displays the values in a message box. How can I send this information via Post to a php webpage instead?


    Here test webpage:



    If I press the Get Values button I want to send this values to a php page instead of showing it in a message box.


    Here the code if it helps:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>Proto!MultiSelect Demo</title>
        <link rel="stylesheet" href="test.css" type="text/css" media="screen" title="Test Stylesheet" charset="utf-8" />
        <script src="protoculous-effects-shrinkvars.js" type="text/javascript" charset="utf-8"></script>
        <script src="textboxlist.js" type="text/javascript" charset="utf-8"></script>
        <script src="test.js" type="text/javascript" charset="utf-8"></script>
      <body id="test">    
        <h1>Proto!MultiSelect Demo</h1>
        <p><a href="http://www.interiders.com/2008/02/18/protomultiselect-02/">See article page</a>, <a href="http://www.interiders.com/wp-content/demos/ProtoMultiSelect/test.html">Go to Proto!MultiSelect demo</a></p>
        <div id="text"></div>
        <form action="test_submit" method="get" accept-charset="utf-8">
            <li class="input-text">
              <label>Simple input</label>
              <input type="text" name="testinput" value="" id="testinput" />
            <li id="facebook-list" class="input-text">
              <label>FacebookList input</label>
              <input type="text" value="" id="facebook-demo" />
              <div id="facebook-auto">
                <div class="default">Type the name of an argentine writer you like</div> 
                <ul class="feed">
                  <li value="1">Jorge Luis Borges</li>
                  <li value="2">Julio Cortazar</li>
              <!-- These two writers will be added when the control is loaded -->
        <div id="button_container">       
            <button onclick="tlist2.update(); alert($F('facebook-demo'));return false;">Get Values</button>
        <script language="JavaScript">
            document.observe('dom:loaded', function() {
              // init
              tlist2 = new FacebookList('facebook-demo', 'facebook-auto',{fetchFile:'fetched.php'});
              // fetch and feed
              new Ajax.Request('json.php', {
                onSuccess: function(transport) {

  3. At the moment I run all the statements separate and do the comparing in php. Works great so far but I'm sure it would not be the best solution. I just don't know enough about mysql yet. Anyway I try to explain in more detail what I try to achieve here and I hope I still will get a better solution.


    A member has a certain awards and if he want's to attend a training he needs to meet this awards. Here a simplified example:


    To be able to sign up for the training you need to have this awards:





    User has:





    So the user would not be able to sign up because all his awards don't meet the training requirements. So my question is how can I make this comparison? If you look at my sql statement above it would work if this way would exist in mysql. I just want the mysql give a string in return when the user is able to sign up.


    I know it's a little bit complicated to explain over the web.

  4. @Crayon Violent

    That is interesting what you say. But it actually does give live output. I have a loop and in that loop an echo. It will give me the output on my browser. But it will just show me the output after 30-50 seconds regularly. I haven't figured it out yet why this is the case.

  5. Hi


    I'm developing on a program where many URLS will saved into mysql. Now my question is what is the best data type to use for that purpose so that it is still fast to access and requires not too much space? So varchar(2000) or text? Which one is faster and which one uses less space? Which collation is good for URLs? I won't do any search in them. I will just access them via id number.


    Thanks for your help.

  6. I have two select statements and I want to give back the record if awardsequal = tptotal. How can I do that?

    The first sql which I wrote here doesn't work. It is just an example how I would like to have everything together. I hope you can understand.


    SELECT * 
    FROM training t
    JOIN member m ON m.id =  '480'
    WHERE t.id =  '30'
    AND ( EXISTS (@awardsequal= @tptotal)))
    SELECT COUNT(*) AS awardsequal
    FROM member_award ma
    JOIN training_prerequisite tp
    ON ma.awardid = tp.AwardID 
    WHERE ma.memberid = 480 AND tp.trainingid = 31 AND tp.GroupNum=0
    SELECT COUNT(*) AS tptotal 
    FROM training_prerequisite tp 
    WHERE tp.trainingid = 31 AND tp.GroupNum=0

  7. I tried for hours but could not find any solution in sql. Hopefully this example will help to explain.


    So what is the SQL Statement to find out if Member 'Pat' meets all the reguirements for 'Training 1'?


    Here an easier example of the DB:

    ID Name
    1  HTML
    2  VB
    3  PHP
    4  Java
    5  C#
    6  CSS
    ID Name
    1  Pat
    2  Sandra
    3  Rolf
    4  Justin
    MemberID  SkillID
    1         1 
    1         2
    1         3
    1         4
    ID Name
    1  Training 1
    2  Training 3
    3  Training 4
    TrainingID SkillID
    1            1
    1            2
    1            3
    1            5

  8. Hi


    I have a strange problem which I don't understand. Defined returns false even I know the constant is defined. I can run an echo constantname and it returns the value I assigned. But if I run defined(constantname) it returns false???? It works as soon as I place the constant into the same file. What's the problem?


    Here example:


    define(MEDIA_HEIGHT, 120);





    if (defined(MEDIA_HEIGHT)) {

      echo 'true';

      echo MEDIA_HEIGHT;

    } else {

      // runs this part even the constant is defined

      echo 'false';

      echo MEDIA_HEIGHT;        // so how can it still return 120 if the constant is not defined???


  9. Hi Guys


    I programmed a small project which worked great on my test machine windows. Then I copied everything to a linux box and now I get an error if a query doesn't return anything and I run mysql_affected_rows afterwards. I thought if it doesn't return anything it mysql_affected_rows should be zero. Is this a setting in php???? Or what is the way around that?




  10. Hi Guys


    Thx lampstax


    Actually the code seems to run now if I write in the where condition:

    (jus.Accepted!=1 OR jus.Accepted IS NULL)


    What I wrote before was jus.Accepted=NULL which was wrong syntax.


    SELECT Count(*) AS Amount, cat.Category
    FROM tboffence AS ofc 
    LEFT JOIN tblcategory AS cat ON ofc.CategoryID = cat.ID 
    LEFT JOIN tblmisdemeanourtype mis ON ofc.MisdemeanourTypeID=mis.ID 
    LEFT JOIN tbjustification jus ON jus.OffenceID=ofc.ID
    WHERE ofc.StudentID=222 AND ofc.OffenceDate >= '2008-06-02' 
    AND ofc.OffenceDate <= '2008-08-29' AND (jus.Accepted!=1 OR jus.Accepted IS Null) 
    GROUP BY cat.Category;

  11. Hi


    First of all thank you very much, I didn't know that you can put it into the

    JOIN condition. But anyway if I put it into the Join condition the condition

    'jus.Accepted!=1' seems to be ignored. I get the same result as I remove it.

    Probably because it is left join and it still returns the record for the table

    tboffence which is counted. Hmm not easy that one...


    Do you have another idea?

  12. Hi Guys


    SELECT Count(*) AS Amount, cat.Category
    FROM tboffence AS ofc 
    LEFT JOIN tblcategory AS cat ON ofc.CategoryID = cat.ID 
    LEFT JOIN tblmisdemeanourtype mis ON ofc.MisdemeanourTypeID=mis.ID 
    LEFT JOIN tbjustification jus ON jus.OffenceID=ofc.ID
    WHERE ofc.StudentID=222 AND ofc.OffenceDate >= '2008-06-02' 
    AND ofc.OffenceDate <= '2008-08-29' AND jus.Accepted!=1 
    GROUP BY cat.Category;


    If I run the query without the "AND jus.Accepted!=1" it works great and

    gives me back all the offences grouped by category how I expected. But

    as soon as I run the query with that condition it breaks. It just works when

    there is a link between tbjustification and tbstudentpc. So how can I also

    get the rows when there is no justification created???


    I tried following condition as well but didn't work:

    (jus.Accepted!=1 OR jus.Accepted=NULL)





  13. Hi Guys


    I have to fields in the db startdate and endate. Now I want to add a new record

    but make sure the startdate and endate are not overlapping. I probabley need to

    do a select command first. How can I establish that? Is it possible with sql?



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