256 Kilobytes

All Content > PHP

Type All Category All Tag PHPPHP: Hypertext Preprocessor is a scripting language used heavily in server-side development. PHP is frequently used for templating.

Profile Photo - Some Guy
Profile Photo - Some Guy

MoreHi! I'm just getting used to writing PHP scripts, and I was wondering if anyone knew whether or not it was possible to skip some optional paramet...
🗨 0
🐏 0
👁 254
Profile Photo - Some Guy
Profile Photo - Some Guy

MoreI have just started working on my company's server and have a question for you guys. Using PHP, is it possible to call a method on a new object i...
🗨 0
🐏 0
👁 248
Profile Photo - Some Guy

How to graph a parabola using JavaScript and/or PHP?

Answers in Server-Side | By Some Guy

Published

Profile Photo - Some Guy

MoreI am working on a project and I am unsure of the software I will be using. I need to graph a parabola using JavaScript and/or PHP. Could anyone show m...
🗨 0
🐏 0
👁 269
Profile Photo - Some Guy

[PHP] Add leading zero to hexadecimal if not there?

Answers in Server-Side | By Some Guy

Published

Profile Photo - Some Guy

MoreHi, I am intern at a computer technician at my local computer store. I am working a server because we have ran into particular problem with out server...
🗨 0
🐏 0
👁 218
Profile Photo - Some Guy
Profile Photo - Some Guy

MoreI just started working on the Server-Side of things and am pretty new at this and would like some help. Anyone have experience with "base64_encod...
🗨 0
🐏 0
👁 287
Profile Photo - Some Guy
Profile Photo - Some Guy

MoreI received an error that states "imagecreatefromstring(): Data is not in a recognized format." How do I correct this error?
🗨 0
🐏 0
👁 400
Profile Photo - Some Guy
Profile Photo - Some Guy

MoreAny web developers out there? Have a quick question for you if you have a moment to spare. What's the fix for "preg_replace_callback(): Requ...
🗨 0
🐏 0
👁 294
Profile Photo - Some Guy

What is "mysqli_fetch_array"?

Answers in Server-Side | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyThe mysqli_fetch_array function that is part of PHP's MySQLi library, which is a PHP library designed be used to interact with MySQL (and Mar... August R. Garcia,

The mysqli_fetch_array fu...

Sat, 22 Dec 2018 07:57:07 -08002 years ago1
🗨 1
🐏 0
👁 359
Profile Photo - Some Guy

Solve "Column count doesn't match value count at row 1"?

Answers in Databases | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyThis error can occur if you are missing If your insert statement does not specify the number of columns correct. Example of incorrect statement:... August R. Garcia,

This error can occur if y...

Thu, 20 Dec 2018 01:18:24 -08002 years ago1
🗨 1
🐏 0
👁 355
Profile Photo - Some Guy

How do I fix "Invalid argument supplied for foreach()"?

Answers in Server-Side | By Some Guy

Published | Last Update

Profile Photo - Hash Brown

Last ReplyHello, You need to use count() and is_array() to make sure your data is actually an array and it's not empty. The submit value is causing th... Hash Brown,

Hello,

Wed, 19 Dec 2018 08:46:44 -08002 years ago1
🗨 1
🐏 0
👁 328
Profile Photo - Some Guy

What is "mysqli_fetch_assoc"?

Answers in Databases | By Some Guy

Published

Profile Photo - Hash Brown

Last ReplyHello, Firstly and most importantly, mysqli is dead. It's very easy to mess up and ship code with security issues. You should look at PDO (PHP... Hash Brown,

Hello,

Wed, 19 Dec 2018 08:19:40 -08002 years ago1
🗨 1
🐏 0
👁 366
Profile Photo - Some Guy
Profile Photo - Some Guy

I'm getting tossed an error that sa...

MoreI'm getting tossed an error that says "Fatal Error: call to undefined function mysql_connect()". Can somebody tell me how to solve this...
🗨 0
🐏 0
👁 349
Profile Photo - Some Guy

What is "mysqli_real_escape_string" in PHP?

Answers in Databases | By Some Guy

Published

Profile Photo - Some Guy

I'm writing a program for a class p...

MoreI'm writing a program for a class project. I'm writing PHP for the program and I can figure out a code. I don't know what "mysqli_...
🗨 0
🐏 0
👁 361
Profile Photo - Some Guy

Fix "The CSRF token is invalid. Please try to resubmit the form"?

Answers in Server-Side | By Some Guy

Published

Profile Photo - Some Guy

I am using a program for my job, and I a...

MoreI am using a program for my job, and I am getting a error repeatedly saying, "The CSRF token is invalid. Please try to resubmit the form". I...
🗨 0
🐏 0
👁 356
Profile Photo - Some Guy

How to determine IP location without using an API?

Answers in Server-Side | By Some Guy

Published | Last Update

Profile Photo - Hash Brown

Last ReplyFor scalability you're probably better off asking for users permission and using HTML Geolocation and using the API as a fall back for those that... Hash Brown,

For scalability you'r...

Mon, 03 Dec 2018 14:45:33 -08002 years ago1
🗨 1
🐏 0
👁 312
Profile Photo - Some Guy
Profile Photo - Hash Brown

Last ReplyThere is a function called scandir. <?php $directory = '/path/to/directory'; scandir($directory); ?> This will output your directory... Hash Brown,

There is a function calle...

Mon, 03 Dec 2018 12:54:16 -08002 years ago1
🗨 1
🐏 0
👁 326
Profile Photo - Some Guy
Profile Photo - August R. Garcia

