[Solved] Avoid data redundancy in a friends table

[ad_1] Add field friendship_key: ALTER TABLE t_friend ADD friendship_key decimal(22,11); CREATE UNIQUE INDEX friendship_key_unique ON t_friend (friendship_key); And php part: $friends = [$userId, $friendId]; $key = min($friends).’.’.max($friends); $q = “SELECT * FROM t_friend WHERE friendship_key = “.$key; insert: $friends = [$userId, $friendId]; $key = min($friends).’.’.max($friends); $q = “INSERT INTO t_friend (friendship_key, userId, friendId) VALUES (“.implode(‘,’, … Read more

[Solved] Set a unique URL for each user profile

[ad_1] This isn’t really a PHP question. You’ll need to use a .htaccess file (if you’re using an Apache server) or equivalent. You’ll need to add a line, something like the following: RewriteRule ^([a-z]+)$ docname.php?u=$1 [ad_2] solved Set a unique URL for each user profile

[Solved] How To Display Images Preview and Title When I Paste in Another Site Like Facebook, Whatsapp, etc

[ad_1] Your site isn’t using meta tags. which is basically looks like this. <meta property=”og:title” content=”Title”> <meta property=”og:description” content=”Description”> <meta property=”og:image” content=”http://example.com/thumbnail.jpg”> <meta property=”og:url” content=”http://example.com/index.htm”> Google about meta for learn in details and how to use. 0 [ad_2] solved How To Display Images Preview and Title When I Paste in Another Site Like Facebook, Whatsapp, … Read more

[Solved] Retrieve image long raw datatype stored in oracle database in php

[ad_1] I’m using this same functionality in one of my project, please check my code below you can either make a page that will render the image <img src=”https://stackoverflow.com/questions/50098121/image.php?id=123″ /> That image.php page would have this: $sql = “SELECT image FROM images WHERE image_id = ” . (int) $_GET[‘id’]; $stid = oci_parse($conn, $sql); oci_execute($stid); $row … Read more

[Solved] DO customize PHP Array?

[ad_1] Two changes: foreach($original as $value) { if(substr($value,0,2) == “03”) { // CHANGE 1 $save = $value; ++$r;//inc parent $j = 0; // child $move_level[$r][$j] =$value; } else { if (($j % 4) > 0) $value .= $value; // CHANGE 2 else if ($j && $j % 4 == 0) $value = $save.$value; $move_level[$r][floor($j / … Read more

[Solved] Return all values from a PHP array for a given key

[ad_1] You can try making a 2d array so something like $newarray = [ “a” => [‘red’,’pink’,’maroon’], “b” => [‘green’], “c” => [‘blue’] ]; Then you can access the values like this: $newarray[‘a’] Which will return an array containing red pink and maroon 1 [ad_2] solved Return all values from a PHP array for a … Read more

[Solved] sql stores text string as “Array”

[ad_1] It’s normal. When you do : $codering = [‘RF-013.12’]; Is same as : $codering = array(‘RF-013.12’); So if you try to use your array like string, php write array instead. If you wanna store [something] (a string with [] character) you need : $codering = “[something]”; If you realy need to store an array, … Read more

[Solved] Checkbox and radiobutton won’t show

[ad_1] You have set opacity: 0 for checkboxes and radio buttons in main.css. Remove it and they will appear in your page. opacity sets the transparency of an element. Therefore opacity: 1 means no transparency while opacity: 0 means element having full transparency (invisible on the page). input[type=”checkbox”], input[type=”radio”] { -moz-appearance: none; -ms-appearance: none; appearance: … Read more