QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
if (is_page_template('page_blog.php') ) { add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap'); }
- 4 replies
-
- php function
- genesis
-
(and 2 more)
Tagged with:
-
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).
-
malformed form: elements appear within themselves
QuickOldCar replied to Chezshire's topic in PHP Coding Help
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. -
problem with "Notice: Use of undefined constant"
QuickOldCar replied to cardwell164's topic in PHP Coding Help
Use the $_SERVER variables for setting your paths http://us1.php.net/manual/en/reserved.variables.server.php -
Im confused with large csv reading line by line
QuickOldCar replied to bores_escalovsk's topic in PHP Coding Help
Split the csv file up then try it http://sourceforge.net/projects/splitcsv/ -
Im confused with large csv reading line by line
QuickOldCar replied to bores_escalovsk's topic in PHP Coding Help
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. -
Im confused with large csv reading line by line
QuickOldCar replied to bores_escalovsk's topic in PHP Coding Help
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]; } -
proper syntax for inserting an image in a while loop?
QuickOldCar replied to CherryLips's topic in PHP Coding Help
echo "<td><img src='".$rec['IMAGE']."'></td>";- 5 replies
-
- whileloop
- insertimage
-
(and 1 more)
Tagged with:
-
Is this supposed to be getting from $sql2? $budget = mysql_fetch_array($sql1); am guessing should be this $budget = mysql_fetch_array($sql2);
-
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)
-
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
-
Why do so Many Beginners Use a lot of Bad Practices?
QuickOldCar replied to mogosselin's topic in Miscellaneous
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. -
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.....
-
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
-
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);
-
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.
-
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>"; }
-
get_file_contents returning too much data
QuickOldCar replied to MorphixNW's topic in PHP Coding Help
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. -
Reordering URL parameters to keep them consistent using PHP?
QuickOldCar replied to ddcphpf's topic in PHP Coding Help
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']; -
Reordering URL parameters to keep them consistent using PHP?
QuickOldCar replied to ddcphpf's topic in PHP Coding Help
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; } ?> -
That postman looks useful. Easier to read about it here. http://www.getpostman.com/
-
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.
-
Create a printer label with QRcode that links to a product page
QuickOldCar replied to pbucc's topic in PHP Coding Help
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/ -
how to find the elements to get it separate
QuickOldCar replied to mark107's topic in PHP Coding Help
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); -
Grab/scrape most relevant image from website
QuickOldCar replied to wannabe21's topic in PHP Coding Help
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