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.

learn more… | top users | synonyms (6) | php jobs

2
votes
1answer
14 views

php regex to extract multiple matches from string

I'm trying to make a php regex to extract multiple sections/conditions from one string... let me show you what I'm talking about; this is an excerpt from the total file contents (the real contents ...
0
votes
0answers
7 views

OSX Safari skips javascript functions when data is posted to an SSL URL

When a form's submit button is pressed, I want to disable the submit buttons and show a hidden div. My code: HTML: <div id="processing" class="processing">this should be visible when submit is ...
1
vote
1answer
10 views

xdebug remote: can I execute php code or change variables?

Is it possible to execute arbitrary PHP code or at least change the value of variables during a breakpoint using xdebug's remote debugging? I'm using the Sublime Text 2 plugin SublimeXDebug.
1
vote
2answers
18 views

How to sort PHP multidimensional array by timestamp

I'm currently messing around with Twitter API, but this question isn't really related to Twitter API; it's just a general PHP question. I'm pulling a couple queries of Tweets separately and then ...
0
votes
2answers
13 views

trying to understand:Fetches results from the database with each row keyed according to preference

/** * Fetches results from the database with each row keyed according to preference. * The 'key' parameter provides the column name with which to key the result. * For example, calling ...
2
votes
3answers
31 views

PHP pass url to index.php

This should be really simple, but I want to be able to use the url as a variable like the php frameworks do. mywebsite.com/hello-world I want my index.php to see "hello-world" as a variable and I ...
0
votes
0answers
8 views

Doctrine ORM - association creating multiple rows of the same data when saving

When persisting objects with DoctrineORM, I'm getting duplicate rows entered in the "child" object's table. This is what I'm working with: /** * @ORM\Entity * @ORM\Table(name="city") */ class ...
0
votes
0answers
10 views

Testing __call() with mockery?

I have a pretty basic function in my class that does exactly as the comment say, it just forwards calls to the child model if they don't exist on this class. This works perfectly from my tests. /** ...
0
votes
1answer
16 views

Testing a class that calls parent::function?

I have a model that overloads the where function. My overloaded method looks like this: public function where($column, $operator = null, $value = null, $boolean = 'and') { if (in_array($column, ...
0
votes
1answer
33 views

Response On Process Complete

<?php $mysender2= ""; $myrecepient2= "923336088811,923126812536,923134126153"; $mymessage2 = "this is message"; $api_key = "****"; $api_secret="****"; $to_arr = explode(",", $myrecepient2); ...
0
votes
0answers
21 views

Looking for a Clean Way to Evaluate Array INSERT to Database Table

I have a an array of values listed below: [0] => 1.23 [1] => 0.00 [2] => 0.00 [3] => 0.00 [4] => [5] => [6] => [7] => 0.00 [8] => 0.00 [9] => 188.99 [10] => 242.99 ...
2
votes
1answer
20 views

WordPress .htaccess RewriteRule not working

Relaunched a website and a lot of old pages need to be redirected to new ones. I thought this would be simple with htaccess but wordpress has other ideas. Htaccess's 'Redirect 301' doesn't appear to ...
-4
votes
0answers
25 views

Tell which id I need to get [closed]

this is so, if I liker words like, then take the hold of all of them from the page and "like" them even if you have not, then what I need help with is when I liker on such identification 1 so must say ...
-2
votes
0answers
23 views

Changing content on the page without loading new page [closed]

I need help with this problem but I have no idea how to do that. I have looked everywhere on the internet and I found some answers but I am not managing to solve this problem and I am here because I ...
2
votes
3answers
24 views

PHP decimal position of math result

If variable A = 0.07 when echoed and variable B = 2100.00 when echoed if we: $c = $a * $b; when the end result is a whole # ( i.e. $c = 147) is there any way to force the result to keep 2 decimal ...
4
votes
5answers
38 views

php call a “return” from from a different function

function a(){ b(1); // Makes a() return true b(0); // Makes a() echo "Just some output" } function b($i_feel_like_it){ if($i_feel_like_it){ return return true; }else{ ...
0
votes
0answers
11 views

how to fix Komodo PHP dll missing error?

When I open *.php files my Komodo gives me this error I checked and those dll do exist, they are not missing! I recently did a clean up of the temp folders for Windows, and this error start coming ...
0
votes
2answers
17 views

How to store user files securely on a server [closed]

I am trying to make a cloud desktop website were people are able to store music, videos, documents, ect. online and access them from almost any device. I have been looking online but have been ...
1
vote
1answer
28 views

why did my ajax not submitting?

i have now problem with ajax sending form and couldnt find where is the error, here my html: <form method="post" id="update-profile" name="update-form" action="process.php"> <input ...
0
votes
2answers
18 views

PHP using another sites login?

I am creating a login system for a server I'm starting for the popular game Minecraft. When I was creating the registration system, I realized that someone could pretend to own the in game account ...
0
votes
2answers
40 views

Understanding try catch block

I am confused about the whole try catch block. I understand if an exception is thrown it execute the catch block, however I have a question regarding using return inside the try block. try { ...
0
votes
0answers
17 views

php form with exec, file_get_contents, trim and explode

I am still working on a script to edit a file on my vps server. It has already been partially answered but I realized I have left something out. Here is the current code I have with help from a few ...
0
votes
0answers
13 views

Wordpress Checkbox Value in Loop

I created a custom checkbox that when I check, I wish it to display slightly different content (specially special css styling). For some reason it is not functioning properly. In my functions: ...
0
votes
1answer
30 views

PHP - methods of a object

I'm a Java developer trying to understand this PHP behavior. I've executed the following methods: error_log(get_class($a) . "\n", 3, "c:\my-errors.log"); error_log(print_r(get_class_methods($a), ...
0
votes
0answers
11 views

How to query DBpedia

I am trying send a query to DBpedia's endpoint http://dbpedia.org/sparql via a php script, with no succes unfortunately. This is the script: <?php require_once('sparqllib.php'); $db = ...
0
votes
2answers
18 views

Can memcached be used to reduce the load on these SELECT * queries

I have many users polling my php script on an apache server and the mysql query they run is a "SELECT * FROM `table` WHERE `id`>'example number' Where example number can vary from user to user, ...
0
votes
1answer
38 views

Is it Security Safe to Destroy and unset a session like this in php

Is it Security Safe to Destroy and unset a session like this? And Does it follow coding standard? I'm implementing a Logout script for a website. After the user logs in, and successfully setting the ...
1
vote
2answers
34 views

Regex to pull match from ordered list

Given this string of text: $myString = '<details class="myEl" open="open"> <summary>In this article</summary> <ol> <li><a ...
-1
votes
0answers
31 views

just a figure of it as it is here and now [closed]

Right now I'm working on a small "Like", this purpose will be used for firefighters to show what training evening they want. I've tried to do like this: <form action="#" method="post"> ...
0
votes
0answers
5 views

private method `split' called for Package[php-pear] puppet

I'm new to Puppet and I'm having a bit of trouble figuring this out. I'm using Puppet 2.6.10 on centos 5.6. I have a used the same Puppet modules: -MySql -Apache -Firewall -StdLib On a new version ...
0
votes
0answers
9 views

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401'

I am using a php-script that has been working for years, but suddenly it aborts with Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401' ...
0
votes
1answer
24 views

Inserting range of dates in mysql db

I have a mysql database in which I am trying to insert consecutive dates for one year (starting 7-1-2012) and only want weekday dates inserted using php. Below is the code I have so far but get an ...
0
votes
0answers
23 views

Using PHP header to download a .DMG file

I have a php script that gets called when a user comes doesn't have the required installed software and initiates the download to install it. The code works completely fine for Windows machines. But ...
0
votes
0answers
14 views

Ajax working on localhost but not on server

My autocomplete ajax code for a form is working in localhost but not on the server: <script src="js/vendor/modernizr-2.6.2.min.js"></script> <script ...
-1
votes
1answer
28 views

How to send text data in a PHP file upload form

I have a PHP file upload form and am trying to send a small piece of text data alongside it, in the form of a hidden field with a fixed value. I think the enctype=multipart/form-data is messing this ...
1
vote
2answers
28 views

MySQL multiple join, multiple sort maintain group

I'm trying to display data from four tables. Three of these tables constitute a one-to-many relationship. I need to group certain data according to a shared suit_id and I need to be able to freely ...
1
vote
1answer
10 views

Error: Warning: Creating default object from empty value

My first time posting, I'm hoping someone could help me with this error that has appeared on my website as of Wednesday, I'm not sure how to correct it since I've never touched the .php file. If I ...
0
votes
6answers
66 views

Faster way to write these multiple elseif?

is there a way for simpler and faster way to write this? $currTime = date('H:i'); if ($currTime >= "12:09" && $currTime <= "16:08") { echo rand(260, 272); } elseif ($currTime >= ...
0
votes
1answer
12 views

Why to use adlap and why not use php library? [closed]

I would like to ask, why to use php class adLDAP and why not use ldap library in php? (technical issues) Thanks a lot!
-2
votes
3answers
19 views

How to insert text of image or simply text via URL on PHP file?

I need to know if it is possible to, for example, in home.php display an image but have the image name be given by url. For example, have home.php?=IMAGENAME display IMAGENAME.jpg. Or even just ...
0
votes
1answer
21 views

Including external resources through a view that extends a layout

I'm trying to learn Laravel by using it for one of my sites however I'm having trouble working something out. I have a layout.blade.php file which holds all my global markup. Stuff like the header, ...
0
votes
0answers
6 views

Post to my Facebook Page from Website

I have a website and on it is a blog built using a custom cms. Now, I have a Facebook page that I'd like the website to post to whenever a new post is added. I've been playing with the Facebook API ...
0
votes
1answer
15 views

PHP mail returns true (Message accepted for delivery), but the message is not sent

I have been trying get php to send mail for over a month. I am moving from 000webhost, where it worked fine, to my friend's server. The php code that sends mail is: $subject = $u.", your ...
-8
votes
1answer
48 views

I need some help Here [closed]

I am trying to take Username and password from user and check if they exist in a table called users each user has an ID, then add an amount of 1000 to the user ID that it will take from the users. ...
-5
votes
1answer
21 views

Viewing the real value like content [closed]

This is how to "glike" to come up with a number, that is, if it is 20 so it must have written it appears on the page. if ($stmt = $this->mysqli->prepare('SELECT `id`, `navn`, `img`, `tekst`, ...
0
votes
3answers
41 views

Parsing json with Jquery no loops

Hello I am trying to parse a .json file.. it only has 1 set of data I don't think the $.each is the best approach but it's all I can find.... Here is my code: <script type="text/javascript"> ...
0
votes
1answer
25 views

Designing a PHP script/functionality with future and safety in mind

I have a project i'm working on with a very weird request from my client, which I need some help with since i'm not quite sure how to handle it. This is all done in Joomla and PHP 5.3 The company i ...
0
votes
0answers
14 views

PHP Global Cookie Removal

I've got a problem deleting cookies. It seems my logout routine which uses the unsetting cookie code here only removes cookies on the root path. When I try to check for cookies in php files lower down ...
-3
votes
0answers
34 views

extracting data from html page

I want to extract content from a lot of html pages I use PHP for this exactly file() so i can get it in array they are like this www.example.com/some-title_1.html ...
0
votes
0answers
13 views

Building array and formatting JSON for Google Charting API

I am working on a project where I am making use of the Google Charting API and I want to populate the chart using json to build the data table. As a test I am trying to build a simple array before I ...

1 2 3 4 5 8137