• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
[QUOTE=Banana Lord.;45778390]Meaning I should or shouldn't report it?[/QUOTE] Create a throw away email or something and send it from a Starbucks.
Well, that's not very useful.
[QUOTE=Ehmmett;45792026]nvm not solvedwtf[/QUOTE] So post the question again? Also no need to snip it away once solved that way we can't go back and find it if we ever encounter the same thing.
I don't get how this code works: [CODE]while($row = mysqli_fetch_array($result)) { echo $row['FirstName'] . " " . $row['LastName']; echo "<br>"; }[/CODE] It will display all rows in a database but I don't understand how it works as you're not feeding it any array selector on each repetition of the loop? unless this is some special function with array which makes them display in loops. Please explain so I can understand this?
[QUOTE=smidge146;45798090]I don't get how this code works: [CODE]while($row = mysqli_fetch_array($result)) { echo $row['FirstName'] . " " . $row['LastName']; echo "<br>"; }[/CODE] It will display all rows in a database but I don't understand how it works as you're not feeding it any array selector on each repetition of the loop? unless this is some special function with array which makes them display in loops. Please explain so I can understand this?[/QUOTE] mysqli_fetch_array returns the next row of the result set of the query. So if your select was something like SELECT * FROM `Persons`, if you call it 10 times it will display the first 10 rows of the result. [code]while($row = mysqli_fetch_array($result)) {[/code] Basically this says "Grab the next row, save it in $row, and do something with it in the while loop. If the next row is null, exit the loop". Hope this clarifies it a bit.
[QUOTE=Ehmmett;45797689]its just me being dumb. I dont get how php tables really work. I've got a table of keys of IDs and values of strings and I can't for the life of me work with it. [editline]25th August 2014[/editline] at the moment I'm trying to get [code]echo array_key_exists($id,$arr) . "</br>";[/code] to work but it prints nothing at all. [editline]25th August 2014[/editline] [code]Array ( [208104] => success [1] => test [208105] => qwertyuiop [208106] => asdfghjkl [2081047] => zxcvbnm )[/code] if the array looks like that why doesn't $arr['208104'] work?[/QUOTE] Because it's trying to find a key with the string '208104', instead of the key with the integer 208104. If you remove the quotes, you'll find it works.
[URL="http://viper-7.com/tWv0Aq"]...Well, can't replicate.[/URL] Working just as intended here.
-snip- 30minutes late. I should refresh next time :v:
Can someone please explain how Laravel works? I have it and composer installed. I'm just not seeing how this works. When I ran [b]laravel new manage[/b], it made a new folder called manage. Inside of that it looks like it has files/folders that shouldn't ever be inside the public web folder, and then a public folder which should be. Is it not possible to set up Laravel in a directory under the root? My intention is to run a Laravel site located at mysite.com/utilities/manage but clearly I've missed something somewhere and however I installed it won't let me do that. Usually these things don't give me trouble :v:
[QUOTE=Ehmmett;45799759]fp won't let me edit but; funnily enough [code]if( hasKey($arr,$id) ){echo $arr[$id];}else{echo "nop";}[/code] will return properly but the [code]echo $arr[$id];[/code] part of it still won't do anything.[/QUOTE] Are you sure you're casting it as an integer? When it's parsed from JSON it will definitely set the key to an int. Try $arr[intval($id)]
try changing the json_decode to ($db, true)
By the way, PHP has a native version of your hasKey method called [url=http://php.net/manual/en/function.array-key-exists.php]array_key_exists[/url] [editline]25th August 2014[/editline] Whoopsie, automerge noes
Apologies, I only glanced at your code
[QUOTE=Banana Lord.;45799639]Can someone please explain how Laravel works? I have it and composer installed. I'm just not seeing how this works. When I ran [b]laravel new manage[/b], it made a new folder called manage. Inside of that it looks like it has files/folders that shouldn't ever be inside the public web folder, and then a public folder which should be. Is it not possible to set up Laravel in a directory under the root? My intention is to run a Laravel site located at mysite.com/utilities/manage but clearly I've missed something somewhere and however I installed it won't let me do that. Usually these things don't give me trouble :v:[/QUOTE] Can you show the file structure that you mean should never be there? I install Laravel via composer and then it's just a matter of moving it to where you want it and set up the rewrite rules correctly.
[QUOTE=Banana Lord.;45799639]Can someone please explain how Laravel works? I have it and composer installed. I'm just not seeing how this works. When I ran [b]laravel new manage[/b], it made a new folder called manage. Inside of that it looks like it has files/folders that shouldn't ever be inside the public web folder, and then a public folder which should be. Is it not possible to set up Laravel in a directory under the root? My intention is to run a Laravel site located at mysite.com/utilities/manage but clearly I've missed something somewhere and however I installed it won't let me do that. Usually these things don't give me trouble :v:[/QUOTE] You might end up bashing your head on the table for a while like I did, but the [URL="http://laravel.com/docs/quick#installation"]official documentation[/URL] helps. [URL="http://laravelbook.com/laravel-architecture/"]Laravel Book[/URL] explains Laravel's architecture much better than I can. Good luck.
[QUOTE=Moofy;45802542]Can you show the file structure that you mean should never be there? I install Laravel via composer and then it's just a matter of moving it to where you want it and set up the rewrite rules correctly.[/QUOTE] I feel like an idiot now, for years I've yelled at people for asking for help without providing useful information. Sorry! [t]http://i.imgur.com/Kl5kM1e.png[/t] The goal is that I have my site running at [url]http://mysite.com[/url] and I want a laravel site at [url]http://mysite.com/utilities/manage/[/url]. From the way it's setting it up, it looks like it needs to be at the root of the domain, so only the public folder is publicly accessible [editline]26th August 2014[/editline] [QUOTE=Doggvir;45803939]You might end up bashing your head on the table for a while like I did, but the [URL="http://laravel.com/docs/quick#installation"]official documentation[/URL] helps. [URL="http://laravelbook.com/laravel-architecture/"]Laravel Book[/URL] explains Laravel's architecture much better than I can. Good luck.[/QUOTE] I was following the quick installation, but thanks! And thanks for the architecture page, very useful
[QUOTE=Banana Lord.;45804703]I feel like an idiot now, for years I've yelled at people for asking for help without providing useful information. Sorry! [t]http://i.imgur.com/Kl5kM1e.png[/t] The goal is that I have my site running at [url]http://mysite.com[/url] and I want a laravel site at [url]http://mysite.com/utilities/manage/[/url]. From the way it's setting it up, it looks like it needs to be at the root of the domain, so only the public folder is publicly accessible [editline]26th August 2014[/editline] I was following the quick installation, but thanks! And thanks for the architecture page, very useful[/QUOTE] You could always use softlinks for that. [code]sudo ln -s /home/bananatree/manage/public /usr/share/nginx/www/mysite/utilities/manage[/code] (Don't forget to set appropriate permissions and change whatever directives your server uses) If you don't want to use a softlink, you can use nginx's [URL="http://nginx.org/en/docs/http/ngx_http_core_module.html#alias"]alias[/URL] module. If you use Apache, alias exists there too. The end result is the same though.
Is there no way around that then? I don't like using symbolic links like that. Plus, my public http directory is in the user's home directory
[QUOTE=Banana Lord.;45805597]Is there no way around that then? I don't like using symbolic links like that.[/QUOTE] And why do you not like using symlinks [I]like that?[/I] The default phpMyAdmin installation requires a symlink or alias, why can't this?. Whatever reason you have, a symlink or using the alias module would be the best and most definitely easiest way. [QUOTE=Banana Lord.;45805597]Plus, my public http directory is in the user's home directory[/QUOTE] Which was why I said [quote]change whatever directives your server uses[/quote]
[QUOTE=Banana Lord.;45805597]Is there no way around that then? I don't like using symbolic links like that. Plus, my public http directory is in the user's home directory[/QUOTE] Symlinks are great for stuff like this though
I don't know if this is the correct place but I need some help. I currently have a Raspberry Pi running Raspbian. I'm using Samba to create shares which works perfectly fine over the local network. I am attempting to make it accessible from anywhere and the first stage was getting my friend to be able to ping it. I got the external IP and then I looked around online and opened ports which could potentially work but no luck at all, so I ended up DMZing it. My friend can now ping it but by typing in \\THE-IP-HERE\public he is unable to connect. Anyone have any ideas? Thanks for any help you can give.
[QUOTE=Banana Lord.;45805597]Is there no way around that then? I don't like using symbolic links like that. Plus, my public http directory is in the user's home directory[/QUOTE] Although the symlink [i]is[/i] better, you could do this: [php] // routes.php Route::group(array('prefix' => 'utilities/manage'), function() { Route::get('index', function() { // }); }); [/php] That will prefix all the routes within the group with "utilities/manage" so you get what you want. But if you're sure there won't be anything outside that directory, the symlink is better.
What exactly is the difference between filter_var()/filter_input() and htmlspecialchars()/htmlentities() in PHP? When should one be used and not the other?
[QUOTE=Cakebatyr;45859409]What exactly is the difference between filter_var()/filter_input() and htmlspecialchars()/htmlentities() in PHP? When should one be used and not the other?[/QUOTE] An example could be that filter_var you can apply different types of filters, for example using [B]FILTER_SANITIZE_FULL_SPECIAL_CHARS[/B] is the same as htmlspecialchars() with ENT_QUOTES as stated in the [URL="http://php.net/manual/en/filter.filters.sanitize.php"]PHP docs[/URL]. "[I]Equivalent to calling htmlspecialchars() with ENT_QUOTES set.[/I]" I can't really smart myself on what to use where, I just normally read the docs page and see if it does what I need.
I'm wanting to use highcharts.js to display a graph of people connecting to a minecraft server, this server is running on debian with a screen attached; is there a way to automatically grab specific text from a screen and add it to a database to be used later? Thanks.
[QUOTE=Nectarine;45859863]I'm wanting to use highcharts.js to display a graph of people connecting to a minecraft server, this server is running on debian with a screen attached; is there a way to automatically grab specific text from a screen and add it to a database to be used later? Thanks.[/QUOTE] Catch the STDOUT from the Java process running the Minecraft server, then regex for the text you need.
I'm trying to make a colormatrix that makes pure black alpha while preserving the alpha channel, any help? i have no idea what im doing edit: i instead multiplied all colors by 255 so that only pure black remained and the rest was white and ran it through a luminance to alpha filter
Can anyone tell me whether it's a noob pathetic thing to do to use a bootstrap theme and run my site off that? I just suck with design. I know CSS just shit with it. Is it dumb to run an entire site off it, like a review site?
[QUOTE=Erasus;45863311]Can anyone tell me whether it's a noob pathetic thing to do to use a bootstrap theme and run my site off that? I just suck with design. I know CSS just shit with it. Is it dumb to run an entire site off it, like a review site?[/QUOTE] Bootstrap is [I]really[/I] simple to work with, so atleast try to customize it.
I have been learning PHP,Python and JavaScript on Codeacademy, and really would like suggestions for a good framework to start experimenting with. One of my friends recommended CakePHP and Django, but if there are better or easier frameworks to get started with I would love to hear about them. Thanks!
Sorry, you need to Log In to post a reply to this thread.