Jump to content

jarv

Members
  • Content Count

    325
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jarv

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. Lat/Long was wrong way round! THANKS!
  2. Thanks, I'm getting there now, I used the second one: while( $rs_location = $rs_locations->fetch_row() ) { $markers[] = $rs_location; } My markers are now showing, GREAT! .... but in the middle of the Indian Ocean
  3. ok, I don't get it, sorry. I am just trying to follow the example using the php array they commented out here is where I currently am: $mysqli = mysqli_connect("localhost", "root", "", "plods"); $sql_locations = "SELECT CONCAT(address1, ', ', address2) as address, Longitude, Latitude FROM southdowns"; $rs_locations = mysqli_query($mysqli, $sql_locations); while( $rs_location = $rs_locations->fetch_assoc() ) { foreach( $rs_locations->fetch_assoc() as $rs_location => $value){ $markers[] = $value; } } //while( $rs_location = $rs_locations->fetch_assoc() ) { // $markers[] = $rs_location; //} echo "<pre>".print_r($markers)."</pre>"; and it comes out like this: Array ( [0] => Nyetimber, Broughton House, 6-8 Sackville Street [1] => -0.137792 [2] => 51.509285 [3] => Baker Tilly, The Portland Building, 25 High Street.....
  4. no no, if you look at the working example on that link when you call json_encode() in the javascript it should then look like this: array( 'Westminster Abbey, London', 51.4992453, -0.1272561 ), array( 'QEII Centre, London', 51.4997296, -0.128683 )
  5. convert it to JSON and plot markers on a map, like here: http://stackoverflow.com/questions/33652498/google-map-to-display-many-markers-dynamically-using-php-and-jquery
  6. it needs to be out put like this: array( 'Palace of Westminster, London', 51.499633, -0.124755 ), array( 'Westminster Abbey, London', 51.4992453, -0.1272561 ) but I am getting: Array ( [0] => Array ( [address] => Quintessence Fragrances Ltd, Unit 2A, Hawthorne Industrial Estate [Longitude] => 0.058305 [Latitude] => 50.798006 ) [1] => Array ( [address] => Nyetimber, Broughton House, 6-8 Sackville Street [Longitude] => -0.137792 [Latitude] => 51.509285 )
  7. Thanks, that worked but now I get: Uncaught RangeError: Maximum call stack size exceeded
  8. Please help, I am trying to get data out of my database as an array but it doesn't seem to be working?! I just get: ArrayArrayArrayArrayArray here is my code <?php $mysqli = mysqli_connect("localhost", "root", "", "plods"); $sql_locations = "SELECT * FROM southdowns"; $rs_locations = mysqli_query($mysqli, $sql_locations); foreach( $rs_locations as $rs_location ) { $markers[] = array( "{$rs_location['address1']}, {$rs_location['address2']}", $rs_location['Longitude'], $rs_location['Latitude'] ); echo $markers; } ?>
  9. I would if I could find it but then the date will be wrong I think
  10. Yes it's all a bit mashed together $time variable is a date set in the database $time = $context->data->field_event_date[0]['value']; var deadline = '". date('Y-m-d', $time) ."'; initializeClock('clockdiv', deadline);", 'inline');
  11. Whichever... PHP? I just tried this but it came back as -16449 days 3 months -8 hours var deadline = '". date('Y-m-d', strtotime($time. ' + 1 days')) ."'; at the moment the countdown says: 0 days 13 hours 46 minutes 30 seconds I would like it to say: 1 days 13 hours 46 minutes 30 seconds
  12. So I am declaring deadline as a JS variable and then going into PHP var deadline = '". date('Y-m-d', $time) ."'; I just want to add an extra day onto my deadline any help here please?
  13. I am getting an error to check my values but I am using the right username, password, table name and host name. Can anyone help me here? $mysqlDatabaseName ='drupal'; $mysqlUserName ='drupal'; $mysqlPassword ='xxx'; $mysqlHostName ='localhost'; $mysqlExportPath ='content_type_vacancy.sql'; $command='mysqldump --opt -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' content_type_vacancy > ~/' .$mysqlExportPath; exec($command,$output=array(),$worked); switch($worked){ case 0: echo 'Database <b>' .$mysqlDatabaseName .'</b> successfully exported to <b>~/' .$mysqlExportPath .'</b>'; break; case 1: echo 'There was a warning during the export of <b>' .$mysqlDatabaseName .'</b> to <b>~/' .$mysqlExportPath .'</b>'; break; case 2: echo 'There was an error during export. Please check your values:<br/><br/><table><tr><td>MySQL Database Name:</td><td><b>' .$mysqlDatabaseName .'</b></td></tr><tr><td>MySQL User Name:</td><td><b>' .$mysqlUserName .'</b></td></tr><tr><td>MySQL Password:</td><td><b>NOTSHOWN</b></td></tr><tr><td>MySQL Host Name:</td><td><b>' .$mysqlHostName .'</b></td></tr></table>'; break; }
  14. Hi, I am trying to add values together in my while loop, so far I have: $q->query($DB, $SQL); while($avrating=$q->getrow()): $averageratings = $avrating['sum(rating)'] / $noofreviews; $overallaverage = round($averageratings, 2) + round($averageratings, 2); echo '<p>'.$avrating['rating_name'].': '.round($averageratings, 2).'</p>'; endwhile; echo 'x'.$overallaverage; $overallaverage += $overallaverage / 10; echo 'The Average: '.$overallaverage; from this, I get: x7.34The Average: 8.074 the total shold be: 42.34 then dived by 10 should be 4.23
  15. here is the code in my page: $SQL = " SELECT sr.review_id, sr.review_date, sr.review, sr.reviewer_name, sr.reviewer_surname, r.rating_name, r.rating FROM school_reviews sr LEFT JOIN ratings r USING(review_id) WHERE sr.active = 1 AND sr.is_deleted = 0 AND sr.school_id = '" . $school_id . "' ORDER BY sr.review_date DESC"; $q->query($DB,$SQL); // store results of query in array $reviews = array(); while($row = $q->getrow()) { // get the review id $id = $row['review_id']; // group reviews by review id if(!isset($reviews[$id])) { $reviews[$id] = array( 'message' => $row['review'], 'date' => $row['review_date'], 'name' => $row['reviewer_name'], 'surname' => $row['reviewer_surname'], 'ratings' => array() ); } // group ratings by review id $reviews[$id]['ratings'][] = array( 'name' => $row['rating_name'], 'value' => '<img src="/en/images_v2/ratings/star'.$row['rating'].'.png" />' ); } // loop over the reviews foreach($reviews as $review_id => $review) { // output review echo "<div class=\"schoolreview\">"; echo "<p><span class=\"right\">Posted On: " . $review['date'] . "</span>"; echo "Review by: ".$review['name']."<br />\n" . "</p>\n"; // output ratings list for each review echo "<ul class=\"ratings\">\n"; foreach($review['ratings'] as $rating) { echo "\t<li>" . $rating['name'] . ': ' . $rating['value'] . "</li>\n"; } echo "</ul>\n"; echo "<p>Review: " . nl2br($review['message']) . "</p>"; echo "</div>"; }
×
×
  • 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.