Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. change function load_analytics($key) { echo '<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("' . $key . '"); pageTracker._trackPageview(); </script>'; } to this <?php function load_analytics($key) { ?> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("' . $key . '"); pageTracker._trackPageview(); </script> <?php } ?>
  2. look into a php script called sphider, http://www.sphider.eu/
  3. Ok... I have this code: $this->load->database(); $affiliateId = $this->session->userdata('affiliateId'); $hashQuery = $this->db->get('paypal_payment_info'); foreach($hashQuery->result() as $hash) { $code[] = $hash->custom; } for($i = 0; $i < $hashQuery->num_rows(); $i++) { $count = explode("|", $code[$i]); $partOne = $count[0]; if($partOne == $affiliateId) { $partTwo = $count[1]; $partThree = $count[2]; $hash = $partOne . "|" . $partTwo . "|" . $partThree; $q = $this->db->query("SELECT custom, mc_gross, mc_fee, txn_id FROM paypal_payment_info WHERE custom = '$hash'"); $num = $q->num_rows(); if(strstr($hash,'Choose_Me_(Album)')) { $album_sales = ($q->num_rows() * 10) * .05; } else { $album_sales = '0'; } } else { $data['no_earnings_total'] = "You currently have no sales."; $album_sales = 'You have no Album Sales'; $num = 0; } } $data['album_sales'] = $album_sales; if($num > 0) { foreach($q->result() as $row) { $mc_gross = $row->mc_gross; $mc_fee = $row->mc_fee; $txn_id[] = $row->txn_id; } $total_earnings = ($mc_gross * $q->num_rows()) - ($mc_fee * $q->num_rows()); if($total_earnings != 0) { $data['total_earnings'] = $total_earnings; } else { $data['total_earnings'] = '0.00'; } } I think I have my for loops all screwed up somewhere... basically the code above hits a DB and grabs ALL of the rows from paypal_payment_info and then I grab ALL of the custom values and place them into an array... I iterate through that array and the explode the the string to pull out the first item in that array (the custom field holds a piped code that I need to pull out the first value in the first piped section) I then try to see if the $partOne matches the sessioned affiliateId and if so then follow the rest of the code, but for some reason the $partOne is having problems matching the affiliateId... Any ideas here?
  4. You could not be destroying the session when you logout
  5. I need direction in how to go about uploading a sql file and then parsing the file to dump the results into a database... and this sql file will contain the ability to create a table and then insert corresponding entries into that table. I know how to upload a file using PHP but I am not 100% certain on the parsing the data
  6. I have this code: while($results = mysql_fetch_assoc($structure)) { echo '<td>'; echo $results['Field']; echo '</td>'; $explode_array .= array($results['Field'] . ","); } when I do a print_r() on $explode_array it is only displaying the last result in $results['Field'], how would I get ALL results to dump into my array?
  7. ok... so now that I have the while loop going how do I echo out just one of the tables? I can print_r($row) all day long, but how do I access just one of the DB tables?
  8. hmmm... that worked but how come you can't do it in a foreach loop?
  9. $q = mysql_query("SHOW TABLES FROM *****"); $row = mysql_fetch_object($q); foreach($row as $r) { print_r($r); } for some reason the code above is only returning the first record it finds and not every record.. the code above is to echo out ALL of the table column names
  10. figured it out fixed code: mysql_connect('localhost', '*******', '*******'); mysql_select_db('*******'); $q = mysql_query("SHOW TABLES FROM *******"); while($row = mysql_fetch_array($q)) { $col = $row; $count = count($col) - 1; for($i = 0; $i < $count; $i++) { echo '<span>' . $col[$i] . '</span>'; } }
  11. oh gotcha... no its just a blank span for some reason
  12. I have the following loop: mysql_connect('localhost', '*****', ''*****'); mysql_select_db(''*****'); $q = mysql_query("SHOW TABLES FROM tblName"); while($row = mysql_fetch_array($q)) { $col = $row; $count = count($col); for($i = 0; $i < $count; $i++) { echo '<span>' . $col[$i] . '</span>'; } } When you run the code it adds an extra span tag in there... I can't figure out why!
  13. I actually just figured it out! Here is the updated code: $modOne = $_POST['modelone']; $modTwo = $_POST['modeltwo']; $modThree = $_POST['modelthree']; $array = array($modOne, $modTwo, $modThree); foreach($array as $r) { $man_db = JFactory::getDBO(); $v = mysql_real_escape_string($r); $man_db->setQuery("SELECT * FROM tblName WHERE model = '$v'"); $man_rows = $man_db->loadObjectList(); foreach($man_rows as $row) { $ded = $row->deductible; $deduct[] = $ded; if($ded == '89.99') { $prem[] = '6.00'; } elseif($ded == '39.99') { $prem[] = '4.49'; } } }
  14. they are down in the HTML part of the script... So the table is like this: <table width="600" cellpadding="5" cellspacing="0" rules="all" frame="box" border="1" id="resultsBox"> <?=$buildTable;?> </table>
  15. this is the whole script (well almost ALL of it) $modOne = $_POST['modelone']; $modTwo = $_POST['modeltwo']; $modThree = $_POST['modelthree']; $array = array($modOne, $modTwo, $modThree); foreach($array as $r) { $man_db = JFactory::getDBO(); $v = mysql_real_escape_string($r); $man_db->setQuery("SELECT * FROM tblName WHERE model = '$v'"); $man_rows[] = $man_db->loadObjectList(); foreach($man_rows as $row) { $deduct = $row['deductible']; if($deduct == '89.99') { $prem = '6.00'; } elseif($deduct == '39.99') { $prem = '4.49'; } } } $buildTable = '<tr>'; $buildTable .= '<th>Wireless Phone Number:</th>'; $buildTable .= '<th>Premium:</th>'; $buildTable .= '<th>Deductible:</th>'; $buildTable .= '</tr>'; $buildTable .= '<tr>'; $buildTable .= '<td>' . $numOne . '</td>'; $buildTable .= '<td>' . $prem . '</td>'; $buildTable .= '<td>' . $deduct . '</td>'; $buildTable .= '</tr>'; if($numTwo && !empty($numTwo)) { $buildTable .= '<tr>'; $buildTable .= '<td>' . $numTwo . '</td>'; $buildTable .= '<td>' . $prem . '</td>'; $buildTable .= '<td>' . $deduct . '</td>'; $buildTable .= '</tr>'; } if($numThree && !empty($numThree)) { $buildTable .= '<tr>'; $buildTable .= '<td>' . $numThree . '</td>'; $buildTable .= '<td>' . $prem . '</td>'; $buildTable .= '<td>' . $deduct . '</td>'; $buildTable .= '</tr>'; } I am echoing out $buildTable later on down the page
  16. the output? yes... but its not echoing out for some reason
  17. updated code: $modOne = $_POST['modelone']; $modTwo = $_POST['modeltwo']; $modThree = $_POST['modelthree']; $array = array($modOne, $modTwo, $modThree); foreach($array as $r) { $man_db = JFactory::getDBO(); $v = mysql_real_escape_string($r); $man_db->setQuery("SELECT * FROM tblName WHERE model = '$v'"); $man_rows[] = $man_db->loadObjectList(); foreach($man_rows as $row) { $deduct = $row['deductible']; if($deduct == '89.99') { $prem = '6.00'; } elseif($deduct == '39.99') { $prem = '4.49'; } } }
  18. this is the output from $man_rows[]: Array ( [0] => Array ( [0] => stdClass Object ( [rowid] => 11 [manufacturer] => VERIZON WIRELESS [model] => XV6900 [deductible] => 89.99 [published] => 1 ) ) [1] => Array ( ) [2] => Array ( ) )
  19. ok so I did that and now I get nothing $modOne = $_POST['modelone']; $modTwo = $_POST['modeltwo']; $modThree = $_POST['modelthree']; $array = array($modOne, $modTwo, $modThree); foreach($array as $r) { $man_db = JFactory::getDBO(); $v = mysql_real_escape_string($r); $man_db->setQuery("SELECT * FROM tblName WHERE model = '$v'"); $man_rows[] = $man_db->loadObjectList(); foreach($man_rows as $row) { $deduct = $row->deductible; if($deduct == '89.99') { $prem = '6.00'; } elseif($deduct == '39.99') { $prem = '4.49'; } } }
  20. hmmm... ok, can we step back and disect a little bit? I think I may not be following here is an original foreach loop: $modOne = $_POST['modelone']; $modTwo = $_POST['modeltwo']; $modThree = $_POST['modelthree']; $array = array($modOne, $modTwo, $modThree); foreach($array as $r) { $man_db = JFactory::getDBO(); $v = mysql_real_escape_string($r); $man_db->setQuery("SELECT * FROM tblName WHERE model = '$v'"); $man_rows = $man_db->loadObjectList(); } as you can see I have each $_POST var set to another variable and then all of those are captured in an array, but when I do a print_r on the man_rows I only get the results from the very last entry in the array.
  21. ok... I have some post variables that are being passed to the page... $modOne = $_POST['modelone']; $modTwo = $_POST['modeltwo']; $modThree = $_POST['modelthree']; $array = array($modOne, $modTwo, $modThree); and the foreach should then iterate through each value and give something back out of the SQL DB foreach($array as $r) { $man_db = JFactory::getDBO(); $v = mysql_real_escape_string($r); $man_db->setQuery("SELECT * FROM tblName WHERE model = '$v'"); but it is only returning results from the very last entry in the Array ($array)
  22. for some reason its stopping at the last post entry...
  23. Array ( [0] => stdClass Object ( [rowid] => 2 [manufacturer] => AUDIOVOX [model] => C211PTT [deductible] => 89.99 [published] => 1 )
×
×
  • 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.