Last ReplyAre you using the Blade templating engine? When you use the double curly brace syntax to insert content, it uses the PHP htmlspecialchars() functio... August R. Garcia,

Are you using the Blade t...

Sun, 02 Dec 2018 03:49:45 -08002 years ago1
🗨 1
🐏 0
👁 670
Profile Photo - Some Guy
Profile Photo - August R. Garcia

Last ReplyDepends on what "best" means to you. Pulled this function from a recent project. Generates array of a length between 2 and 10. Adjust as... August R. Garcia,

Depends on what "bes...

Sun, 02 Dec 2018 03:48:58 -08002 years ago1
🗨 1
🐏 0
👁 311
Profile Photo - Some Guy

[Laravel] If not on a certain page redirect to that page?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplySomething along these lines should work for your purposes:if (Request::path() != "posts/some-post") return redirect('/posts/some-post&... August R. Garcia,

Something along these lin...

Sun, 02 Dec 2018 03:48:42 -08002 years ago1
🗨 1
🐏 0
👁 314
Profile Photo - Some Guy

[PHP]/JS] Pass a PHP array to a JavaScript function?

Answers in Server-Side | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyThe json_encode() function can do this. Ex:<script> insert_chart( 'pie_users_by_account_type' , <?= json_encode($arr); ?>, &#03... August R. Garcia,

The json_encode() functio...

Sun, 02 Dec 2018 03:48:41 -08002 years ago1
🗨 1
🐏 0
👁 339
Profile Photo - Some Guy

In web.PHP line 23: The use statement with non-compound name 'Request' has no effect

Answers in Frameworks | By Some Guy

Published | Last Update

Profile Photo - August R. Garcia

Last ReplyThis is a bug that I ran into while testing a few things in the routes/web.PHP file. I had included the line: <?php use Request; While--... August R. Garcia,

This is a bug that I ran...

Sun, 02 Dec 2018 03:48:35 -08002 years ago1
🗨 1
🐏 0
👁 336
Profile Photo - Some Guy

How to get the first 20 words from a string in Laravel?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyThe function you're looking for is str_limit(). https://Laravel-news.com/str_limit https://Laravel.com/docs/5.7/helpers#method-str-limit... August R. Garcia,

The function you're l...

Sun, 02 Dec 2018 03:48:30 -08002 years ago1
🗨 1
🐏 0
👁 317
Profile Photo - Some Guy

Does PHP have a shorthand for IF statements?

Answers in Server-Side | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyYes. Example: <?php $t = ($user->is_staff) ? $user->name : FALSE; Should be covered in the PHP documentation: http://PHP.net/... August R. Garcia,

Yes. Example:

Sun, 02 Dec 2018 03:48:25 -08002 years ago1
🗨 1
🐏 0
👁 275
Profile Photo - Some Guy

Can you unset a variable in PHP?

Answers in Server-Side | By Some Guy

Published | Last Update

Profile Photo - August R. Garcia

Last ReplyYes, you can unset a variable. The PHP function is actually called unset: http://PHP.net/manual/en/function.unset.PHP August R. Garcia,

Yes, you can unset a vari...

Sun, 02 Dec 2018 03:48:01 -08002 years ago1
🗨 1
🐏 0
👁 313
Profile Photo - Some Guy

How to get random pivot table values with Laravel seeders?

Answers in Frameworks | By Some Guy

Published | Last Update

Profile Photo - August R. Garcia

Last ReplyThe 'sync' method solves for the issue with duplicates causing errors. A piece of code similar to this is relatively concise and works for gen... August R. Garcia,

The 'sync' method...

Sun, 02 Dec 2018 03:47:58 -08002 years ago1
🗨 1
🐏 0
👁 351
Profile Photo - Some Guy

Laravel - Where to store utility functions?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyIf you're writing utility functions that are used for all/many of your controlelrs, you might consider defining them in the/a parent controller&#... August R. Garcia,

If you're writing ut...

Sun, 02 Dec 2018 03:47:49 -08002 years ago1
🗨 1
🐏 0
👁 279
Profile Photo - Some Guy

Can Laravel's Faker library get random IP addresses?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last Reply~~The easiest way to get a random IP address when working with Laravel (or the Faker library in general) is to use the PHP function long2ip: long2ip(... August R. Garcia,

~~The easiest way to get...

Sun, 02 Dec 2018 03:47:14 -08002 years ago1
🗨 1
🐏 0
👁 404
Profile Photo - Some Guy

PHP function to fix (or remove) unmatched tags?

Answers in Server-Side | By Some Guy

Published

Profile Photo - August R. Garcia

Last Reply[]Have seen some others recommend the HTML Purifier library, which seems to be able to do this as well as other similar input validation. You can find... August R. Garcia,

[]Have seen some others r...

Sun, 02 Dec 2018 03:47:07 -08002 years ago1
🗨 1
🐏 0
👁 298
Profile Photo - Some Guy

What is the term used to refer to a double colon in PHP?

Answers in Server-Side | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyThe scope resolution operator.Or, apparently "Paamayim Nekudotayim"Docs:http://PHP.net/manual/en/language.oop5.paamayim-nekudotayim.PHP August R. Garcia,

The scope resolution oper...

Sun, 02 Dec 2018 03:46:58 -08002 years ago1
🗨 1
🐏 0
👁 327
Profile Photo - Some Guy
Profile Photo - August R. Garcia

Last ReplyRan into the same error when setting up a site on Dreamhost hosting. Ran 'PHP artisan migrate' from SSH.Issue was that evne though PHP versi... August R. Garcia,

Ran into the same error w...

Sun, 02 Dec 2018 03:46:35 -08002 years ago1
🗨 1
🐏 0
👁 966