Jump to content

davieboy

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by davieboy

  1. HI there appreciate the code, something to look at for sure. Not got anything yet, just trying to get an idea of how to do it. Is it possible to just get the last URL tweeted, say for example, someone tweets my web address, have a script that checks that twitter account (or hashtag search) and will pick the latest one tweeted,and do something with it? Dave
  2. Hi there I'm trying to find out how to extract a URL from a tweet if someone tweets me. Can't see anything obvious online. Anyone able to help or advise Thanks Dave
  3. HI All im trying to follow the o' tutorials but coming up totally blank if(!$data=simplexml_load_file("http://maps.googleapis.com/maps/api/directions/xml?origin=51.519812,-0.200774&destination=51.26246,-1.084024&sensor=false")){ trigger_error('Error reading XML file',E_USER_ERROR); } echo 'Displaying contents of XML file...<br />'; foreach($data as $directions){ echo 'Start: '.$directions->route->leg->step->start_location->lat.' <br>End: '.$directions->route->leg->step->end_location->lng.'<br> HTML: '.$directions->route->leg->step->html_instructions.' <br>Distance: '.$directions->route->leg->step->distancee->text.'<br /><br>'; } Results just wont show at all, i know its to do with the way im going through the xml fields, but cant see where Can anyone help me at all?
  4. how would it get the email address from the filled in fields? david
  5. Im trying to develop a script that will parse an email address when a user enters it on a forum signup script, it will check against other registered users. (I have this script.) The 'parsing' will need to be done via a different site. Any ideas on how i would go about this David
  6. i cant see how to get this done. when editing pages it makes no difference. could someone help me with it? david
  7. actually ive changed it a we bit. trying to find out the total number of images in the database from certain people ordered by the most number first. SELECT *, COUNT(id) AS COUNT FROM photos WHERE status ='accepted' and in_screening = '1' GROUP BY copyright DESC LIMIT 5 and its not working
  8. figured part of it out $query = "SELECT *, COUNT(hits) AS COUNT FROM photos GROUP BY copyright LIMIT 5"; //$query = "SELECT device_id, COUNT(week) AS count FROM failed WHERE week = '$week' GROUP BY device_id"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo $row['id'] . ' <a href=\"/photographer.php?photographer=' . $row['copyright'] .'\">' . $row['copyright'] . '</a><br>'; $copyright = $row['copyright']; $hits = $row['hits']; giving an odd number at the top thought 2460 3111 user1 2477 user2 2094 user3 2062 user4 not sure why or where from
  9. Hi all Im using the pagination successfully, but now i do have quite alot of pages being given in results eg im using the standard <?php include("config.php"); mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die (mysql_error()); $limit = 15; $query_count = "SELECT * FROM photos WHERE status = 'accepted'"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); $PHP_SELF = $_SERVER['PHP_SELF']; if(!isset($_GET['page'])){ // Checks if the $page variable is empty (not set) $page = 1; // If it is empty, we're on page 1 } else{ $page = $_GET['page']; } $limitvalue = $page * $limit - ($limit); // Ex: (page2 * 5(items per page) = 10) - 5 = 5 <- data starts at 5 and after my content if($page != 1){ $pageprev = $page - 1; //decrementing $page-- does not work on all php configurations. echo("<a href=\"$PHP_SELF?page=$pageprev\"><b>PREV</b>".$limit."</a> "); }else{ echo("PREV".$limit." "); } $numofpages = $totalrows / $limit; #echo "<br>", $totalrows; #exit; for($i = 1; $i <= $numofpages; $i++){ /* This for loop will add 1 to $i at the end of each pass until $i is greater than $numofpages. */ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } //code above has been decoded lozza if(($totalrows % $limit) != 0){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page + 1; //incrementin $page like $page++ does not work in all enviroments echo("<a href=\"$PHP_SELF?page=$pagenext\"><b>NEXT</b>".$limit."</a>"); }else{ echo("NEXT".$limit); } mysql_free_result($result); ?> Just wondering how i can limit the results to say 10->15 pages and have the next and previous links on the end eg instead of the above have Thanks to all David
  10. how would i then get it with the totals $query = "SELECT *, SUM(hits) FROM photos GROUP by hits DESC LIMIT 5"; $result = mysql_query($query) or die(mysql_error()); // Print out result while ($r=mysql_fetch_array($result)) { $id=$r["id"]; $copyright =$r["copyright"]; $hits= $r["hits"]; $airline = $r["airline"]; echo "<a href=\"photographer.php?photographer=$copyright\">$hits / $copyright<br>"; // }
  11. cant find a way to get wither codes posted to work David
  12. I have a database of images each which gets it own number of hits. how do i then 'add ' all these hits together to get a total number of hits? SELECT *, COUNT(hits) FROM photos GROUP BY hits DESC LIMIT 5 is my attempt but i know its wrong david
  13. its still not working http://fsimages.net/tests/tophits.php its grouping everything with the first number of the hits ie 5 and 55 are in the same line etc...(see above link)
  14. no still not working http://www.fsimages.net/tests/tophits.php i have hits in the DB with 141 and its only showing ones with 9 all code // Make a MySQL Connection include("config.php"); mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die (mysql_error()); $query = "SELECT * FROM `photos` WHERE `STATUS` = 'accepted' ORDER BY `hits` DESC LIMIT 5"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "There are ". $row['hits'] ." ". $row['id'] .""; echo "<br />"; }
  15. im using this code SELECT * FROM photos WHERE STATUS = 'accepted' ORDER BY hits DESC LIMIT 5 but it only shows 5 from the DB and not the ones with the most hits ver confused David
  16. in trying to create a seat plan where im able to have a list of rows/seats like ABC DEF 1 === === 2 === === 3 === === 4 === === ... and where when clicked, each seat will have an id number How do i do this David
  17. hmm ok looks like it has to be the 'get' method as it works with that and not with the post] thanks fort he help skali
  18. ok i do still have an issue when u search for 'boeing' it gives 25 results. on the second page, it then gives other aircraft that are not boeing... any idea why
  19. i think i have got it this idiot was using the wrong 'variables' from the url duh!
  20. the url is now http://www.saphotography.co.uk/search_results2.php?aircraft=Airbus&airline=&airport=&keywords=&limit=20&submit=Search would it be better using 'post'?
  21. have changed the form to method = get still not having any luck though .... david (ps: realy do appreciate the help)
  22. have changed the 4 i had there. code still not playing ball www.saphotography.co.uk/search2.php is this correct? $airline_search = !empty($_GET['airline_search']) ? $_GET['airline_search'] : 'ALL'; $airport_search = !empty($_GET['airport_search']) ? $_GET['airport_search'] : 'ALL'; $aircraft_search = !empty($_GET['aircraft_search']) ? $_GET['aircraft_search'] : 'ALL'; $keyword_search = !empty($_GET['keyword_search']) ? $_GET['keyword_search'] : 'ALL';
  23. hey all im using this code <?php include_once('config.php'); $airline_search = !empty($_GET['airline_search']) ? $_GET['airline_search'] : 'ALL'; $airport_search = !empty($_GET['airport_search']) ? $_GET['airport_search'] : 'ALL'; $aircraft_search = !empty($_GET['aircraft_search']) ? $_GET['aircraft_search'] : 'ALL'; $keyword_search = !empty($_GET['keyword_search']) ? $_GET['keyword_search'] : 'ALL'; mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die (mysql_error()); // If page number is set then use it, if not, set one! $page = !isset($_GET['page']) ? '1' : $_GET['page']; // Define the number of results per page $max_results = 15; // Figure out the limit for the query based on the current page number. $from = (($page * $max_results) - $max_results); // Specify the default SQL query $sql = "SELECT * FROM photos WHERE status = 'accepted'"; // Amend the serach parameters if there are any if (isset($_GET['$airline_search'])){ $sql .= " AND airline LIKE '%$airline_search%'"; } if (isset($_GET['$airport_search'])){ $sql .= " AND location LIKE '%$airport_search%'"; } if (isset($_GET['$aircraft_search'])){ $sql .= " AND aircraft LIKE '%$aircraft_search%'"; } if (isset($_GET['$keyword_search'])) { $sql .= " AND comments LIKE '%$keyword_search%'"; } // Run the query to get the total number of results. $result = mysql_query($sql) or die(mysql_error()); $total_results = mysql_num_rows($result); // Amend the limit and order by parameters and re-query $sql .= " ORDER BY id LIMIT $from, $max_results"; // Re-run the query with additional constraints $result = mysql_query($sql) or die(mysql_error()); if ($total_results < 1){ echo $sql; echo "Sorry, your search produced no results"; } else { echo $sql; echo "Your search produced $total_results results<br><br>\n"; while ($r=mysql_fetch_array($result)) { $id=$r["id"]; $reg=$r["reg"]; $airline=$r["airline"]; $status=$r["status"]; $uploaded=$r["awhen"]; $file_name=$r["file_name"]; $hits=$r["hits"]; $copyright=$r["copyright"]; $group_photo=$r["group_photo"]; $awhere=$r["awhere"]; $aircraft=$r["aircraft"]; $date_from_unix =$r["date_taken"]; $location = $r["location"]; $serial = $r["serials"]; $comments = $r["comments"]; { echo "ALL ECHO's CORRECTLY" } } // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Construct the base link... $href = $_SERVER['PHP_SELF']."?"; foreach ($_GET as $k => $v){ if ($k != "page"){ $href .= "$k=$v&"; } } //Previous and next links $plink = "<< Previous"; $nlink = "Next >>"; echo "<center>"; // Build Previous Link if($page > 1){ $prev = ($page - 1); echo "<a href=\"{$href}page={$prev}\">{$plink}</a> "; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"{$href}page={$i}\">{$i}</a> "; } } // Build Next Link if($page < $total_pages){ $next = ($page + 1); echo "<a href=\"{$href}page={$next}\">{$nlink}</a> "; } echo "</center>"; } ?> but when searching and selecting options its not chosing the 'isset' part of the query eg searching for 'airbus' the query its using is SELECT * FROM photos WHERE status = 'accepted' ORDER BY id LIMIT 0, 15Your it should be SELECT * FROM photos WHERE status = 'accepted' and aircraft LIKE 'Airbus' ORDER BY id LIMIT 0, 15 tried all i can think of Davdi
  24. sorry for bringing this up again on my first page of reuslts my sql query is: SELECT * FROM photos WHERE status = 'accepted' AND location LIKE '%eghh%' ORDER by ID DESC LIMIT 0, 15 on the second it changes to SELECT * FROM photos WHERE status = 'accepted' ORDER by ID DESC LIMIT 15, 15 with the link: search_results.php?page=2&airline_search=&location_search=&aircraft_search=&keyword_search= so effectivly not passing the search query from page to page any help? david
  25. ok huggie thank you. im just a bit confused over it thats all. David
×
×
  • 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.