w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » PHP » Page 5
PHP ZF2 - multiple sites with separate public folders
You can have as many public folder as you want. Just put in index.php valid include of zf2 core and everything should work without any special modifications (what module to display can be specified by domain path or via global configuration you will put inside index.php). Still I think is perfectly fine to have one public folder and change active modul per domain, also use some asset manager with

Categories : PHP

Laravel:how can I pass a variable from a controller to another?
There are many ways to share variables across controllers: If you share variables across views just like you did, simple use the variable $milite in other controllers. It should be just fine. You may define a static variable in your base class so that the variable could be used among all classes that extend base class. In the constructor of AgendaController, just pass firefighters'agenda as a pa

Categories : PHP

bindParam with foreach strange results
You are missing the data type , Correct format for PDOStatement::bindParam, should be like this $sth->bindParam(':calories', $calories, PDO::PARAM_INT); //note PDO::PARAM_INT here EG, $sql = "INSERT INTO movies(filmName, filmDescription, filmImage, filmPrice, filmReview) VALUES ( :filmName, :filmDescription,

Categories : PHP

Laravel using WHERE in eloquent ORM
I may be wrong. I was un-aware of magic query builder setup. That is a custom query scope. IE: A post model with a query scope to get all posts with 'status' = published. class Post extends Eloquent { /** * Get all posts with 'status' published * * @param IlluminateDatabaseQueryBuilder $query * @return Builder $query */ public function scopePublished(Builder $q

Categories : PHP

Htaccess redirect query string + force redirect
You can use this rule that will support query parameters in any order: RewriteEngine On RewriteBase / RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{QUERY_STRING} (?:^|&)lang=([^&]*) RewriteCond %1::%{QUERY_STRING} (.*?)::(?:|.*&)p=([^&]*) RewriteRule ^(index.php)?$ /%1/%2? [L,NC,R=302] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z]+)/(w+)/?$ index.php?lang=$1&

Categories : PHP

Plugin for editable table list
You can try with this one: http://www.datatables.net/ If you could have more specifications please update your question and I'll be glad to update this answer.

Categories : PHP

How to customize comment functionality in wordpress?
Are you try to automatically approve every comment without moderating them? If so just uncheck the following settings under Settings > Discussion Comment must be manually approved Comment author must have a previously approved comment

Categories : PHP

Getting Fatal Error: Call to undefined method
You execute the function get_user_function instead of using the variable $get_user_function. Change: $query = $this->Users_model->get_user_function($login); Into: $query = $this->Users_model->$get_user_function($login);

Categories : PHP

Custom template for OpenCart
You could create an information page via Admin > Catalog > Information. However, you wouldn't be able to include any PHP. To create a new template you need to add a few files to your project. OpenCart is based on MVC architecture. If you aren't familiar with MVC visit this page. http://docs.opencart.com/introduction-to-mvc-l Controller: Create a file named calculator.php and add it to catalog

Categories : PHP

Unexpected token D
Thats not a JSON String. You should inform about JSON http://en.wikipedia.org/wiki/JSON Return a JSON string from your server. With PHP you can use json_encode to encode an array to a json string.

Categories : PHP

how to pass php value as parameter in anchor tag href
Just change: echo "<td align=center width=100><a href='client_details.php?id=".echo $id."'>Edit</a></td><td><a href=''>Delete</a></td>"; To: echo "<td align=center width=100><a href='client_details.php?id=".$id."'>Edit</a></td><td><a href=''>Delete</a></td>"; Because you already used the echo. You

Categories : PHP

Line break not working when concatenating strings
will only be visible in the source as a newline. Use <br /> in stead, or use nl2br() on your $row ['technischgereed'] when echoing it out to convert your newline characters to <br />.

Categories : PHP

PHP Form with only E-mail field won't send, while full form works fine
No 2 fields in the same page should have the same name and id. Try giving full url for form action attribute,ie with site url ex site_url/page. <fieldset> <form class="subscriptionForm" method="post" action="mail.php"> <input name="email" id="subscriptionForm" class="inputForm" type="text" value="Your Email" onFocus="if (this.value=='Your E

Categories : PHP

