This will be a complex post and question which will contain Second Life LSL (scripting language) and a PHP DB Query which is on the server with the MYSQL data base. I will try to present it in a short logical manner and I am not asking for code or solutions. I just want possibilities and initial thoughts about processes. While it is a bit involved it might be interesting to some. Ok My ultimate goal is to upload x y co-ordinates to the java in the api to plot aircraft in Second life on the web.
First question is could I use a JDBC DB Query in place of the PHP? Next question can I insert variables into the java in the api from the data base or even dynamic LSL uploads?
Here is a google map on one web page showing the waypoints. I am using a SL google map api to show Second Life maps on the web.
http://www.sliditerod.com/waypoints.html
A portion of the java code used in the map api:
function loadmap() { mapInstance = new SLMap(document.getElementById('map-container')); mapInstance.centerAndZoomAtSLCoord(new XYPoint(1145, 1055), 6); // plots one waypoint using the x y cords var marker2_image = new Img("images/mapways.gif", 400, 50); var marker2_icon = new Icon(marker2_image); var marker2_images = [marker2_icon, marker2_icon,]; var marker2a = new Marker(marker2_images, new XYPoint(1139, 1106)); mapInstance.addMarker(marker2a);
Second phase:
Using LSL inworld a prim (primitive) puts up a dialog which gives user choice and selection of a waypoint the passes the name to another prim. This prim uses this code (partial)for a llHttpResponse to the PHP on the server.
string rurl = "http://www.sliditerod.com/track.php";//get waypoint x y z link_message(integer sender_num, integer num, string choice, key id) { god = ((string)choice); llSay(0, "god" + ((string)god)); state scal; } } state scal { state_entry() { llSay(0, "name is" + ((string)god)); string xyz = "name=" + god; way_name = ((string)god); query = llHTTPRequest(rurl, [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"] , xyz); } ///////// GETS XYZ ///// http_response(key qid, integer status, list meta, string url) { if ( qid == query ) { if ( status != 200 ){ llSay(0, "Server Error"); } else { //get waypoint x y z list info = llParseString2List(url,[" "],[" "]); map_x = llList2Float(info,0); map_y = llList2Float(info,1); map_z = llList2Float(info,2); wregion = llList2String(info,3)
The PHP
<?php $name = $_POST["name"]; $url = $_POST["surl"]; include 'slidconnect.php'; // Get a specific result from the "example" table $result = mysql_query("SELECT * FROM xyz WHERE pname='$name'") or die(mysql_error()); // get the first (and hopefully only) entry from the result $row = mysql_fetch_array( $result ); // Print out the contents of each row into a table echo $row ['x'] . " " . $row['y'] . " " . $row['z'] . " " . $row[regions]; msqli_close($dbc); ?>