php

is it allowed to create a php class inside another class

Hello, I was wondering if it is allowed to create a class inside another class. It's actually the database class or, do I have to create it outside and then pass it in threw the constructor? but then I have created it without knowing if I would need it example: class some{ if(.....){ include SITE_ROOT . 'applicatie/' . 'db.class.p...

Getting all info of the logged in user? PHP

HI Could I fetch ALL the info from the user when he/she login and store it in sessions instead of having this piece of code on top of all pages to get username, email etc of the logged in user? $userq = mysql_query("SELECT * FROM users WHERE id = {$_SESSION['id']}"); $auth_user = mysql_fetch_assoc($userq); Login.PHP $sql = mysql_qu...

Convert date format from mysql TIMESTAMP help

Hi. have one problem, I need the dates in Swedish format, for instance, october is in swedish oktober... How can I do this? This works so far for english dates: $date = date( "j F", strtotime( $row[insert_date] ) ); $display_table .= "$date"; ...

programming training and consultancy not for a company, but an individual

I'm interested in Ruby, Python, PHP and Java. Does programming training and consultancy the way I described exist for any of those programming languages? Is it good? Why? Is it on the internet? Where? ...

Monitoring user tracking, statistics, and auditing for app

I'm trying to incorporate user statistics into a site and decided to go for this in my users table: time when the user registers time when the user verifies visit count time of last visit What other statistics am I missing? Should I track each login time in a separate table too? Is that considered good auditing or too much? There ar...

Microsoft API to export MYSQL data to Microsoft project

Hi, I am required to generate a Microsoft project file with some data MYSQL database. Since the application I am writing is a PHP application, is there a way to create a Microsoft project file like we do data export to excel file using some libraries. Any help would be highly appreciated. ...

Save to session - Does a cache mean the back end code doesn't always run?

Hello SO, So for a bit of background, I am creating a website with the Zend Framework. There is a page where I am using AJAX to save a rating to my database. I obvious need the key for the store in order to know what store the rating is to be saved for. In order to access the store for the page, the URL is MYSTORE.com/stores/2. The ...

Problems using GROUP BY in MySQL in a query that does a JOIN on two tables

I have two MySQL tables, $database1 and $database2. Both have a field in them called ID. I am passing the name of a town to the file using GET (i.e. it's in the URL of the PHP file that holds this code). I can run this query... $PlaceName = $_GET['townName']; $PlaceName = mysql_real_escape_string($PlaceName); $sql="SELECT * from $da...

Testing website mailing locally

I'd like to test password recovery and similar email related features for a website. I'm using PHP (cakePHP framework) and the syntax seems easy enough but I'm unsure of the email server setup. I've looked around for a good tutorial but they aren't specific enough. What is a quick and easy mail server to use locally? also... some init...

304: Not modified and front end caching

I am using a PHP script to serve files. I would like to be able to send back a 304 not modified header in my http response if the file has not changed since the client last downloaded it. This seems to be a feature in Apache (and most other web servers), but I have no clue how this can be implemented through PHP. I have heard of using ...

Value as the key

I have an array like this: $options[0] = 1; $options[1] = 2; $options[2] = 3; $options[3] = 'something'; How can I have the value of each array element put as the key, so the array looks like this: $options[1] = 1; $options[2] = 2; $options[3] = 3; $options['something'] = 'something'; Is there a built in function for this? ...

CURL Authentication being lost?

I am authenticating a login via CURL just fine. I have a variable I am using to display the returned HTML, and it is returning my user control panel as if I am logged in. After authenticating, I want to communicate variables with a form on another page within the site; but for some reason the HTML from that page is returning a non-authe...

Downloading SQL schema for SVN in Eclipse

I develop PHP apps in Eclipse and I'm wondering, is there an easy way of downloading my MySQL schema to a specific folder so that when I commit to SVN it's included? EDIT: I'm using phpMyAdmin to export my schema. I'm just wondering if I can automate this step in Eclipse. ...

Questions regarding Lighttpd for Windows

I am using lighty for windows, yes i know it's not linux, but atm can only afford local hosting, which then allows me to do a lot of learning and practicing my web skills. I am aware that fast-cgi, does not work on windows, but I am wondering what other ways, to improve performance are there? Also I was wondering how to hide all those ...

handling php code

morning. I am wanting to take all segments of php code out of a file located on my local server. Problem is i dont seem to be getting anywhere, no php errors just browser errors. $file_contents = "<xmp>".file_get_contents("../www.cms.actwebdesigns.co.uk2/pageIncludes/instalation/selectMainPages.php")."</xmp>"; if(preg_match_all("#<\?ph...

translation algorithm

Recently I am working into the ability of translating a PHP web application from one language to another. Well, most of those I read involves having language files, then display the selected one like this: en.lang.php: <?php $_TEXT = array(); $_TEXT['welcome'] = 'Welcome to My Application'; ?> fr.lang.php: // french (i translated t...

Zend Db Update Not working

My table structure is: TABLE `licenses` ( `id` int(11) NOT NULL auto_increment, `code` varchar(30) collate utf8_unicode_ci NOT NULL, `title` varchar(255) collate utf8_unicode_ci NOT NULL, `description` text collate utf8_unicode_ci NOT NULL, `license_type` char(1) collate utf8_unicode_ci NOT NULL default 'b', PRIMARY KEY (`id`) ) ENGINE...

how to show the result in the same page after submitting the form??

hello guys after getting some answers on my last question ,i released it's not a good idea to use $_SERVER["PHP_SELF"] as the action for form submission , so would anyone tell me what's the right way to submit a form and view it's result in the same page??cause when i put the php script in another file and set the action of my form to i...

PHP warning problem?

I'm new to php and mysql I think I misplaced the mysqli_real_escape_string() I keep getting the following warning on line 3. Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in Here is the php code. <?php $page = mysqli_real_escape_string($_SERVER['SCRIPT_FILENAME']); // Query member data from the database...

PHP and MySQL hit counter multiple pages count problem?

The following script will update the database, but it won't display the correct page count on each different page. It will freeze the page count on the page most of the time for some reason. Here is the PHP code: <?php $page = $_SERVER['SCRIPT_FILENAME']; // Query member data from the database and ready it for display $mysqli = new...