[Solved] Pyramid asterisk in PHP

[ad_1] You might want to check out some of the string functions: <?php for ($i = 5; $i > 0; $i–) { echo str_repeat(‘ ‘, 5 – $i).str_repeat(‘*’,$i).PHP_EOL; } for ($i = 5; $i > 0; $i–) { echo str_pad(str_repeat(‘*’,$i),5,’ ‘,STR_PAD_LEFT).PHP_EOL; } This runs on the command line, like so: php filename.php 0 [ad_2] solved … Read more

[Solved] Need to create column and add values (Date) to a that column SQL

[ad_1] If you need to update an existing table, check out this guide: http://www.w3schools.com/sql/sql_update.asp Edit: To update a table in SQL you would use a query that looks like this: UPDATE table_name SET column1=value1,column2=value2,… WHERE some_column=some_value; –This line is not necessary. –You can add this if you wish to only update certain rows –e.g WHERE … Read more

[Solved] php mapi extension [closed]

[ad_1] As far as I know this MAPI extension is part of the Zafara Community Edition. You need to download the package for your distro, or the source package. I’m not sure how compatible this is with stock PHP, see the requirements in their manual. [ad_2] solved php mapi extension [closed]

[Solved] Hide “index.php” from “www.blahblah.com/index.php”

[ad_1] create .htaccess file then copy the code below change ‘project_folder_name’ of the folder of your project if your project is in the root folder just put “https://stackoverflow.com/” <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /project_folder_name # Removes index.php from ExpressionEngine URLs RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] RewriteCond %{REQUEST_URI} !/system/.* [NC] RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] # Directs all … Read more

[Solved] filtering json data in php laravel

[ad_1] You can json_decode that json string and then use array_filter method to filter regions $regions = json_decode(‘{“regions”: [ { “id”: 1, “name”: “Region 1”, “state_id”: 1, “areas” :[ { “id”: 1, “name”: “area 1”, “region_id”: 1 },{ “id”: 2, “name”: “area 2”, “region_id”: 1 }] },{ “id”: 2, “name”: “Region 2”, “state_id”: 1, “areas” … Read more

[Solved] How to echo every var more than $var? [closed]

[ad_1] Using the variables into your example you can do this $i = 0; while ($i <= 3) { $varName=”var”.$i; if ($$varName > $var) { echo $$varName; } $i++; } But that is no right way to iterate over an array. There exists a million other ways to iterate over a bunch of variables and … Read more

[Solved] mysql update qty on complete order array [duplicate]

[ad_1] Probably best to do this as a single piece of SQL:- UPDATE stock a INNER JOIN order b ON a.part = b.part SET a.available = a.available – b.qty WHERE b.invoice` = ‘$order’ Watch out that you don’t just rerun this multiple times without some way of checking that an order hasn’t already been used … Read more

[Solved] Query database then email posts from where user is subbed to

[ad_1] I figured it out. Just use ob_start(), and loop through each user. Select the posts they’re subscribed to. Then inside the loop email it to each user. I used this query SELECT articles.* FROM articles INNER JOIN subscriptions ON articles.from_id = subscriptions.sub_to INNER JOIN users ON subscriptions.user_id = users.id WHERE users.email = :email 5 … Read more

[Solved] PHP exec command is not working with awk command [closed]

[ad_1] As I said in my answer to your previous question, you can fix this easily by using single quotes on the inside. PHP Code <?php $eff=40; $pos=34; $i = ‘hello’; $line=exec(“tail $i.dssp -n $eff | awk -F’ ‘ -v var=$pos ‘{if ($2==var) print FNR}'”); print “$line\n”; ?> Sample Input (hello.dssp): foobar 34 Sample Output: … Read more