Jump to content

DanielStead

Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DanielStead's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a script that basicallydraws around each township on a map and makes each township linkable in total i have about 498 townships and a total of 44,337 co ordiantes. the script is below and basicallys has 2 loops one to make the sections of the area map linkable and one to actually draw the round the townships. the reason for this is that we have four processes to run on each township so we will fill the township with a different colour depending on what processes have been run on the township. Here is the code [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?php session_start(); require_once("include/check_login.php"); require_once("include/database.php"); require_once("include/functions.php"); ?> <html> <head> <title>Cheshire County Council (v0.1) (v0.1)</title> <script type="text/javascript" src="js/wz_jsgraphics.js"></script> <link href="css/cheshire.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- .style1 {color: #0000CC} --> </style> <body> <?php echo " <div class=\"mapcontainer\" style=\"width:1500px\" style=\"height:1069px\">\n"; echo " <img src=\"images/CheshireMap_Final_Rect.jpg\" border=\"0\" usemap=\"ParishMap\" id=\"anotherCanvas\">\n"; echo " <map name=\"ParishMap\">\n"; $sql = "SELECT Distinct Parish, Township FROM CheshirePolygons2"; $result = mysql_query($sql) or die("Unable to select from Polygons1"); while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { $Parish = $row["Parish"]; $Township = $row["Township"]; $sql2 = "SELECT Parish, Township, x, y FROM CheshirePolygons2 WHERE Parish = '{$Parish}' AND Township = '{$Township}' ORDER BY OrderId"; $result2 = mysql_query($sql2) or die("Unable to select from Polygons2"); $i = 0; unset ($coordinate); unset ($coordinate2x); unset ($coordinate2y); while ($row2 = mysql_fetch_array($result2, MYSQL_BOTH)) { $coordinate[$i] = (((($row2['x'] - 312822) / 10) / 7.118) + 4) . ',' . (1069 - (((($row2['y'] - 334713) / 10) / 7.116) - 2)); $coordinate2x[$i] = (((($row2['x'] - 312822) / 10) / 7.118) + 4); $coordinate2y[$i] = (1069 - (((($row2['y'] - 334713) / 10) / 7.116) - 2)); $name = $row2["Township"]; $parish = $row2["Parish"]; $i++; } echo "<script type=\"text/javascript\">\n"; echo "<!--\n"; echo " function myDrawFunction()\n"; echo " {\n"; echo " jg_doc.setColor(\"blue\");\n"; echo " jg_doc.drawPolyline(new Array(" . WriteCoordinatesX($coordinate2x) . "), new Array(" . WriteCoordinatesY($coordinate2y) . "));\n"; echo " jg_doc.paint();\n"; echo " }\n"; echo " var jg_doc = new jsGraphics();\n"; echo " var jg = new jsGraphics(\"anotherCanvas\");\n"; echo " myDrawFunction();\n"; echo " </script>\n"; echo " <area HREF=\"view.php?hotspot=$name\" ALT=\"$parish\" TITLE=\"$name\" SHAPE=\"poly\" onmouseover=\"myDrawFunction($name,$parish)\" COORDS=\"" . WriteCoordinates($coordinate) . "\">\n"; mysql_free_result($result2); } mysql_free_result($result); echo " </map>"; function WriteCoordinates($coordinates) { $return = ""; for($i = 0; $i < sizeof($coordinates); $i++) { $return .= $coordinates[$i]; if($i != (sizeof($coordinates) - 1)) { $return .= ","; } } return $return; } function WriteCoordinatesX($coordinate2x) { $return = ""; for($i = 0; $i < sizeof($coordinate2x); $i++) { $return .= $coordinate2x[$i] + 5; if($i != (sizeof($coordinate2x) - 1)) { $return .= ","; } } return $return; } function WriteCoordinatesY($coordinate2y) { $return = ""; for($i = 0; $i < sizeof($coordinate2y); $i++) { $return .= $coordinate2y[$i] + 6; if($i != (sizeof($coordinate2y) - 1)) { $return .= ","; } } return $return; } echo " <div>\n"; ?> </body> </html> <?php unset($_SESSION['error_msg']); ?> [/quote]
  2. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$sql_1 = "INSERT INTO SourceDocument (MapRef,Township,Parish,Dimensions,DateOfMap,Surveyor) VALUES('$_SESSION['MapRef']','$_SESSION['Township']','$_SESSION['Parish']' ,'$_SESSION['SizeCM']','$_POST['DateofMap']','$_POST['Surveyor']')"; sorry its probably something really easy but this query works fine [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] $sql_1 = "INSERT INTO SourceDocument (MapRef,Township,Parish,Dimensions,DateOfMap,Surveyor)"; so there seems to be something worng with my quieries but i cant spot it.
  3. $query = "INSERT INTO document VALUES (0,'{$_POST['PGB_ID2']}','{$_POST['pages']}',{$doctype},{$department},'{$DocDate}', now(), {$owner}, '{$_POST['Secure']}', '{$_POST['PGB_ID1']}')"; @mysql_query($query) or die(arse); instead of saying arse i want it to print out the actually error message anyone know how to do this?
  4. This query works fine SELECT ParcelID, x, y FROM Polygons WHERE Parish = 'Stadhampton' AND ParcelID = 91 AND x BETWEEN 460500 AND 461000 but this query selects multipule ParcelID's when i only want the ones for 91. It seems to be the OR that causes the query not to function as how i thought it would. SELECT ParcelID, x, y FROM Polygons WHERE Parish = 'Stadhampton' AND ParcelID = 91 AND x BETWEEN 460500 AND 461000 OR y BETWEEN 199000 AND 199500 In english i want the query to select PareclID, x and y if parish = stadhampton and ParcelId = 91 and (if (x is between 460500 and 461000) OR (y is between 199000 AND 199500) Can anyone help me with this?
  5. hi can anyone suggest a link or a method to how i would do this? I want to do an sql statement that selects say for example the column pages and adds up all the pages in the column for example id pages 1 2 2 4 3 8 4 10 The total number of pages should then be 24 (2+4+8+10) anyone got any ideas seems simple but cant find anywhere that tells me how to do it
  6. Here is the sql statement SELECT ParcelID, x, y FROM Polygons WHERE Parish = '{Stadhampton}' AND ParcelID = 91 AND x BETWEEN 460000 AND 460500 AND y BETWEEN 199000 AND 199500; Not really too sure bout the between statements as the query worked fine why i didnt use between anyone any ideas as i have never used between before
×
×
  • 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.