Eloquent Object - Method Chaining
A simple way around: I compare my primary key to something non-existing (not an OPTIMAL solution), would be interested to see the other solutions, though I thought this could help: $foo = EloquentFoo::where('id','!=','0'); // id is the primary key and there is no row with value 0 // so basically above I am searching everything // Perform Chaining Operation if(true) { $foo->whereHas('eloqu

Categories : PHP

Php File_exists not working properly
Use, the exact physical path for the file. For that, use following: $_SERVER['DOCUMENT_ROOT']; And using this, get the exact path: e.g. $pictodelete = $_SERVER['DOCUMENT_ROOT'] . "/Images/" . $id_to_delete.".jpg"; Hope this works.

Categories : PHP

Returning the string after manipulating html by DOMDocument
You have to filter post_content with content_save_pre as function replace_content_image($page) { if($page->ID == 7){ $image = wp_get_attachment_image_src( get_post_thumbnail_id(7), 'single-post-thumbnail' ); $dom = new DOMDocument(); @$dom->loadHTML($page->post_content); $imgs = $dom->getElementsByTagName("img");

Categories : PHP

Call to a member function whereHas() on a non-object in laravel
$usersCount is already a number from the 1st line of your sample. You want instead to replace $usersCount->whereHas with User::whereHas in your foreach loop.

Categories : PHP

Why isset and not empty doesn't work in this Solarium object iteration
Because those properties are existent, but filled with an empty string or null... so isset() is always true for them... if you are not 100% sure, that they are always there, you could combine both checks (isset($result->title) && $result->title). The alternative would be something like (isset($result->title) && !empty($result->title)), which should work too

Categories : PHP

What is the correct way to store, increment and reuse an index
The best way to do this is to have three tables: Surveys Questions Answers Surveys would probably have a survey ID, user that created the survey, so on. Questions would have a question ID, the survey ID that the question is for, and what the question is asking. Lastly, Answers would have the answers to the questions, most likely having an answer ID, question ID, user who answered it and their

Categories : PHP

getting distance between multiple waypoints using php
Are you looking for a way in js or php?! In JS you can use gmap APIs: var meters = parseFloat(google.maps.geometry.spherical.computeLength (latlngcollectionArray); PS: remember to include library <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false& libraries=geometry"></script>

Categories : PHP

mapping of list with that particular data in the list
That's correct, this code will create a seperate div for each image. You need to put the div declaration out of the foreach loop. Try this: <?php $galleries = array(); foreach($res as $galleryImage) { $galleries[$galleryImage->gallery_id][] = $galleryImage->->gallery_image_url; } foreach($galleries as $galleryId => $galleryImages) {

Categories : PHP

Zend Framework 1 pass parameters using get to the route
With the GET method a form generates an url like this: action?param1=val1&param2=val2&.... I see two solutions: The first is to regenerate the URL by javacsript, we can imagine something like this: <form method="get" id="id_form"> .... </form> <script> var objet_form = document.getElementById('id_form'); function gestionclic(event){ var url = objet_form

Categories : PHP

remove new line from txt file after insert value
Have you tried to first write new line and only than value (assuming you already have content in file)? fp = fopen("mylist.txt","rw+"); foreach(glob("folder/*.*") as $value){ fwrite($fp, " ".$value); }

Categories : PHP

Memcached php. Is there any way to get all the keys that has expired?
You just cant do it from the client side actually.Instead you could store with data in the array form. Check this post.It is similar to your question.

Categories : PHP

unexpected T_VARIABLE on opencart? [solved]
Thanks for the comments, @hd and @rjdown, it was actually a server problem really. I filed a ticket on their help-desk and they told me they were restructuring their servers, hiring new people... and someone in there screwed up my SSL :P Thanks !

Categories : PHP

how to count a single value in a string and increment it 1 by one in php
You earlier $value_include as a string with questionmarks. I think you need the use $values instad of array($value_include) in this line: $sql->execute(array($value_include)); Update: function insertValues($table,$fields,$values){ global $pdo; $field_include = ''; $value_include = ''; if(is_array($fields)) { foreach ($fields as $key => $value) {

Categories : PHP

How to separate application from data in a good manner?
I always keep my data in a separate directory which I take out of git with a .gitignore file. This means that when I push changes I am not overwriting the live data. If I need fresh data to test on I use ftp to download a new version of the data directory from the live server to my development server. This works for me because most of the data is uploaded by users so it quickly gets out of sync

Categories : PHP

Symfony2. Forwarding to login_check in isn't interceipted
Trying to perform a redirect with POST is not a good idea. Here's why: http://programmers.stackexchange.com/questions/99894/why-doesnt-http-have-post-redirect The best way is to create token & emit login event: How to programmatically login/authenticate a user?

Categories : PHP

get parameters from url in laravel
Use the Input facade: // All $data = Input::all(); // $_REQUEST['foo'] $data = Input::get('foo'); // null if foo doesn't exist $data = Input::get('foo', 'bar'); // if foo doesn't exist, the value is bar Then you can handle the redirection in the controller on in a filter.

Categories : PHP

how to create sql installer in custom module in magento for creating table by script
In your config file under "resources" tag add the following above <seller_setup> <setup> <module>Webcreon_Seller</module> </setup> <connection> <use>core_setup</use> </connection> </seller_setup> Now create the folder named "sql" inside your module.And create folder named "seller_setup" inside sql folde

Categories : PHP

php how to get the textarea tag from my sql in a textarea in php
Change your code to this: (I have reformatted it so that it fits on the SO post) <tr> <td><b>EN Page Content : </b></td> <td> <textarea name="pageContent" cols="150" rows="100"><?php echo htmlentities(getContentWithIndex("posts",$_GET['pageID'],"content")); ?></textarea> </td> </tr> The reason is that if you

Categories : PHP

php web spider. how to identify url with hash as same page?
If you are trying to just process the target of all redirections you can get curl to follow url's without returning redirection page. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); if you are just interested in the base url without url parameters you can get it easily with explode: $urlParts = explode("?",$url); $baseUrl = $urlParts[0];

Categories : PHP

Realtime bandwidth monitor with PHP/flot
Loose the outer brackets (they are already in the onDataReceived function) and the semicolon at the end: echo ' { label: "download", data: ['.implode($_SESSION['rx'], ",").'] }, { label: "upload", data: ['.implode($_SESSION['tx'], ",").'] } ';

Categories : PHP

PHP: problems with upload files while refreshing page
On your upload code first save the values into SESSION like: $_SESSION[name] = $_POST[name]; then print it into your INPUTS like: <input type="text" name="name" value="<?=$_SESSION[name]?>"> Don't forget to use session_start(). Or look for javascript alternatives

Categories : PHP

sum of integer variables in php
After the line: echo 'acquistati: '.$acq.' omaggio: '.($om).'<BR>FISSATI acquistati: '.($acquistati).' omaggio: '.($omaggio).'<br>'; Please reset the parameters and try again like: $acq = ""; $om = ""; $acquistati = ""; $omaggio = "";

Categories : PHP

Yii framework: check if the user has filled the required profile fields
Despite that it's unclear, As a suggestion do like below: I assume that you can get logged-in user id by: $uid=Yii::app()->user->id; And also, user's model is named User Then, in your controller: public function beforeAction($action) { //getting user id $uid=Yii::app()->user->id; //finding user $user=User::model()->findByPk($uid); //checking if address or

Categories : PHP

OAuth2 for php rest web service security
Usually OAuth2 providers offers 4 authentication flows to use: Authorization Code, Implicit, Resource Owner Password Credentials and Client Credentials If you want more details, you can read this nice post with explanation. The first flow - Authorization Code - is the perfect to use with web server applications (like you, using server side code with PHP). You'll exchange data with the OAut

Categories : PHP

Wordpress htaccess RewriteRule not working - even with add_rewrite_rule
After having yet another look around I managed to find the answer - I think I was missing a couple of important flags. I changed them to [R=301,L,NC] and put the line above the standard Wordpress rules and everything appears to be groovy. Here's my finished code… RewriteRule ^wedding-fayre-diary/(.*)$ /blog/ [R=301,L,NC] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On Rewrite

Categories : PHP

clarification on phar files
The code you give does not work. Also, distributing buildphar.php does not make sense - you probably mean you distribute the .phar file. The problem you're facing (includes do not work) can be solved with Phar::interceptFileFuncs() in the phar stub.

Categories : PHP




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.