Jump to content

abrahamgarcia27

Members
  • Posts

    131
  • Joined

  • Last visited

Posts posted by abrahamgarcia27

  1. I can't seem to figure out how to structure the following query. 

     

    I have two type of content

     

    1= helmet

    2 = shoulder pads

     

    and i have grouped it by school_barcode it gives me all the rows in one result which is what i want. But now i want it to SUM all the count where the type is 1 and type is 2 and give me two different results. 

     

    I have this table

     

    detail_id

    school_barcode

    bag_number

    type_content

    count

    receiving_id

    freight_bill

    time_stamp

     

    and have the following query

    		$sql = "SELECT SUM(count), `".TABLE_RECEIVING_DETAIL."`.school_barcode, `".TABLE_SCHOOL."`.name FROM `".TABLE_RECEIVING_DETAIL."` LEFT JOIN `".TABLE_SCHOOL."` on  `".TABLE_RECEIVING_DETAIL."`.school_barcode = `".TABLE_SCHOOL."`.bar_code WHERE receiving_id = '$receiving_id' AND freight_bill = '$freight_bill' GROUP BY school_barcode";
    
    

    The end result should be

     

    Customer # | Cutomer Name | Helmets Received SUM | Shoulder Pads Received SUM 

  2. well i was just brainstorming what would be the best way to do it. I just got the idea of using implode and explode functions to query just the number, but i do not know if that would be the best way. 

  3. How would i write the php and htaccess for nice looking urls like this?

    http://forums.phpfreaks.com/forum/13-php-coding-help/

     

    I have this php code

    function getservices(){
    	
    	$db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
    	$db->connect();
    	//QUERY ACTIVE COLLECTIONS
    	$sql = "SELECT service_id, name FROM `".TABLE_SERVICE."`
    	ORDER BY sort_order ASC";
    	$rows = $db->fetch_all_array($sql);
    	foreach($rows as $record){
    	echo
    	'<li><a href="/services/'.$record['service_id'].'">'.$record['name'].'</a></li>';
    	}
    }
    

    And the htaccess is as follows

    RewriteRule    ^services/([0-9]+)/?$    index.php?action=services&service_id=$1    [NC,L]    #HANDLE SERVICES
    
  4. how would i tell the jquery function to listen to the id and get the contact id link? I know i would give the id via database primary id, but what is the proper way to just write one jquery function?

  5. I am having trouble getting the slideToggle function to work. i need to click on a href with a class and i want it to open a div underneath. i tried using the next() function, but that didnt work. So what the function does now is when i click the link it will slidetoggle all the contact div. I want it to open just the next div with the class of contact. 

     

     

    PHP Function 

    
    <div class="posting">
    	<div class="one columns">
    		'.$image.'
    	</div>
    	<div class="fifteen columns">
    		<a href="#" class="contactlink"><div class="posttitle">'.stripslashes($mainRow['book_title']).'</div></a>
    		<div class="postdesc">'.stripslashes($mainRow['book_desc']).'</div>
    		<br>
    		<div class="three columns"><div class="postprice">$ '.stripslashes($mainRow['book_price']).'</div></div>
    		<div class="three columns"><div class="postclass">'.stripslashes($mainRow['book_class']).'</div></div>
    		<div class="three columns"><div class="postcondition">'.stripslashes($mainRow['book_condition']).'</div></div>
    	</div>
    </div>
    <div class="clear"></div>
    <hr>
    <div class="contact" style="display:none;">
    	<form action="">
    		<input type="text">
    		<input type="text">
    		<input type="text">
    	</form>
    </div>
    

    jQuery Function

    $(document).ready(function() {
      $('.contactlink').click(function() {
         $(".contact").slideToggle('fast'); // Toggle dd when the respective dt is clicked
      });
    });
    
    
  6. So i am working on a page i am using a tutorial found online to paginate a gallery via infinite scroll. I have the plugin working, but the elements of the theme such a magnifying glass on hover do not work. I am sure the problem has to do with the content being loaded via AJAX. When i inspect the element the all the div are there, but when i view source it does not show the data that is being appended, so i believe that is where the problem is at. The problem is i don't know how to fix this issue, if someone could guide me toward the right way that would be great. 

     

    Link: http://sunerandgarcia.com/clients/tucanes/fotos

     

     

  7. I am trying to rewrite this link to

     

    http://sunerandgarcia.com/clients/oster2/index.php?action=portfolio-single&portfolio_id=IL_ipJBKRg4zlbefl3AU9zZvj6OjmQGErnI1iVDRWbU

     

    to

     

    http://sunerandgarcia.com/clients/oster2/port/IL_ipJBKRg4zlbefl3AU9zZvj6OjmQGErnI1iVDRWbU

     

    I wrote the following rule 

    RewriteRule    ^port/(.*)/?$   ./index.php?action=portfolio-single&portfolio_id=$1     [NC,L]   

    But when i go to the link it does not load the images or stylesheets. All the images come with the directory port so that is why it is not loading. i tried putting the ./ before index, but it did not fix anything. 

     

     

  8. to sort dates they need to be in a sortable format, which is YYYY-MM-DD

     

    Either change your date fields to type DATE and use that format (recommended)

     

    or convert the date in the/every query to that format using STR_TO_DATE() function.

     

    Thanks i just changed the date field to DATE. 

  9. I am trying to sort by date my date posted format is the following 4/9/2013 -> Month / Day / Year

     

    I am using the following query (I want to put the newest at top)

    $mainQuery = "SELECT SQL_CALC_FOUND_ROWS * FROM `".TABLE_BLOG."` ORDER BY DATE(posted_date) DESC LIMIT ".(int)($perPage*($p-1)).','.(int)$perPage." ";
    

    But it is not ordering correctly the information

     

    Could anyone help me figure this out?

  10. I made something not finish, but maybe it can help you. You just need to get the value of the me=1 maybe you can assign an attribute and look for that. 

     

     <html>
     <head>
       <title>Ajax Help</title>
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
       <script>
       $(document).ready(function(){
        $("a").click(function(event) {
          event.preventDefault();
          $.get("action.php", { me: "1" }, function(data) {
               $('#log').html(data);
          });
        });
        });
        </script>
     </head>
     <body>
        <a href="./action.php?me=1" class="member">member1</a>
        <div id="log"></div>
     </body>
     </html>
    
    
  11. Check this sample

     

     <p>
                              <label>State</label>
                            <span class="formwrapper">
                            <select data-placeholder="Choose a State..." name="state" class="chzn-select" tabindex="2">
                            <?php 
                            $state_list = array('AL'=>"Alabama",
                                'AK'=>"Alaska",  
                                'AZ'=>"Arizona",  
                                'AR'=>"Arkansas",  
                                'CA'=>"California",  
                                'CO'=>"Colorado",  
                                'CT'=>"Connecticut",  
                                'DE'=>"Delaware",  
                                'DC'=>"District Of Columbia",  
                                'FL'=>"Florida",  
                                'GA'=>"Georgia",  
                                'HI'=>"Hawaii",  
                                'ID'=>"Idaho",  
                                'IL'=>"Illinois",  
                                'IN'=>"Indiana",  
                                'IA'=>"Iowa",  
                                'KS'=>"Kansas",  
                                'KY'=>"Kentucky",  
                                'LA'=>"Louisiana",  
                                'ME'=>"Maine",  
                                'MD'=>"Maryland",  
                                'MA'=>"Massachusetts",  
                                'MI'=>"Michigan",  
                                'MN'=>"Minnesota",  
                                'MS'=>"Mississippi",  
                                'MO'=>"Missouri",  
                                'MT'=>"Montana",
                                'NE'=>"Nebraska",
                                'NV'=>"Nevada",
                                'NH'=>"New Hampshire",
                                'NJ'=>"New Jersey",
                                'NM'=>"New Mexico",
                                'NY'=>"New York",
                                'NC'=>"North Carolina",
                                'ND'=>"North Dakota",
                                'OH'=>"Ohio",  
                                'OK'=>"Oklahoma",  
                                'OR'=>"Oregon",  
                                'PA'=>"Pennsylvania",  
                                'RI'=>"Rhode Island",  
                                'SC'=>"South Carolina",  
                                'SD'=>"South Dakota",
                                'TN'=>"Tennessee",  
                                'TX'=>"Texas",  
                                'UT'=>"Utah",  
                                'VT'=>"Vermont",  
                                'VA'=>"Virginia",  
                                'WA'=>"Washington",  
                                'WV'=>"West Virginia",  
                                'WI'=>"Wisconsin",  
                                'WY'=>"Wyoming");
                            foreach ($state_list as $key => $value) {
                            ?>
                            <option value="<?php echo $key; ?>" <?php if($record['state'] == $key)echo "selected";?>><? echo $value; ?></option> 
                            <?php } ?>
                            </select>
                            </span>
                            </p>
    
  12. Use this instead

     

    <form action="exec.php" method="post">
    <input name="checkbox[]" type="checkbox" id="checkbox" value="I AM INTERESTED IN BEING A DISTRIBUTOR">
    <input name="checkbox[]" type="checkbox" id="checkbox" value="I OWN A FLEET OF COMMERCIAL VEHICLES">
    <input name="checkbox[]" type="checkbox" id="checkbox" value="I NEED A LOCAL SUPPLIER FOR MYGREENOIL">
    <input name="checkbox[]" type="checkbox" id="checkbox" value="I HAVE A TECHNICAL QUESTION">
    <input type="submit" value="submit" />
    
×
×
  • 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.