Jump to content

dodgeitorelse3

Members
  • Posts

    254
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by dodgeitorelse3

  1. @Barand I marked your  reply as a solution. There were actually 2 solutions, the first was the SQL tutorials in your signature and the second was your post about 

    19 hours ago, Barand said:

    Better to use fetch assoc() to get arrays with just the column names as keys

    Thank you very much.

    This post also turned into a database normalization issue and I am still working on that.

  2. The query has Original_Name. I changed to fetch_assoc and now do not have the duplicate field values. Now I have to work on the normalization. Using design for database I currently have fails when I try to join all the tables. Thank you for that fix Barand. I tried to send sql files in message but I get the error too big. There are 1929 entries and file size of mapnames table is biggest weighing in at 600 kb. second biggest is 223 kb and the last five sql files are 100 kb or less.

     

  3. Is it possible to run a query to get data from multiple tables where they have only 1 common field name?

    Below are images of the field names for each table as well as the web and database server info.

    If possible which join would I use?

    I can get 2 tables to return data using

    SELECT id, size, Original_Name, resource, disabled, tickmark, image, type, creator, modder, beta, final, modded, classification, sf, tod, weather, es2
    			FROM
    				mapnames
    					INNER JOIN mapnames_tooltips USING (id)
    					ORDER BY id Asc"

    however this gives me double entries in array.

     

    Array
    (
        [0] => Array
            (
                [0] => 1
                [id] => 1
                [1] => 11441673
                [size] => 11441673
                [2] => Border.aao
                [Original_Name] => Border.aao
                [3] => 2_8_5_default, abr, blannick, chevy, crypt, ffat, kool, rapidfire, vanoke, spectrum
                [resource] => 2_8_5_default, abr, blannick, chevy, crypt, ffat, kool, rapidfire, vanoke, spectrum
                [4] => 0
                [disabled] => 0
                [5] => 1
                [tickmark] => 1
                [6] => ../../gsreaders/lgsl/lgsl_files/maps/aarmy/armygame/border.jpg
                [image] => ../../gsreaders/lgsl/lgsl_files/maps/aarmy/armygame/border.jpg
                [7] => PVP
                [type] => PVP
                [8] => Richard Starr
                [creator] => Richard Starr
                [9] => 
                [modder] => 
                [10] => N
                [beta] => N
                [11] => Y
                [final] => Y
                [12] => N
                [modded] => N
                [13] => LAND
                [classification] => LAND
                [14] => N
                [sf] => N
                [15] => DAY
                [tod] => DAY
                [16] => HAZY
                [weather] => HAZY
                [17] => N
                [es2] => N
                [18] => 0
                [slots] => 0
            )
    
        [1] => Array
            (
                [0] => 2
                [id] => 2

    This gives me double entries though.

    Any advice would be greatly appreciated.

     

    web server.png

    db server.png

    locale.png

    mapnames.png

    modifications.png

    objectives.png

    terrain.png

    tooltips.png

    vehicles.png

  4. 1 hour ago, jodunno said:

    client side versus server side should not be a foreign concept to you. So what do you do when i disable JavaScript in my web browser? or what do you do if i use fiddler to fiddle with the request? Imagine if your bank used Javascript to control access to a page. If i could use a shaking my head while holding it in my hands in a downward shamed posiion, then i would use such an emoji here and now.

    Thank you for your explanation and delicacy. I now have more knowledge. If i could use a nodding my head, while holding 2 thumbs up  in an upward proud position, then i would use such an emoji here and now. :)

    • Like 1
  5. 10 minutes ago, jodunno said:

    Please do not implement a script (client side technology) in place of server-side control. I hope that you are really not using such code on a live website. I hope that you understand why this is a bad suggestion. Thanks for trying to be helpful but this is really hurtful advice. I hope that you do not think that i am being rude. I'm just shocked that you would make such a suggestion.

    So maybe you can explain why? I am no professional by any means.

  6. In order to avoid folks opening a page that shouldn't be opened via url I use this.  I put it in the header on the page that should not be opened via url.

     

    <script type="text/javascript">
      if (top.location.href != "http://<?php echo $host_name; ?>/index.php")
         top.location.href = "../index.php";
    </script>

    perhaps you can modify it to work in conjunction with what you have for your switch.

  7. with your form inside the

    for($i=0; $i<=count($hasil); $i++){

    you are overwriting all your inputs, input names each time it runs so you will only see last item in $hasil.

     

    session_start();
    
    $hasil = array();
    
    echo '<form action="" method="post">';
    
    	for($i=0; $i<=count($hasil); $i++){
    		echo "<input type='text' name='nama[$i]' id='' placeholder='masukkan kegiatan anda'><br>";
    	}
        
       echo '<input type="submit" name="submit" value="masukkan">';
    
    echo '</form>';
    
    if(isset($_POST["submit"])){
        $_SESSION['nama'] = $_POST["nama"];
        $_SESSION["hasil"]= $_SESSION['nama'];
    
        foreach ($_SESSION["hasil"] as $value) {
           echo $value;
       }          
    
    }
     

     

  8. I have an array like this:

    Array
    (
        [0] => Array
            (
                [id] => 1
                [oname] => Border.aao
                [osize] => 11441673
            )
    
        [1] => Array
            (
                [id] => 2
                [oname] => Border.aao
                [osize] => 8194731
            )
    
        [2] => Array
            (
                [id] => 3
                [oname] => Border.aao
                [osize] => 8104714
            )
    
        [3] => Array
            (
                [id] => 4
                [oname] => BRM_Range.aao
                [osize] => 6848551
            )
    
        [4] => Array
            (
                [id] => 5
                [oname] => camp_mackall.aao
                [osize] => 17524696
            )
    
        [5] => Array
            (
                [id] => 6
                [oname] => Canyon.aao
                [osize] => 13310448
            )
    
        [6] => Array
            (
                [id] => 7
                [oname] => District.aao
                [osize] => 21848613
            )
    )

    I tried to get all keys that match a search value such as Border.aao

    $mykey = array_search("Border.aao", array_column($duplicate_mapname_array_snames, 'oname'));

    but this only gives me the first key. I want to get all the keys which should be 0,1 and 2

     

    How do I achieve this?

  9. this line has 2 id's in it. You can have only 1.

    echo "<br><div id='".$index."' class='mydiv'  style='float: right; background-color: white; background-color:rgba(255,255,255, 0.5); border: 1px solid grey; padding: 6px;' id='tree'>";
        

    and I believe you need quotes around the id in this line as well as a proper name for the id

    let thediv = document.getElementById(id)
            

     

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