Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing value from php to mysql and back to javascript
    primarykey
    data
    text
    <p>I'm working on google maps, and Im trying to categorize my markers by color. The category table has [id,categoryname,color], and the markers table has [id,....,category (id of category's table category)].</p> <p>In PHP:</p> <pre><code> $result = mysql_query("SELECT * FROM `markers`"); //Multiple rows are returned while ($row = mysql_fetch_array($result, MYSQL_NUM)) { if ( $x == 0 ) { $separator = ""; } else { $separator = "****"; } //Saving to the String, each variable is separated by three &amp;'s $encodedString = $encodedString.$separator. "&lt;b&gt;&lt;div class='name'&gt;&lt;/b&gt;".$row[3]. "&lt;/div&gt;&lt;div class='opli'&gt;&lt;b&gt;Lon:&lt;/b&gt; ".$row[2]. "&lt;/div&gt;&lt;div class='opli'&gt;&lt;b&gt;Lat:&lt;/b&gt;".$row[1]. "&lt;/div&gt;&lt;div class='opli'&gt;&lt;b&gt;Address:&lt;/b&gt;".$row[4]. "&lt;/div&gt;&lt;div class='opli'&gt;&lt;b&gt;Category:&lt;/b&gt;".$row[5]. "&lt;/div&gt;&lt;/div&gt;&amp;&amp;&amp;".$row[1]."&amp;&amp;&amp;".$row[2]."&amp;&amp;&amp;".$row[6]."&amp;&amp;&amp;".$row[5]; $x = $x + 1; $colorgetterq= mysql_query("SELECT color FROM `map`.`category` WHERE id= ".$row[5].""); $colorgettert = mysql_fetch_row($colorgetterq); $colorgetter= $colorgettert[0]; } </code></pre> <p>in Java: colorget = document.getElementById("colorget").value;</p> <pre><code> stringArray = encodedString.split("****"); var x; for (x = 0; x &lt; stringArray.length; x = x + 1) { var addressDetails = []; var scale1 = []; var marker; //Separate each field addressDetails = stringArray[x].split("&amp;&amp;&amp;"); //Load the lat, long data var lat = new google.maps.LatLng(addressDetails[1], addressDetails[2]); //Create a new marker and info window marker = new google.maps.Marker({ map: map, position: lat, icon: { strokeWeight: 0.01, fillColor: colorget, fillOpacity: 0.85, path: google.maps.SymbolPath.CIRCLE, scale: 5 + addressDetails[3] * (35-5)/(hiscale-loscale), }, content: addressDetails[0] }); </code></pre> <p>I dont know what I'm doing is wrong but in the fillColor, for some reason the colors are still black, and wont load the different category colors.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload