Jump to content

Ollifi

Members
  • Posts

    75
  • Joined

  • Last visited

    Never

Posts posted by Ollifi

  1. ok,thanks for helping

    I think i´ll not need mysql_real_escape_string

     

    but btw

    when I remove many rows from table and i have AUTO INCREMENT in ID field why the ID is not next to existing ones , it´s next to previous ones ? i think you may not understand

    but

    ids: 1,2,3,4,5

    then remove 4,5

    then create new and it gots id 6

    how can i make it to got id 4 ?

  2. ok thank you for help

    could you say whats wrong with this

    $query      = "UPDATE tolkit SET (lyhenne, nimi, kpl, ostopaikka, valmistaja, lisatty, paivitetty) VALUES ('".$lyhenne."', '".$nimi."', '".$kpl."', '".$ostopaikka."', '".$valmistaja."', '".$lisatty."', '".$paivitetty."') WHERE id='".$id."'";

  3. I have this code

     

    $id = $_GET['esitysid'];
    $esitysnimi = mysql_query("SELECT * FROM varasto WHERE id = '".$id."", $yhteys);
    print "esitysnimi $esitysnimi";
    $esitysnim = mysql_result($esitysnimi, "0", "nimi");

     

    varasto:

    nimi			hinta maara	id	lippuja
    Esitys Nimi 1	10	14		0	5
    Esitys Nimi 2	120	5		1	0
    Esitys Nimi 3	950	5		2	0

     

    and it says

     

    Warning: mysql_result() expects parameter 1 to be resource, boolean given

     

    How can I fix it? Thank you for help

     

     

  4. I want that size goes smaller between 10 (so 0-10 biggst, 10-20 smaller, 20-30 more smaller etc)

     

    However you could use a lookup table (ie, array with one value as the key with the other as the value) to switch between them

    How should I do this?

     

    Voting with a url like that seems like an invitation for someone to automate voting and make the votes meaningless.

    And,is there some other method to do this?

  5. Hi

     

    For the different sizes, using Webstyles code earlier you could use something like this:-

     

    <?php
    $file = file("suggested.txt");
    $votes = array();
    
    for($i=0;$i<count($file);$i++){
    $exp = explode("|", $file[$i]);
    $votecount = trim($exp[1]);
    $votes[$exp[0]] = $votecount;
    }
    
    arsort($votes, SORT_NUMERIC);
    $RecCnt = 0;
    foreach ($votes as $country=>$vote)
    {
    print <span class='CountryList".(($RecCnt <= 3) ? $RecCnt : '')."' >$country." ".$vote."</span><br>";
    $RecCnt++;
    }
    ?> 

     

    Then just have a few different styles to control it.

     

    You could also possibly do it by restyling an unordered list (with list-style:none) and then styling subsequent  sub elements. Probably CSS wise the most flexible but probably the most difficult to understand by anyone except those who really understand CSS.

     

    All the best

     

    Keith

    now I tried it,

    but it seems only change first 3 styles. But,I want it to be like this: http://coa.inducks.org/podium.php

  6.  

    @kickstart thank you for help!

     

    Could you comment also this one:

    and,if I want to save vote to file, I need url something like vote.php?id=COUNTRY-ID

    And COUNTRY-ID should be same than country is in the file. So it should not be same id in the table that has been ordered in number order. How could I get it?

  7. and,if I want to save vote to file, I need url something like vote.php?id=COUNTRY-ID

    And COUNTRY-ID should be same than country is in the file. So it should not be same id in the table that has been ordered in number order. How could I get it?

  8. and what method you would recommend to have country list doing like this:

     

    Sweden ,501 votes

    USA ,500 votes

    Finland ,50 votes

     

    So country with lot of votes would have bigger font size,and if small count of votes, it would have small font size.

  9. Hello,

     

    I have countries listed in a file like this:

    country name|votes
    country name|votes
    country name|votes

     

    And example:

    Finland|50
    USA|500
    Sweden|501
    

     

    How could I display them as a list:

    [*]Sweden ,501 votes

    [*]USA ,500 votes

    [*]Finland ,50 votes

     

    Currently I have this code:

    $file = file("suggested.txt");
    
    $votes = array();
    
    for($i=0;$i<count($file);$i++){
    $exp = explode("|", $file[$i]);
    $votecount = trim($exp[1]);
    $maa = $exp[0];
    $votes["$maa"] = $votecount;
    }
    
    sort($votes, SORT_NUMERIC);
    $votes = array_reverse($votes);
    
    for($i=0;$i<count($file);$i++){
    print"".$country_list[$i]." ".$votes[$i]."<br>";
    }

     

    country_list has all world countries in an array.

     

    thank you for helping!

     

     

    P.S. what it should do: It should display countries from largest number to smallest number (biggest number->first, smallest number->last)

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