Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. if (is_page_template('page_blog.php') ) { add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap'); }
  2. Some personal advice....install wamp, start out with procedural type coding and then move onto more advanced stuff like oop(object oriented programming) and mvc(model–view–controller).
  3. Nobody can run that but you, would probably do more good to post the html source code or the link to your page. But .....why not start using some dividers instead and check with a html validator Try to keep all your coding up top, and do the html all neatly below.
  4. Use the $_SERVER variables for setting your paths http://us1.php.net/manual/en/reserved.variables.server.php
  5. Split the csv file up then try it http://sourceforge.net/projects/splitcsv/
  6. If it's a large file you should save the csv to a database and query each result that way Having to load a very large file each time takes lots of resources.
  7. if you need to find something specific, wrap it with an if statement, perform any search or checks on it and then echo or save as a variable. examples: if($data[$c] != ''){ $string = $data[$c]; echo $string . "<br />\n"; } or if to make them a new array $new_array = array();//outside the loop if($data[$c] != ''){ $new_array[] = $data[$c]; }
  8. echo "<td><img src='".$rec['IMAGE']."'></td>";
  9. Is this supposed to be getting from $sql2? $budget = mysql_fetch_array($sql1); am guessing should be this $budget = mysql_fetch_array($sql2);
  10. I commented out the escaping so can run this code. $data = Array ("19_y" => "1", "19_c" => "this is a text message", "18_y" => "1", "18_c" => "this is another text message", "17_n" => "1", "16_dn" => "1", "16_c" => "submit_questions"); $columns = implode(", ",array_keys($data)); $escaped_values = array_map('trim', array_values($data)); //$escaped_values = array_map('mysqli_real_escape_string', array_values($escaped_values)); $values = implode(", ", $escaped_values); $sql = "INSERT INTO `tablename`($columns) VALUES ($values)"; echo $sql; results: INSERT INTO `tablename`(19_y, 19_c, 18_y, 18_c, 17_n, 16_dn, 16_c) VALUES (1, this is a text message, 1, this is another text message, 1, 1, submit_questions)
  11. This should work for you. <?php $mediatronic = "12 20 40"; $tank = "20 10 34"; $number = -1; $m_array = array(); $t_array = array(); $m_array = explode(" ", $mediatronic); $t_array = explode(" ", $tank); echo "<b> You have selected Medtronic VS Tank: </b><br />"; foreach ($m_array as $m_value) { ++$number; $show_number = $number + 1; if ($m_value < $t_array[$number]) { $amount = $t_array[$number] - $m_value; echo "Medtronic Stat" . $show_number . " is ". $amount . " weaker than Tank <br />"; } elseif ($m_value > $t_array[$number]) { $amount = $m_value - $t_array[$number]; echo "Medtronic Stat" . $show_number . " is ". $amount . " stronger than Tank <br />"; } elseif ($m_value == $t_array[$number]) { echo "Medtronic Stat" . $show_number . " is equal to Tank <br />"; } else { echo "Unable to compare. <br />"; } } ?> returns: You have selected Medtronic VS Tank: Medtronic Stat1 is 8 weaker than Tank Medtronic Stat2 is 10 stronger than Tank Medtronic Stat3 is 6 stronger than Tank
  12. Copy/paste is the easiest fastest method. Bad code is all over the net. Some don't want to learn, just get it done and have it.
  13. You seem to have the links to the left correct, now all you need to do is make some named anchor tags in your page. Place whatever you need below in each anchor. <a name="About"></a> about info here <a name="Family"></a> family info here <a name="Routine"></a> routine info here and so on.....
  14. An iframe is just a window to the other persons website. You have little control over it. Maybe you should try using the mediawiki api instead http://www.mediawiki.org/wiki/API
  15. I concur with trq, that's just way too many queries being done. On shared hosting, any usage is too much usage. Using mysqli_fetch_array() will return 2 sets of data, numeric and associative array. mysqli_fetch_assoc() would return half the amount of data. Can also do it as... $result = $mysqli->query($query); $row = $result->fetch_array(MYSQLI_ASSOC);
  16. Can try mb-detect-encoding() and mb-convert-encoding() I use iconv Most likely will have to do multiple methods of detection and checking, it's a real mess. Since you are trying to save html webpages...also have to worry about fixing relative links.
  17. Can also shuffle() the array then display 16 in a for loop, ($image['0'] to $image['15']) $image_array = array(); $di = new RecursiveDirectoryIterator('images'); foreach (new RecursiveIteratorIterator($di) as $filename => $file) { if (substr($file, -1) != ".") { $image_array[] = $file; } } shuffle($image_array); for($i = 0; $i <=15; ++$i) { echo "<div class='four columns'><img src='". $image_array[$i] . "' style='width:100%; height=auto;'/></div>"; }
  18. since you seem to be wanting to display the entire contents, why not just iframe it instead Specify what type of data you want from it, is various ways to get data from a site. dom , simplexml , simple_html_dom , curl and use preg_match , preg_match_all with some regex You need to show us the page or an example of the results, and what info you would want from it. And also sites don't usually like other sites using their data, so ask them first, maybe they even have an api to get the data easier.
  19. Is other ways to go about this, like checking the key values and sorting in your own orders by key numbers, but have to check if they even exist, associate which ones to what order, can get messy. another option is to just send all the possible GET parameters back even if they are empty in the order you want can check if the $_REQUEST for each even exists and trim them as well,do any checking before place into query $new_url = filter_var("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING) . "?article=" . $_REQUEST['article']."&id=".$_REQUEST['id']."&page=".$_REQUEST['page'];
  20. name your parameters alphabetical or numerical order as to the order in want to display them ?1something=1&3something=3&2something=2 ?asomething=1&csomething=3&bsomething=2 then use something like this <?php if (isset($_REQUEST)) { ksort($_REQUEST); $build = array(); foreach ($_REQUEST as $key => $value) { $build[] = $key . "=" . $value; } $new_query = implode("&", $build); echo $new_url = filter_var("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING) . "?" . $new_query; } ?>
  21. That postman looks useful. Easier to read about it here. http://www.getpostman.com/
  22. You can set the memory limit at the top of your script like this ini_set('memory_limit', '-1'); set_time_limit(0); That is unlimited memory and also unlimited timeout if need that too.
  23. This is beyond helping with your code, if you don't know should post it in the freelance section and get someone who does. http://forums.phpfreaks.com/forum/77-job-offerings/
  24. Is that really your input with the times blending in with the titles? Anyway, in a loop you can create a new array and even associate items within that array $new_array[] = array("id"=>$my_id, "channel"=>$channel, "start"=>$starttime, "stop"=>$stoptime); Outside the loop can do whatever need with it. var_dump($new_array);
  25. Never gonna make a script that gets it right every time, is no set way sites do it. Best thing to do is figure it out for each site are visiting, have your script use whichever pattern matching method for that one. Such as first image in a particular divider, using a certain id,name or class. Downloading images for their sizes is horrible, even if it's just partial downloads. Only consider an image if it's from their same domain, excluding any 3rd party linked images. Can make a list to exclude domains/subdomains from advertising sites or anything not desired. Certainly opengraph is not the best way to go about it. Have a look at this parser script i made. http://dynainternet.com/dynavid/og-oembed/?url=http%3A%2F%2Fforums.phpfreaks.com%2Ftopic%2F288157-grabscrape-most-relevant-image-from-website%2F Using this post page, surely this isn't the most relevant image using opengraph. http://forums.phpfreaks.com/public/style_images/phpfreaks/meta_image.png
×
×
  • 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.