[Solved] not scraping website with PHP [closed]

[ad_1] The reason why this isn’t working is because the actual website got a lot more between “Summary:” and the “<span class…” What you could try (that seems to work) is to change it into the simpler form: $contents=file_get_contents(“http://www.weather-forecast.com/locations/San-Francisco/forecasts/latest”); preg_match(‘/<span class=”phrase”>(.*?)<\/s/’, $contents,$matches); print_r($matches[0]); This will pick out more matches, but since we’re only interested in … Read more

[Solved] If statement inside While loop [closed]

[ad_1] You didn’t mention the exact error, but I can see a few: String literals must always have quote marks round them, and also you can’t open a PHP block inside another one, or echo inside an echo. Just close the php block before you start the HTML, and open it again afterwards for the … Read more

[Solved] How to use recursion to sum specific values in a multidimensional array?

[ad_1] Recursion doesn’t seem to be necessary for the “parent” direct values, so that can be done with a direct foreach loop. The “children” indirect values require recursion. I’ve elected to use array_walk_recursive() to access every “leaf node” in the array. This will also store the parents’ indirect values too, so I subtract those values … Read more

[Solved] Store bids in microtime [closed]

[ad_1] Assuming a MySQL database, why not simply have a TIMESTAMP column on your database: http://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html and leave MySQL to populate it for you 2 [ad_2] solved Store bids in microtime [closed]

[Solved] Update table, but make a new updated table? [closed]

[ad_1] your code mysql_query(“UPDATE prestataire SET (login=’$a’, passe=”$b” , email=”$c”,nom=’$d’, prenom=’$e’, adresse=”$f”, ville=”$g”, tel=”$h” )WHERE login = ‘$a’ )”); try like this $sql = “UPDATE prestataire SET (login=’$a’, passe=”$b” , email=”$c”,nom=’$d’, prenom=’$e’, adresse=”$f”, ville=”$g”, tel=”$h” )”; $request = mysql_query($sql); better way $sql = “UPDATE prestataire SET passe=”$b” , email=”$c”,nom=’$d’, prenom=’$e’, adresse=”$f”, ville=”$g”, tel=”$h” WHERE login=’$a'”; … Read more

[Solved] PHP switch trouble [closed]

[ad_1] the expression ($item>=17) && ($item<=20) evaluates to 0, as the value of $item is 0. the switch-case statement will merely match the value of $item with case values. So, your code, in first case is equivalent to switch($item){ case (1): $case=”<16″; break; case ( 0): $case=”>=17_<=20″; break; case ( 0): $case=”>=21_<=25″; break; } 0 … Read more

[Solved] How to properly enable/disable input boxes when a specific checkbox is checked/unchecked? [closed]

[ad_1] Instead of this in your html: onclick=”javascript:Mon_Select()” just do this: onclick=”Mon_Select()” The first one isn’t valid js code (only works in urls), the second one works. EDIT Also, remove your id attributes from your <labels> as sanjeev suggests Hope this helps, cheers 6 [ad_2] solved How to properly enable/disable input boxes when a specific … Read more

[Solved] Image uploader and slider

[ad_1] You are echoing the <img> tags into the slider <div id=”slider”>. They are all inside that div, and displayed. You could add a style to initially hide them and then have your jquery loop show them one by one. Also, you probably want to increase the id on each iteration. Something like: $i = … Read more

[Solved] php convert mulitdimentional array

[ad_1] One option is to use array_reduce to group the array into an associative array and use subjectId as the key. Use array_values to convert the associative array into a simple array. $result = array_reduce($arr, function($c, $v){ if ( !isset( $c[$v[‘subjectId’]] ) ) $c[$v[‘subjectId’]] = array( ‘subjectId’=> $v[‘subjectId’], ‘subjectName’ => $v[‘subjectName’], ‘chapters’ => array() ); … Read more

[Solved] All the div content changing when clicking only one div in the foreach loop

[ad_1] I have checked your question and it seems to be working fine at my PC. I would appreciate if you can share browser information for further investigation. Meanwhile, I am sharing the code which is working perfectly. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <title> New Document </title> <meta name=”Generator” content=”EditPlus”> … Read more

[Solved] Regular expression to remove text + int [closed]

[ad_1] You should use preg_replace function. Example: $str=”var=104&anothervar=10&page=14&name=stack”; $str = preg_replace(‘/&?page=\d+&?/’, ”, $str); echo $str; &page=\d+? [&]? means 0 or 1 occurence of & character. (in case it was first parametr ampersand with no ampresand in the begining) \d+? means at least 1 or more number after = Output: var=104&anothervar=104&name=stack 9 [ad_2] solved Regular expression … Read more

[Solved] Could someone explain this php mysql script? [closed]

[ad_1] This question does not really belong here, but I’ll answer it for the sake of closing the question without bothering moderators. // mysql query is executed $images = mysql_query(“Select URL from images where Category = ‘Management’ “); // empty array initialized $imagerow = Array(); // while there are results of the executed mysql query … Read more