php

FOUND_ROWS() keeps returning 0

$result = $db_con->query("SELECT SQL_CALC_FOUND_ROWS * FROM users LIMIT 0,10"); $count_result = $db_con->query("SELECT FOUND_ROWS() as totalcount"); $row = $count_result->fetch_assoc(); $total = $row['totalcount']; $total keeps returning 0 even though the $result contains all the user rows in it. ini_set("mysql.trace_mode", "0"); I...

SWFUpload - anyone familiar?

I'm experimenting with SWFUpload ( http://swfupload.org ) and I'm wondering if, in PHP, its data will still be in the $_FILES array. If not, where does it go? ...

Can this PHP framework be identified?

I just got a few PHP projects which are using a similar kind of framework but I can't tell which one. I have experienced some Code Igniter, Django and Rails before but I can't pinpoint that specific framework. I'm looking through the PHP files for any indications of its origin but they seem to have been wiped out. The person I'm helping...

Creating an object from a dynamic database call

I'm trying to make a class that takes some unspecified data from a database query (passed to my class as an array) and turns it into a PHP object with properties that are created dynamically from the data passed to it. Like so: class myLibrary_Item extends myLibrary { private function __construct($vars) ...

I have an issue in mysql that i have a field id which is auto increment and some other fields.

I have an issue in mysql that i have a field id which is auto increment and some other fields. where the id field should not be autoincremented while enterting the null values and should be autoincremented while entering values insert values in the same row while giving not null values . ...

Code for 'any' variable?

I want to consolidate the following code. Although I'm not sure how to reference SELECT * FROM any table ending in listing. $this->displaylistings=mysql_query("SELECT * FROM nordstromlisting WHERE ShopperID = '$this->ShopperID' UNION ALL SELECT * FROM saksfifthavenuelisting WHERE ShopperID = '$this->ShopperID' UNION ALL SELECT * ...

How to use a variable to access certain element within a multidimensional array?

Hello, I am using arrays in PHP to modify xml data and write it back. This is the xml structure (simplified for demonstration purpose): <docs> <folder> <name>Folder name</name> <date>20.06.2009</date> <folder> <name>Subfolder1</name> <date></date> </folder> <folder> <name>Subfolder1</name> ...

Mediawiki: Invalid Edit Token

Hello, I use the API with HTTP POST to create a wiki page in a Mediawiki (1.14): I require an edit token It works, I get a fresh token (example: d96d72fae5e6c43b0b9f63d82ace366) I send the HTTP POST for creating a new site with my new token (sth. similar to "d96d72fae5e6c43b0b9f63d82ace366+\" I get an error message "Invalid Token" ...

Splitting text

I want to know is there any way to split text like this: 123456789 into 123-456-789 as to add "-" after every 3 characters? Just wanted to know, as I know the reverse, but how to do this is over my head. ;) and also if the text is ABCDEFGHI OR A1B2C3D4E or any other format without any space between the characters ! languge : PHP...

how to find a string containing a square bracket?

i'm using a regular expression to search for a bunch of keywords in a text. All keywords are found but one: [DAM]Berlin. I know it contains a square bracket so i escaped it, but still, no luck. What am i doing wrong? here is my php code. The text to search for keywords: $textToSearch= '<p><br> Time ¦ emit LAb[au] <br> <br> [DAM]Berli...

Percent symbol in codeigniter URI

I need to pass an encoded string to a codeigniter controller. Ex: DOSOMETHING/Coldplay/Fix+You/273/X+%26+Y/ My problem is with the percent symbol, has disallowed characters. I tried to change the config file with: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-+\%'; The + is ok but the % is not valid. Can you help me to change this r...

Odd class problem

In the midst of making my code OO, and ran upon this problem. The following class is giving me a weird problem. when I created the function CartTotal(), it echo'd out the proper values, BUT function DisplayListings(); did not display any MySQL data (both use $this->displaylistings). And if I change the order on my page in which I call th...

How to stop html header content from being included in jquery post results?

I am using jquery's "$.post()" function to add a list entry to the mysql database, in php. $(document).ready(function(){ $(".theSubmit").click(function(){ var content = $("textarea").val(); var listn = $("input[name='list_name']").val(); var groupn = $("input[name='group_name']").val(); $.post("/sec...

PHP Practices for first time web-programmer

I have this idea for a website that's been floating around my head for quite sometime now and now have finally decided to get to work on it. Due to the nature of the project and my experience I am getting comfortable with the idea of running it as a PHP+MySQL application on an Apache server. This is my first time doing web programming o...

PHP sprintf() and printf() functions

I've never used these functions before but after reading a lot about sprintf(), I decided I should get to know it. So I went ahead and did the following. function currentDateTime() { list($micro, $Unixtime) = explode(" ",microtime()); $sec= $micro + date("s", $Unixtime); $sec = mb_ereg_replace(sprintf('%d', $sec), "", ($micro + d...

are there simple, open source learning-friendly web apps?

I was wondering if I could learn ASP.net or other web programming frameworks by studying existing functional open source apps of the simpler kind. As in, of not quite MediaWiki complexity and so forth. Perhaps something like "simple forum" or "simple web store". Something that is non-trivial and demonstrating useful functionality, but no...

Why is my Ajax application not working in my localhost computer?

Hi guys, my XAMPP is activated but the Ajax scripts are not working. It should really work because I got it from a book and double checked the codes and the connections for the database but it didn't work. Whats the problem anyhow? The code is located on Chapter 5 http://www.myphpbook.com/download I just started to programming so I do...

How to select value of adjacent hidden input with Jquery?

When a user clicks on the img at the end of the following "li", I want to get the value of the hidden input two elements previous. <ul id="theLists"> <li> <input class="checkbox" type="checkbox" name="row"/> <input class="contentId" type="hidden" value="64" name="id"/> <div id="64" class="editable">Peanuts for me</div> ...

how to trigger a function on defined date

hi i am doing a project where i need to notify a user through email if his account has expired, that is when a user signsup his sign up date and expire date is inserted into the database now what i need to do is , i need to fire a function when the users expire date is passed and send an email notifying user about the expiration of ...

Weird problem with session_set_save_handler() in PHP

I'm trying to write a custom session persister in PHP. But for some reason only my session read functon is getting called, not my session write function. Thus the session isn't persisted. If I switch back to the default session handler (file), everything works. If I add session_write_close() at the end of the test script - everything wor...