[Solved] Error: undefined variables

Now this is just a guess, but your $search might be empty. That would result in a query along the lines of “SELECT * FROM products WHERE product_keywords LIKE ””, returning 0 rows. The fix would be: <?php include(“includes/connect.php”); if(isset($_GET[‘sub’])){ $search = $_GET[‘search’]; if (isset($search)){ $query =”select * from products where product_keywords=”$search” “; $run=mysql_query($query); ?> … Read more

[Solved] Remove PHP extension from page naming function

try substr() echo “The current page name is “.substr(curPageName(),0,-4); will cut last four char from string and return remain string like:- echo substr(‘sdgfjsgdfj.php’,0,-4); //returns sdgfjsgdfj 0 = start of string, -4 = remove string from back limit substr ( string $string , int $start [, int $length ] ) so if you want remove .php … Read more

[Solved] How To Group and Sort Array element base Specific Character [closed]

You can use usort by string compare and the add prefix to each element with str_repeat Consider: $arr = array(“10”, “1001”,”12″, “1201”,”1002″, “1202”,”120101″, “120201”,”13″); usort($arr, “strcasecmp”); // sorting the array by string and not array function addPre($v) { $mul = strlen($v) / 2; // check the string size and divided by 2 as your example … Read more

[Solved] array sum in array php [closed]

Create a separate array then loop through the nested array and add them individually. If you cannot perform that then you shouldn’t be writing code in PHP 😉 solved array sum in array php [closed]

[Solved] “\u00e1n” to “á” in PHP [closed]

EDIT Now, I’ve figured out the correct, working answer based on the article I found. Here is it: function unicode2utf8($str) { $a=json_decode(str_replace(“\n”,”<br>”,'[“‘.$str.'”]’)); return str_replace(“<br>”,”\n”,$a[0]); } PHP: echo unicode2utf8(“Tom\u00e1nsson\n Eriksen\n Gilverto\n”); Output: Tománsson Eriksen Gilverto ORIGINAL I’ve found an article about the same problem here ( http://www.welefen.com/php-unicode-to-utf8.html ) The solution is the following function function unicode2utf8($str){ … Read more

[Solved] Database with hierarchy and joins [closed]

Your SQL should look like this: SELECT Breed.Breed, Gender.Sex, Dog.Name FROM Dog JOIN Gender ON Dog.GenderID = Gender.ID JOIN Breed ON Gender.BreedID = Breed.ID WHERE Dog.ID = ‘YourDogIDHere’ And it would return the following: Breed | Sex   | Name ——–|——–|——- Collie | Male | Fluffy Collie | Female | Holey Edit: Edited to include breed and … Read more

[Solved] How to parse the below mentioned php file using JSON parsing in android [closed]

// try this way,hope this will help you… try{ JSONArray category = new JSONObject (jsonRespone).getJSONArray(“category”); for (int i=0;i<category.length();i++){ System.out.println(i+” Value Is :”+category.getJSONArray(i).getString(0)); } }catch (Throwable e){ e.printStackTrace(); } solved How to parse the below mentioned php file using JSON parsing in android [closed]

[Solved] Interview – how calculate the frequency of each word in a text file

An easy way to do this is to read the complete file in as a string with file_get_contents(), split it up on whitespace, and run the resulting array through array_count_values() $file = file_get_contents( ‘text_file.txt’); $array = preg_split( ‘/\s+/’, $file); $counts = array_count_values( $array); Done! However, this isn’t perfect, as punctuation can mess up your count. … Read more

[Solved] Dynamically created is not posting data [closed]

Your code to create dynamic input tags is not correct. Replace <?php echo ‘<input name=”; echo “mycol’.$c; echo ‘id=’; echo ‘mycol’.$c.’ />’ ?> With <?php echo ‘<input name=”mycol’.$c.'” id=”mycol’.$c.'” />’ ?> or <input name=”<?php echo ‘mycol’.$c?>” id=”<?php echo ‘mycol’.$c?>” /> 1 solved Dynamically created is not posting data [closed]

[Solved] How to mearge two json files? [closed]

Comparing your two files, this should be what you looking to do (providing you are wanting to run just the one file to output the JSON response). <?php if (empty($_GET[‘term’])) exit; $q = strtolower($_GET[“term”]); if (get_magic_quotes_gpc()) $q = stripslashes($q); $files = array(); foreach(glob(‘image/*.jpg*’, GLOB_BRACE) as $key=>$file) { $files[] = substr($file, 0, -4); } foreach(glob(‘image/*.txt*’, GLOB_BRACE) … Read more

[Solved] URL Redirect / URL Masking [closed]

Try creating .htaccess and putting the following in it: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^ICEEC$ viewjc.php?id=c5 [L] RewriteRule ^ICEEC/$ viewjc.php?id=c5 [L] </IfModule> Make sure that the viewjc.php is at the same directory as your .htaccess If you’re just trying to change URL address bar when someone visits particular page of your website, add this to … Read more