Loop through array for INSERT query parameters

So a INSERT query is like this: $stmt = $db->prepare("INSERT INTO table () VALUES ()"); I have an array here: $array = ['a', 'aa', 'aaa', 'b', 'bb', 'sds', 'asdf', 'sdfswe', 'sdvsd', 'sdasss', 'sbdss', 'sdfabwew', 'asdfavs', 'sdbweq', 'sdfbs',...
more »

2017-08-13 22:08 (1) Answers

Sub request in Laravel 5

I'm looking to do sub requests in my API, to other parts of my API. I have done this before in Symfony - but I'm not sure how to achieve this in Laravel. $url = route('some.route', ['param' => $val]); $request = Request::create($url, 'get', []); ...
more »

2017-08-13 21:08 (0) Answers

PDO::__construct (sqlite) try/catch use

Trying to use a try/catch block for a connection to a sqlite database I found that when a database connection couldn't be made, the database file was created. Checking here the following issue is reported : If 'example.db' does not exist, no exce...
more »

2017-08-13 21:08 (1) Answers

Empty message from facebook messenger bot

I followed the guide to build a facebook messenger bot from here but in my software I receive alway an empty response. here my bot code: define('PAGE_TOKEN',"xxx"); define('VERIFY_TOKEN',"xxx"); if(isset($_GET['hub_mode']) && isset(...
more »

2017-08-13 18:08 (1) Answers

Set PHP variable to MySQL wildcard '%'

I'm trying to query posts using PDO where the database column 'tags' = something. My problem is: I want my query to work even if there's no $_GET['tag'] request is set and here's my code. if (!isset($_GET['tag'])) { $tags = '%'; } else { $t...
more »

2017-08-13 18:08 (1) Answers

Email value not showing using POST method

I have this form in which there is only one field i.e. "Email id", so what I have to do is that when I entered the email id the email id must be split into two parts like user name and domain name and must be displayed in next form. So my problem is ...
more »

2017-08-13 17:08 (2) Answers

Insert with PDO messes up with values

I pass some values to a php file which then should insert the data into a MySQL Table using PDO. Here is the file: <?php function makeInsert($query, $paramArray){ include 'db.php'; try { $pdo = new PDO("mysql:hos...
more »

2017-08-13 13:08 (0) Answers

Encrypting and comparing hashes

Checked a lot of tutorials and guides about Encrypting and Hashing on StackOver and I do now understand the difference between both of them. Encryption when we need decryption. Hash when you don't (e.g: passwords). But my question today is, for gene...
more »

2017-08-13 12:08 (3) Answers

Cakephp hash extract parent_id null

Using array below i am trying to extract the id for vocabulary_id and null parent_id. Hash::extract(array, '{n}[vocabulary_id=9]') works Hash::extract(array, '{n}[vocabulary_id=9][parent_id=null') fails array( array( 'id' => 240,'parent_id' =>...
more »

2017-08-13 11:08 (0) Answers

which php uniquid generator?

I am confused on how and when to use a random generator for different cases and, it is getting more and more complicated for me. in spite of the uniqueness of mt_rand(); It is still said that it is not secure to use it for generating a random salt a...
more »

2017-08-12 20:08 (0) Answers

php compare two date not work

I'm in a problem that i need an help because after research i have not found a solution.. I have to compare two date in PHP, the date of now with the date from Database. Writing this: strtotime(Date("d/m/Y H:i")) Correct return the current timest...
more »

2017-08-12 19:08 (1) Answers

Laravel: Database - More "log collumn"

I want to add some other columns next to the created_at and updated_at columns, for example: deleted_at creator updater deleter The last three should be contain user.id. What is the better method? A. place it in the migration B. Edit the Bluep...
more »

2017-08-12 18:08 (1) Answers

PDO bindValue() is not working

The bindVlaue() is not giving me any result. here is my code. public function query($sql, $values = array()){ $this->_error = false; echo $sql . "<br />"; if($this->_query = $this->_pdo->prepare($sql)){ ...
more »

2017-08-12 17:08 (0) Answers

Laravel Cache - file_put_contents file not found

I have this really strange error that I'm struggling to figure out. I have a command that will cache the homepage. If I run cache:clear then command:updateCaches And then try and load the site it tells me file_put_contents(/home/sites/staff.habboc...
more »

2017-08-12 13:08 (2) Answers

phpmailer not redirecting to page

I am making a mail sending module on user approvals. The mail is being sent to multiple users on the checkbox values. The problem is once I am using the given code it sends mail to all the checked users and redirects to the page given but as a blank ...
more »

2017-08-12 08:08 (1) Answers