Tagged Questions
PHP is an open-source server-side scripting language widely used in web development. Use this tag for questions about PHP classes, methods, functions, syntax and use.
-1
votes
1answer
21 views
syntax error, unexpected ';'
Parse error: syntax error, unexpected in /home/public_html/admin/login.php on line 15
<?PHP session_start();
$users = $_POST['txtuser'];
$passs = $_POST['txtpass'];
$passs= md5($passs);
...
0
votes
0answers
14 views
Sort multidimensional array by a key in php
This is my array that I am trying to sort by match points:
Array
(
[0] => Array
(
[0] => Array
(
[109] => 92
...
1
vote
1answer
21 views
why php datetime object compared with comparision operator
php compare two dateTime object with comparision perator which is >(greater than).Below code is given
$date1=new DateTime("07-03-2010");
$date2=new Datetime("21-09-2015");
...
0
votes
0answers
25 views
Few examples with HTML SIMPLE DOM
i have some problems with html simple dom and dont know how to get some specific data, i read manual and try by my self, but it looks i miss something so hope somebody can help me.
1th problem:
...
0
votes
1answer
11 views
Removing a specific CSS file from getting loaded in Yii
I am coding in Yii.
I have registered the main.css file in my main.php layout file like so :
Yii::app()->clientScript->registerCssFile($this->assetsBase.'/css/main.css');
Now this script ...
0
votes
2answers
23 views
Generate random number to pass it through the form to database withh ajax
I want to generate a random number between 2 and 3 and pass that number through a form and insert it into database. The action will be done with ajax.
The problem I am facing is that since no page ...
0
votes
0answers
5 views
onload popover form appear asking email address, not if email is already saved on cookies
When page load I need to show a popover form that ask an email address and if you don't fill this email field, you can't enter the site. I think I should use cookies but I don't know how..
I tried ...
1
vote
0answers
11 views
How to convert this to a nice Eloquent query
How to query with Eloquent, all users without a certain type of certificate?
Laravel 4
I've got 2 tables:
users table:
->id
->name
certificats table:
->id
->user_id
...
0
votes
1answer
15 views
Mysql facebook style message join 3 tables
//USER TABLE
user_id name
1 ben
2 alex
3 john
//CONVERSION TABLE
c_id user_one user_2
1 2(alex) 1(ben)
2 2(alex) 3(john)
3 1(ben) 3(john)
...
-3
votes
0answers
27 views
I'm looking to clean up my code [on hold]
The following code processes a query and creates a new query in a standard form. I'm using it for a meta-search engine project I'm working on, the code works but I will be using it on 3 search engine ...
0
votes
0answers
2 views
How can I be sure that an upload with S3Client::upload() has completed successfully?
The AWS SDK for PHP documentation on upload() is not very clear on how an upload succeeds, and how it fails:
Returns
Guzzle\Service\Resource\Model
Returns the modeled result of the performed ...
0
votes
0answers
3 views
PHP Form Processing from Dimensional array
I have the following function,
<pre>
public function getFree($cp) {
global $glb_con;
try {
$sql = "SELECT p.ID, w.ID, p.fname, p.lname, w.desc FROM ...
0
votes
1answer
19 views
Matching a needle at beginning of a haystack line with stripos().
In the following code:
// array source elements are formatted like...
// string=string
// string string=string
foreach ($matches[0] as $value){
$titleText = array(); // Store results into an ...
0
votes
2answers
26 views
Getting appointments for the next 5 days using php
I am trying to write a script to pull dates for the next 7 days and put them into a div for each date :
echo '<div class="dateboxcontainer">';
for($i=0; $i<=6; $i++){
echo ...
0
votes
1answer
21 views
File_get_Contents ignore error
$url = 'xxxxxxxxx';
$result = file_get_contents($url);
$stuff = json_decode($result, true);
if (false !== ($contents = $stuff)) {
echo $contents;
} else {
//do nothing
}
If query doesnt return any ...
0
votes
0answers
22 views
Getting result starting from 15 minutes interval
Hello I have an SQL problem, I am getting the result but what I wanted is to get the starting 15 mins as well.
Here's my current query:
SELECT CONCAT(CAST(DATE_FORMAT(date_added, '%h') AS CHAR(2)), ...
0
votes
0answers
7 views
ZF2 headLink helper ordering
I have a small number of styles set with $this->headLink()->appendStylesheet() on the layout and I am trying to append another stylesheet from inside a view. However, the stylesheet from the ...
-2
votes
1answer
19 views
Mysqli not returning right elements
So I came across another problem.
I have this piece of code:
$query = mysqli_query($mysqli_connect,"
SELECT profileCode
FROM personprofile5
WHERE profileId = '$url'
...
1
vote
0answers
8 views
Stateless file incremental hashing context
Question in short
How can one "resume hash_context" in PHP?
Background & Current Situation
The software's goal is to receive big file chunk by chunk (synchronously), calculate both MD5 and ...
0
votes
1answer
11 views
Trying to add a captcha and getting an unexpected $end but can't find it…advice needed
I need some help I am trying to add a captcha to a page and I am getting a unexpected $end error on the very last line of this code and I can't figure out why or where I goofed . BTW I didn't include ...
0
votes
2answers
36 views
detect change in column value?
This is how my table looks
page time
x 0
x 1
x 2
y 0
y 1
x 0
x 1
x 2
x 3
z 0
z 1
z 2
z 3
I am plotting a graph based on values of ...
0
votes
1answer
11 views
PHP POST curl terminal command in PHP script
I've found at the StackOverflow answer here exactly how I want to post data to another web url.
However, I want this command to be executed in my php web script, not from the terminal. From looking ...
0
votes
1answer
13 views
Customize PDF via web interface
I have a basic level working knowledge of PHP and Javascript. The company I work for wants to be able to customize sales documents, that are in pdf currently per sales person and then send them to a ...
0
votes
0answers
4 views
getting Object has no method 'getTime' while generating graph using googleGraphs
I am trying to generate graph using google graphs. I want to display the data monthwise. but for graph i am getting Object July has no method 'getTime'
Here is my main page where i am displaying ...
0
votes
1answer
12 views
NumberFormatter to leave always 2 digits behind floating point
I have ended up with a little bit of an overkill here, but I just cannot seem how to nail it:
$formatter = new NumberFormatter('lv_LV', NumberFormatter::DECIMAL);
...
-1
votes
1answer
28 views
Params not showing up
trying out my PHP skills and it seems when I try to send out the information from my Android app to the PHP, it seems to send just the parameter names out to the database. We are using PDO as the way ...
0
votes
0answers
4 views
CGI scripting error message
I have a .pl script in my CGI-Bin which is executed from a .shtml page in my public directory.
The script has stopped working and now shows the error [an error occurred when processing this ...
0
votes
0answers
8 views
cakephp 1.1 - using a model in another model only by instantiating
I need to use the methods in some other models in another one. I noticed that version 1.1 doesn't have ClassRegistry and I heard that I should use the loadModel method and everything worked fine. ...
0
votes
1answer
45 views
Turn “foreach” into “for” with structures
I have this block that prints some description and some product details.
<?php foreach ($_additional as $_data): ?>
<tr>
<th class="label"><?php echo ...
-1
votes
0answers
21 views
PDO Dynamically Prepared Statement Always Returns Empty Array
The read method below doesn't seem to work. I tried several different things and none of them worked. No exceptions have been thrown so in my debugging script, it just shows an empty array returned by ...
0
votes
2answers
19 views
CodeIgniter - Why does library load fine in view but not in controller
I'm using Stripe's php library. DL link: https://code.stripe.com/stripe-php-latest.zip
I've included the library like so inside of a view:
require_once(APPPATH.'libraries/stripe/lib/stripe.php');
...
0
votes
2answers
33 views
Combine 2 Foreach statements into 1 PHP
Is it posible to combine 2 foreach statements into one?:
foreach ($this->products as $product) {
// Content Here
}
and
foreach (range(0, 100, 10) as $number) {
// Content Here
}
Like:
...
0
votes
1answer
32 views
create select list from complex arrays
Lets say I have an array like:
Array
(
[1] => Array
(
[name] => 85 x 55mm
[options] => Array
(
[2] => Array
(
...
0
votes
0answers
4 views
Magento Rest API - oAuth Error
I am working with Magento Rest API for the first time, i went through the tutorials of Rest API on http://www.magentocommerce.com/api/rest and tried one example to fetch product through API:
...
1
vote
1answer
17 views
How to make this form get the value outputted by jQuery slider?
My problem is that I have found a jQuery UI slider which outputs a number however I cannot seem to find a way to get the PHP file to get the slider value when I submit the form. How can I do this?
...
0
votes
3answers
37 views
Errors not displaying in PHP 5.3
I recently upgraded to PHP 5.3.22 and now I'm getting WSODs whenever there are errors in my php code. I know I have display_errors disabled in php.ini, so I tried adding the following code to the top ...
0
votes
0answers
15 views
Symfony automatic response issue
I just created a custom class that will do more commands. This command will be launched by a robot in the future.
But when I do a
$command_fixtures_load = ...
1
vote
3answers
22 views
resize image on the fly using php
I'v searched all day for a function to resize my pictures on the server on the fly, without saving them.The code works, it shows the full size images, now I want to make them smaller.
This is the ...
0
votes
0answers
7 views
Programatically create multiple coupons in WooCommerce
I've been looking for a way to add coupons in bulk to WooCommerce, it's actually a list of 800 membership numbers, that grant a discount, and coupons seem to the best way to do this.
I've found a way ...
-6
votes
5answers
40 views
Php condition doesn't work for html [on hold]
I currently want to display a link only on a certain page. The architecture on the website itself is over the index.php?menu=<pagename>. So I thought I could simply use:
<?php
echo ...
0
votes
1answer
17 views
Considering usage of server-side JavaScript
Recently, i heard alot of JavaScript being used sever-side. Node.js, express.js and similiar stuff are mentioned more and more, but i never had the muse or time to dig deeper into the topic.
Now, as ...
0
votes
0answers
4 views
ftp_rawlist returns false on ProFTPd server
I have a ProFTPd on a linux server (ProFTPd version 1.33 on Debian Linux 6.0.7 Linux 2.6.32-042stab078.27 on x86_64) that lets access to some users to their home directories.
I also have another FTP ...
1
vote
1answer
14 views
Web service expects parameter to be long int but no long int support in PHP
I have to call a web service, which expects it's parameter to be of type long integer. I do not have access to the server logs, so I don't know why am I getting an error response from server. I am ...
-1
votes
2answers
27 views
Android: how can I send verification email [on hold]
I'm developing an android app, and after the user registers, i'd like to send him a verification email according to the mail he entered in the registration process.
I saw several answers here but ...
0
votes
0answers
48 views
Invalid argument supplied foreach JSON PHP
I've got this really anoying problem with my foreach loop and
my json string. Most of the times when I get a json string as a request on my
php script everything works fine, but sometimes it gives me ...
0
votes
0answers
5 views
Kohana: store cookie for .hostname.com via ajax request
I have a PHP Kohana3 application which exposes api endpoints via api.hostname.com. I'm logging in via api.hostname.com/auth/login from my app on www.hostname.com via ajax. If the login is successful I ...
0
votes
2answers
18 views
Can json transfer longblob in php?
I used mysql to store the picture and it is stored by longblob.
Now I need use json the transfer the data of longblob.
The json_endcode($data) return null.
How to do it?
1
vote
2answers
69 views
Dynamic Title of page? PHP include links?
Can the Title of the page (within the head, not a random title) be dynamic?
I was thinking that PHP could return the value of the current page and then echo it into the Title tag after amending it.
...
0
votes
1answer
25 views
Preg_match somehow not finding part of string
I am having a problem with preg_match in that it is not returning anything. While according to: http://gskinner.com/RegExr/?=35ls9
It should be functioning properly.
This is my current code:
...
-3
votes
1answer
24 views
Parse error: syntax error, unexpected T_VARIABLE in sms.php on line 27 [on hold]
My PHP script name is sms1.php. When I am executing it I am getting this error: Parse error: syntax error,
unexpected T_VARIABLE in /home/
*/public_html/sms1.php on line
27
My sms.php is:
<?php
...