Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. yeah, please elaborate on what you meen by "auto database check"
  2. You're double running the query... $myselect=mysql_query($selectemail); $result = MYSQL_QUERY($myselect) or die('Query failed: ' . mysql_error() . "<br />\n$myselect");
  3. depends entierly on the table structure - but I strongly suggest starting a new thread for that one
  4. ok, what div's are you closing at the affore mentioned possitions. also, your PHP is opening a div before you have even called the HTML opening tag which I then assume is being closed somewhere within the BODY tag...that can't be good.
  5. let's try a bit of conditioning then: <?php $field1 = "Farms to " . $_POST['farms_population']; $a = array("$field1", "$field2", "$field3", "$field4", "$field5", "$field6"); for ($i=0; $i < (count($a) -1); $i++){ if($a[$i] != ''){ $a[$i] = $a[$i]." and"; } $_SESSION['changed'] = "You have changed " . implode(" ",$a); echo $_SESSION['changed']; ?>
  6. your loop is all screwed up, change it to a while loop and it should be fine.
  7. try this: $colname_hotel_name_RS = "-1"; if (isset($_POST['name'])) { $colname_hotel_name_RS = $_POST['name']; } mysql_select_db($database_contractors, $contractors); $query_hotel_name_RS = sprintf("SELECT * FROM hotels WHERE est_name LIKE '\%%s\%'", GetSQLValueString($colname_hotel_name_RS, "text")); print_r($query_hotel_name_RS); exit(); $hotel_name_RS = mysql_query($query_hotel_name_RS, $contractors) or die(mysql_error()); $row_hotel_name_RS = mysql_fetch_assoc($hotel_name_RS); $totalRows_hotel_name_RS = mysql_num_rows($hotel_name_RS);
  8. use implode : http://uk.php.net/manual/en/function.implode.php
  9. Give this a shot: <?php $field1 = "Farms to " . $_POST['farms_population']; $a = array("$field1", "$field2", "$field3", "$field4", "$field5", "$field6"); for ($i=0; $i < (count($a) -1); $i++){ $a[$i] = $a[$i]." and"; $_SESSION['changed'] = "You have changed " . implode(" ",$a); echo $_SESSION['changed']; ?>
  10. you shouldn't need the DISTINCT if your using the GROUP BY....
  11. it should work if you wrap your strings thus: $location_request = "http://maps.google.com/maps/api/geocode/json?address='$city',+'$real_state',+'$real_country'&sensor=false";
  12. could you put up a print_r($a) example for us?
  13. you seem to be closing 1 too many div's after either </fieldset> or mysqli_close($dbc)
  14. how about if you use SELECT id, location FROM cities GROUP BY location ORDER BY id ASC"
  15. depends on the level of access you have on the server. I think the best solution (could be wrong though) is to edit the htaccess file and redirect it on the server its self. Other than that you can use headers to redirect the pages, but I think that could bugger the google lookup (unless the NOBOTS meta tag still works...) It's not really an area which I am femilliar with.
  16. what happens if you stick this at the end? foreach($array as $arr){ echo "<br>"; foreach ($arr as $set => $value){ echo "$value "; } }
  17. do you still have access to mainpage.html on the original site?
  18. Mackin, could you do a print_r($query_hotel_name_RS) for us and post the contents of the query string after it's made?
  19. Glad you got it working, I see the problem in the code I gave you was that I included the LIMIT statment inside the brackets aswell >_<
  20. I think it's an order problem, lets fling in some brackets and see what happens: $sql = "SELECT * FROM product WHERE ((" . implode(' OR ', $searchTerms) . ") AND (product_id != '$prodid' LIMIT 3))";
  21. I have knnocked up a little function that does what I THINK you want. I havn't tested it, so don't go getting excited or anything You would fit this into your code by calling it when you are building your main SELECT query. <?php function dateQuery($m, $y, $dateField){ $m = stripslashes(trim($m)); $y = stripslashes(trim($y)); if ($m == '' || $m = '0'){ $m = '01'; $m_all = TRUE; } if (($m != '0' && strlen($m == '1'))) { $m = '0'.$m; } if (($y == '') || ($y == '0')){ $y = '1970'; $y_all = TRUE; } if(!isset($m_all)){ $m_qry = " MONTH($dateField) = $m "; } else { $m_qry = "$m-01 "; } if(!isset($y_all){ $y_qry = " YEAR($dateField) = $y "; } else { $y_qry = "$y-"; } if (isset($y_all) && isset($m_all){ $qry = "WHERE $dateField BETWEEN $y_qry$m_qry AND CURRENT_TIMESTAMP"; } elseif (isset($y_all) && !isset($m_all)) { $qry = "WHERE((YEAR($dateField) BETWEEN $y_qry AND YEAR(CURRENT_TIMESTAMP)) AND ($m_qry))"; } elseif (isset($m_all) && !isset($y_all)) { $qry = "WHERE((MONTH($dateField) BETWEEN $m_qry AND 12) AND ($y_qry))"; } else { $qry = "WHERE $y_qry AND $m_qry"; } return $qry; } $mainQuery = "SELECT field1, field2, field3 FROM table "; //change to your actual select & from query information $whereDate= dateQuery($month, $year, "date_field_name"); //call the function to build the date check sending in $month, $year and the field name in the table of the the date field. $mainQuery = $mainQuery.$whereDate; $result = mysql_query($mainQuery); while...// rest of your code as normal
  22. could you do a print_r($sql) and post up what you get from it please.
  23. I think the SQL should look like this (I belive you need to escape the %'s used for the Like as you are using a sprintf to build the string): "SELECT * FROM hotels WHERE est_name LIKE '\%%s\%'", GetSQLValueString($colname_hotel_name_RS, "text") if that errors out try it without the \'s at the %'s and if that still doesn't work post us up your error messages.
  24. foreach($html->find('table tr') as $weather) { if($weather->find('th')) {continue;} //apparently this needs to be added because there is a bug in simple_html_dom.php if(!$weather->find('td ', 0)) {continue;} $datetime = $weather->find('td', 0)->plaintext; $currentTemp = $weather->find('td', 1)->plaintext; } What you are doing here is over writing the value of $datetime and $currentTemp for every instance of <tr> on the source page. Only after it has finished looking up all the <tr>'s are you then using the final <tr>'s information. how does it work if you do this: <?php error_reporting(E_ALL); include_once('htmldom/simple_html_dom.php'); $url = 'http://www.bom.gov.au/products/IDQ60901/IDQ60901.94580.shtml'; // Create DOM from URL $html = file_get_html($url); for ($i=0; $i <2; $i++){ foreach($html->find('table tr') as $weather) { if($weather->find('th')) {continue;} //apparently this needs to be added because there is a bug in simple_html_dom.php if(!$weather->find('td ', 0)) {continue;} $datetime = $weather->find('td', 0)->plaintext; $currentTemp = $weather->find('td', 1)->plaintext; print_r('updated:' . '&nbsp' .$datetime); print_r ('<br>'); print_r('CurrentTmp:' . '&nbsp' .$currentTemp); print_r ('<br>'); } } ?>
  25. I'm confused, why does having a managed network stop you running an intranet server? as for setting the duration of a cookie - check out this page, perticularly the "expire" section: http://php.net/manual/en/function.setcookie.php
×
×
  • 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.