Jump to content

savagenoob

Members
  • Posts

    332
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

savagenoob's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. OK, fixed the "C" problem, just changed $class[] = $_POST['class'][0][0]; to $class[] = $_POST['class'][0]; Still not searching via dates correctly.
  2. I have a set of checkboxes on a form that I pass to php using an array as the name such as: <input name="class[]" type="checkbox" value="C-15" /> Flooring I then loop through this array, and modify the database based on the selections and the date range. Part 1 Problem: the first loop shows the value correctly as "C-15", but second loop and further only shows "C" and cuts off the "-15"; $user = $session->username; if(isset($_POST['carrier'])){ $carrier = $_POST['carrier']; $class[] = $_POST['class'][0][0]; $date1 = $_POST['date1']; $date1 = date("Y-m-d 00:00:00", strtotime($date1)); $date2 = $_POST['date2']; $date2 = date("Y-m-d 23:59:59", strtotime($date2)); foreach( $class as $key){ $query = "SELECT * FROM leads WHERE class1 = '$key' OR class2 = '$key' OR class3 = '$key' OR class4 = '$key' OR class5 = '$key' OR class6 = '$key' OR class7 = '$key' OR class8 = '$key' OR class9 = '$key' OR class10 = '$key' OR class11 = '$key' OR class12 = '$key' AND user = '' AND wccompcode = '$carrier' AND wcxdate BETWEEN '$date1' AND '$date2' LIMIT 100"; $sellead = mysql_query($query)or die(mysql_error()); echo $query; while($leads = mysql_fetch_array($sellead)){ $rowid = $leads['ID']; $update = mysql_query("UPDATE leads SET user = '$user' WHERE ID = '$rowid'")or die(mysql_error()); } } } Problem 2: it is ignoring my between date and modifying rows with a wcxdate of anything. Any ideas? This is my echo: SELECT * FROM leads WHERE class1 = 'C-8' OR class2 = 'C-8' OR class3 = 'C-8' OR class4 = 'C-8' OR class5 = 'C-8' OR class6 = 'C-8' OR class7 = 'C-8' OR class8 = 'C-8' OR class9 = 'C-8' OR class10 = 'C-8' OR class11 = 'C-8' OR class12 = 'C-8' AND user = '' AND wccompcode = '25' AND wcxdate BETWEEN '2013-01-01 00:00:00' AND '2013-01-01 23:59:59' LIMIT 100SELECT * FROM leads WHERE class1 = 'C' OR class2 = 'C' OR class3 = 'C' OR class4 = 'C' OR class5 = 'C' OR class6 = 'C' OR class7 = 'C' OR class8 = 'C' OR class9 = 'C' OR class10 = 'C' OR class11 = 'C' OR class12 = 'C' AND user = '' AND wccompcode = '25' AND wcxdate BETWEEN '2013-01-01 00:00:00' AND '2013-01-01 23:59:59' LIMIT 100
  3. I am trying to break down an array to make it easier to read. An array that looks like Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0012844 1 [4] => 37 [5] => 1 etc...) I want to display it like: [0] => 0 [1] => 0 [2] => 0 etc... how can this be accomplished.
  4. I wrote this: <script type="text/javascript" charset="utf-8"> function getFiles(){ var agencyid = "<?php echo $agencyid;?>"; var carrier = "<?php echo $carrier;?>"; $.ajax({ type: "POST", url: "ajax/getfiles.php", data: "carrier="+ carrier + "&agencyid="+agencyid, success: function(html){ $("#filelist").append(html); } }); } $(document).ready(function(){ setInterval(getFiles(), 30000); } </script> and am getting firebug error that says: "missing ) after argument list", which points to the closing of the Ajax call, }); Dont know what I am doing wrong.
  5. damn, thats wierd, the ajax is returning all the data correctly. Now what?
  6. And I do strip_tags() on all the data and values prior to the foreach loop...
  7. Thats where its a bit complicated. I cant view source, I am using jQuery ajax with a jQuery paginator/search table. I am stripping tags on the table rows as they display I just omitted for ease of read.
  8. I have this code: $data = array_combine($data4, $addfinal); foreach( $data as $key => $value){ ?> <tr> <td><?php echo $key;?></td><td><?php echo $value; ?></td><td></td><td>Safeco</td><td><a href="ajax/map.php?address=<?php echo urlencode($value);?>">Map It</a></td> </tr> <?php } That uses an array that looks like this (but longer): Array ( [business Name 1] => Business Address 1 [business Name 2] => Business Address 2 [business Name 3] => Business Address 3) But it skips every other array entry? Any ideas? So its displaying Business Name 1, Business Name 3, etc.
  9. I have a stdClass Object Multi Dimensional Array that I need to dissassemble into variables but dont know how to pull the data. The array looks like this: stdClass Object ( [results] => Array ( [0] => stdClass Object ( [address_components] => Array ( [0] => stdClass Object ( [long_name] => 1600 [short_name] => 1600 [types] => Array ( [0] => street_number ) ) [1] => stdClass Object ( [long_name] => Pennsylvania Ave NW [short_name] => Pennsylvania Ave NW [types] => Array ( [0] => route ) ) [2] => stdClass Object ( [long_name] => Northwest Washington [short_name] => Northwest Washington [types] => Array ( [0] => neighborhood [1] => political ) ) [3] => stdClass Object ( [long_name] => Washington [short_name] => Washington [types] => Array ( [0] => locality [1] => political ) ) [4] => stdClass Object ( [long_name] => District of Columbia [short_name] => DC [types] => Array ( [0] => administrative_area_level_1 [1] => political ) ) [5] => stdClass Object ( [long_name] => United States [short_name] => US [types] => Array ( [0] => country [1] => political ) ) [6] => stdClass Object ( [long_name] => 20500 [short_name] => 20500 [types] => Array ( [0] => postal_code ) ) ) [formatted_address] => 1600 Pennsylvania Ave NW, Washington, DC 20500, USA [geometry] => stdClass Object ( [location] => stdClass Object ( [lat] => 38.8987149 [lng] => -77.0376555 ) [location_type] => ROOFTOP [viewport] => stdClass Object ( [northeast] => stdClass Object ( [lat] => 38.900063880291 [lng] => -77.036306519708 ) [southwest] => stdClass Object ( [lat] => 38.897365919709 [lng] => -77.039004480291 ) ) ) [partial_match] => 1 [types] => Array ( [0] => street_address ) ) ) [status] => OK ) Really I need to start with pulling the lat and lng from the location. No clue how to get to this data.
  10. I am doing a jQuery autocomplete and based on the click of the user would like to call another function using that value. Here is my jQuery: $(function() { function log( message ) { $( "<div/>" ).text( message ).prependTo( "#inputString" ); $( "#inputString" ).scrollTop( 0 ); } $( "#inputString" ).autocomplete({ source: "ajax/search.php", minLength: 1, select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value : "Nothing selected, input was " + this.value ); } }); }); and once the user clicks on a selection from the autocomplete use that value to call a function called showCar(value); Ive tried placing this function in the above code and it messes up the autocomplete.
  11. I have an address in a variable, I pass this address to a google maps page/function that geocodes it and returns the street view. Heres an example of a link: <a href="mapget.php?address=<?php echo urlencode(strip_tags($comaddress));?>" name="mapit">Map It</a> The address' come from either a curl or dom request so I have been trying to strip and trim them as much as possible but the urls come out looking like... www.mysite.com/mapget.php?address=7855+N+SOMESTREET+AVE+SOMECITY++++++++++++++++++++++%2C+CA+11111 My maps only seem to be getting the street... I am using urldecode($address) on the receiving page and when I echo $address on the receiving page it looks completely correct. Any ideas?
  12. I read the json_encode manual (duh) and saw there is a JSON_FORCE_OBJECT option that removes the square brackets, but when I run it against my array it doesnt display at all... any help? <?php require_once ('includes/config.php'); require_once ('includes/connect.php'); $agency= mysql_query("SELECT agencyname, busphone FROM agency WHERE status ='Prospect' ORDER BY agencyname DESC")or die(mysql_error()); while($ageinfo = mysql_fetch_assoc($agency)) { $output[] = $ageinfo; } print(json_encode($output, JSON_FORCE_OBJECT)); ?>
  13. Yeah, I figured. I was wondering if there was a way to remove the brackets before the print.
×
×
  • 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.