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.
0
votes
1answer
14 views
pass a PHP object to an ajax PHP script
How can I pass a PHP object created during my initial page load, to an ajax call?
create-page.php creates my page and has an object expensiveObject. I need to pass expensiveObject to ...
0
votes
1answer
15 views
How to direct people to another page once submitting a form?
I'm currently working on this page: http://www.maschineuk.com/landing-page
When people have entered their name and email address I want them to be re-directed to a page where they can download the ...
0
votes
0answers
10 views
Custom header or query string when proxying request from Nginx to HHVM?
I'm using instructions in the following post as a guideline using Nginx as a proxy in front of HHVM: ...
0
votes
1answer
16 views
XML Whitespace - PHP
I have a problem with an XML file name, it can't contain whitespace in the code below (assuming that $_GET['docname'] = "My Document").
Example of what I mean: Lets say the $_GET['docname'] is test ...
-1
votes
3answers
25 views
You have an error in your SQL syntax (mySQL)
I know questions just like this have been asked before, and I've looked at those topics and still can't seem to find the error in my syntax - so I turned to posting my own.
You have an error in your ...
0
votes
1answer
24 views
Get file name of file being uploaded and write it into a text field
I have a form with two input fields, one type=file and other type=text.
I would like to:
select a file with type=file field to be uploaded using php
grab the file name of the file being uploaded
...
0
votes
0answers
7 views
php SoapClient: Couldn't Load from external entity
I have a WSDL located somewhere similar to this:
https://provider.web-service.domain/path/ServiceName?wsdl
It has a line like this:
<wsdl:import namespace="http://name/space/service/" ...
1
vote
0answers
24 views
Can I encode an array of 'array objects' in php when using json/ajax?
Hello I was wondering if this is possible?
$results = $stmt->fetchAll();
$recent_posts = array();
foreach ($results as $row){
$post = array(
'username' => ...
0
votes
0answers
7 views
cannot set property 'display' of undefined in magento 1.7 custom menu popup in multi-store
I've custom menu ext installed and have multi-stores on single magento installation. Main store www.just4girls.pk menu and dropdown popups works fine but on sub-store www.just4babies.pk menu dropdown ...
0
votes
1answer
9 views
Can one convert pdf to swf dynamically?
Can one convert PDF to SWF dynamically? I have been trying, but it proved to be difficult.
Here is my code:
<?php
include('include\settings.php');
$title = "k";
$makeswf= mysql_query("SELECT * ...
1
vote
2answers
14 views
Use PHP to copy partial MySQL column data to another
I have an "additional images" column in my mySQL DB, and I am (so far unsuccessfully) attempting to copy JUST the first URL to another column as the "main image"
For example:
...
-6
votes
0answers
16 views
Displaying Course End time on the report [closed]
Whenever student finishes a course, I need to add end time and date on the report and then save it into the database in PHP and MYSQL. How can I do that?
I haven't done anything I don't know how to do ...
0
votes
1answer
18 views
Variable not seen as string
$test = "橘色,灰色,深蓝,绿色";
$completeColours also contains the same text, just that the texts are joint by a for loop character by character to form the text like $test.
I copy pasted $test's charcters ...
0
votes
0answers
12 views
Can't connect to MySQL server from my webserver, works fine using the exact same file on my personal box
I have a godaddy server where I need site users to be able to enter in tracking numbers to see if we have it in the system. I coded it in php/pdo, and it works just fine hosted on my personal machine ...
0
votes
0answers
13 views
Using shell_exec to create output file adds 2 questions marks to the end of filename
I am very very new to PHP, so I appreciate the patience and assistance.
For the following block of code, for some reason two question marks (??) are being appended to the end of the filename of the ...
0
votes
0answers
6 views
Ratchet send doesn't work with sleep function
Ratchet send doesn't work with the sleep function, how can I fix this?
Here is my code:
$i = 0;
while($i < 180)
{
foreach ($this->clients as $client)
{
...
0
votes
0answers
9 views
Pinterest Followers display
How would I go about showing the numbers of followers of my account on pinterest in wordpress? I even tried this but it only displays the button letting users to follow my account. Any help would be ...
1
vote
0answers
62 views
Can anyone help me catch a syntax error in jquery
In my console I keep getting a syntax error on line 10. I cannot figure out what is wrong with my code. Thank you so much for the help.
$(document).ready(function () {
// Skill sort on change
...
0
votes
2answers
38 views
PHP turning json into array
So I've got this huge amount of data in a php-file but it is in json-format.
I have tried converting it putting all the json into one $string variable.
Then:
$json = json_decode($string);
...
0
votes
0answers
20 views
Codeigniter parse error in Controller
Can anyone tell what the cause of this error?
This is the error:
Parse error: syntax error, unexpected $end in /home/jlucero/public_html/adituptees.com/application/controllers/decoration.php on ...
-1
votes
0answers
9 views
SQL show index from `error_log` failed : Table './table/error_log' is marked as crashed and should be repaired
I'm getting below error from one of my databases.
Is there a way to fix this?
SQL show index from `error_log` failed : Table './table/error_log' is marked as crashed and should be repaired
Also ...
0
votes
0answers
19 views
Form submission with js and non-js, how to use 1 file without copying code
I'm submitting a form with ajax. Ajax calls url: form.php and expects a 1/0 response for success/failure, then I display a message via js.
$.ajax({
url: 'form.php',
data: ...,
success: ...
0
votes
0answers
15 views
PHP Infinite recursion when serializing object with Dependency Injection
class foo
{
private $deps
public function __construct(bar $obj)
{
$this->deps=$obj;
}
}
class Bar
{
private $property; //Instance of Bar which have setter and getter methods
}
Both ...
0
votes
0answers
20 views
Get all session cookies in PHP
I have multiple cookies having scope for one session. Now I want to get all those cookies having expiry of one session.
I searched for it, I found function session_get_cookie_params that gives ...
0
votes
0answers
19 views
Performing some division inside a pagination function
I have a website where I still many doses and units associated with those dose. When a user submits a dose, that specific dose is multiplied by a relative conversion value which is associated with ...
0
votes
1answer
18 views
mcrypt_decrypt wrong output after using encrypted data php
I have a small problem with php mcrypt_decrypt function. Firstly, I use a 16-byte string, and encrypt it using mcrypt_encrypt; then, I use base64_encode, and put the output to mcrypt_decrypt, in order ...
0
votes
1answer
17 views
Show different content on each category in Wordpress
I have a custom category.php file in my template. I want to show a unique banner on each category. How do I do that? I am new in Wordpress Developing and I have no idea.
Thanks.
0
votes
0answers
19 views
Can not add item to shopping cart after enabling .htaccess
I have spent a whole day trying to fix this problem but no luck. I hope someone out there has the solution.
I enabled the .htaccess but deleting the .txt and I have added some more things on it to ...
1
vote
1answer
25 views
My ajax JSON object is recognized as “Undefined”
I am having troubles with my ajax call. When I try to alert the result it keeps resulting as Undefined.
Both alerts are resulting to undefined.
I am not too sure if I am coding this correctly, please ...
0
votes
1answer
14 views
Pass current array as reference [PHP/Drupal6]
I have a variable $doctype that is an array:
$doctype = array(
'news' => ('news'),
'documents' => ('documents'),
'forms' => ('forms'),
'other' => ('other'),
);
which is ...
0
votes
2answers
22 views
value repeats in next loop
function attribute_manager() {
$checkattr = $this->connection->query("SELECT * FROM attribute_grup");
while ($attrs = $checkattr->fetch_object()) {
$id = $attrs->att_gr_id;
...
0
votes
1answer
17 views
select a single value though a table in wordpress
The table has these columns:category_id, category_name, and category_parent_name
I would like to get category_id by using category_name. I searched online, and the code is like below:
$ad_cat is the ...
0
votes
2answers
12 views
Using a DTD, can an element be declared that allows any XML content?
I'm trying to create a DTD for an XML document. The document has two children - one contains structured data and the other unstructured data eg;
<doc>
<structured>
<foo ...
0
votes
0answers
17 views
Editing deeply associated form
In my cakephp I have a setup of 4 associated forms.
My tables:
records
id | date | title | user_id
---------------------------
1 | Jan | Title | 1
units
id | unit
---------
1 | mL
2 | l
drugs
...
0
votes
0answers
6 views
get a List of user games in Facebook using graph api?
Is it possible to get a list of games a user is playing in facebook? or a list of apps a user is using (not managing)?
what i am searching for is application list similar to what is in the ...
0
votes
1answer
10 views
PHP SOAPClient WCF Error sending parameters
I'm working on a Webservice using PHP SoapClient.
The webservice url is: http://web.abaseguros.com/AutoConnect/ACCatalogos.svc?wsdl
And here is my code:
<?php
ini_set("soap.wsdl_cache_enabled", ...
1
vote
1answer
54 views
Parse PHP source codes and extract some informations
I have some files with this structure:
<?php
echo "something";
switch($_GET['action'])
{
case 'step1':
echo 'somethings';
break;
case 'step2':
...
2
votes
2answers
31 views
What is the default algorithm in password_hash
Reading the documentation about a new password_hash function for PHP 5.5, I am wondering, what is the default algorithm:
password_hash("rasmuslerdorf", PASSWORD_DEFAULT);
Documentation about it ...
-1
votes
0answers
22 views
Building a Multi-Site Platform on Node.js - The Pros/Cons
We're building a highly scalable platform that will be serving multiple millions of hits per day and servicing potentially multiple thousands of concurrent user connections.
This platform will ...
0
votes
1answer
33 views
Can't logout mysql and php
I have created a login/logout system in my application but it's not working even using session_start();, session_destroy(); and session_unset (); etc.
Here is what I have done so far:
the first ...
0
votes
1answer
13 views
ArrayIterator::valid not works
I have a Propel collection, and try iterate it. I use, the Propel collection getIterator() method to get an instance of ArrayIterator.
So, in my code:
$medicos = $query->find();
$it = ...
0
votes
0answers
12 views
jquery easyui datebox event to querying mysql
i use this script on jqery easyui datebox
<script>
function onSelect(date){
$('#result').text(date)
}
</script>
and the output is
Selected ...
0
votes
1answer
30 views
Order by mysql timestamp [closed]
I'm using MYSQL timestamp each time an entry is added. Now I'd like to retrieve this data by descending order of time added. This is what I've done but there seems to be an error:
...
1
vote
2answers
21 views
How to install PHP 5.5 (as it's new and has no official packages yet) on linux?
PHP 5.5 has just been released [1], and it's definitly worth installing this in development environments and maybe even on first production servers. As PHP 5.5 is very new, there are no official ...
-8
votes
0answers
43 views
Do I need to know PHP to do updates on this site? [closed]
I've just accepted to do some updating one somebody's website, and after reviewing the source code more closely, I've noticed that all of the links end with .php. Does this mean that the website is ...
0
votes
2answers
17 views
Can a forward slash at the end of a url effect the pages formatting?
I have an .htaccess file that redirects all pages to index.php.
INDEX.PHP
<?php
$url = $_SERVER['REQUEST_URI'];
$url_array=explode("/",$url);
array_shift($url_array);
$url = ...
-1
votes
1answer
28 views
Scrape links from html
I have been always using preg_match to s****e urls from html files but I wanted to extract only urls that have .mp3 as extension. I was told to try DOM and I have been trying to fix a code but it ...
0
votes
1answer
15 views
page configured incorrectly?
I moved my files from my Xampp server over to a live server and now the PHP doesn't seem to be working correctly. This file is the problem
<?php
require ("../Android/connect.php");
require ...
0
votes
2answers
28 views
My function doesn't modify the array
I have written a function that shifts array values one index to the left. It looks like this:
function index_shift($array, $index){
$n = count($array) - 1;
for($i = $n; $i >= $index; $i ...
-2
votes
3answers
46 views
how do I select top 5 from a MySQL database
right now I am using this really complex method for what I think could be a lot easier
<?php
$a=0;
for($i=100; $i>=0; $i--){
$query= mysql_query("SELECT * FROM data WHERE likes=$i");
...