php

problem in using while loop in php&mysql

hey guys im using a while loop to show my latest forum topics and count some fields I'm trying to do it in one query and here is my code : SELECT t.*,p.*, SUM(t.topic_approved='1') AS Amount_Of_Topics, SUM(t.topic_views) AS Amount_Of_Topic_Views, SUM(t.topic_replies) AS Amount_Of_Topic_Replies, SUM(p.p...

How to read smarty config variable from PHP behind?

What function can I use in PHP for class Smarty which reads a variable's value from the Smarty's config file? Here's my code: <? session_start(); require('libs/Smarty.class.php'); $smarty = new Smarty; $smarty->config_load("settings.conf"); include('settings.php'); include('meta.php'); $smarty->debugging = false; $smarty->caching...

Detecting file upload size on the client side?

I'm using PHP for file uploads. In the PHP manual it shows an example using a MAX_FILE_SIZE hidden field, saying that it will detect on the client side (i.e. the browser) whether the file is too large or not. I've just tried the example in Firefox, Chrome and IE and it doesn't work. The file is always uploaded, even if it is way larger ...

for loop not suitable?

I have created a for loop. I am trying to loop through lots of members and create a row for each member in a table. It's looping through too many times. Is it the right type of loop to use? <?php for ($i = 1; $i = count($u); $i++) { ?> <tr> <?php echo "<td>$i</td>"; ...

gsm character encoding.

in php how can i convert normal text + accented characters in utf8 to gsm format for sending via sms. ...

iframe widget: know which domains are iframing the canvas?

If i have a php generated widget canvas and site's using the widget iframe it with $_GET parameters, is there anyway to get the domain that's making the request to my canvas page (javascript/php?)? ie - stop people using my widget that don't have permission... ...

Why is the value not passed to my controller page in codeigniter?

I am selecting state from country and city from state. This is my country select box: <td width=""><select name="country" onChange="getState(this.value)" class="text_box_width_190"> <option value="0">Select Country</option> <? foreach($country as $row) { ?> <option value="<?=$row['dCountry_id']?>"...

Looping through with double variables

I have two arrays with two sets of values in ($a[] and $b[]) I want to do something like the following: $a[0] - $b[0] $a[0] - $b[1] $a[1] - $b[0] $a[1] - $b[1] This will continue until the arrays reach the end. So i want a hyphen to seperate the two arrays, with the first array staying the same until the second array has looped throu...

cascading dropdown value doesn't seem to get posted to my php page?

i am using cascading dropdownlist for showing states of a country... I get the country dropdown value but not the state dropdown value.... I am populating state values via ajax... echo $country = $this->input->post('country'); echo $state = $this->input->post('state'); When inspected through firebug it shows all the option values of...

Printing Script Codes.

I wanna print out script's codes after the output. The script goes on different ways on the way it calls. So i wanna see it when script runs. is there any function that prints all script codes as the way it writed. Example: $foo = "bar"; $foo .= " is my bar"; function foobar() { // do some stuff here } i wanna see the codes just lik...

Making a module based social networking cms

What does it take to create a social networking cms like phpfox or socialengine . I am interested in using php / mysql . However , I want it to be modular , like above examples . Like I can enable disable videos from backend . Most important , it should have ability to allow others to extend it , like facebook applications . Shou...

Apache crashes, probably because of this piece of php code. Can you have a look?

I am working on the development of a web based application on codeigniter. I wrote this function to get the timezone data for any city or address. function gettimezone($address) { $_url = 'http://api.local.yahoo.com/MapsService/V1/geocode'; $_url .= sprintf('?appid=%s&location=%s',"phpclasses",rawurlencode($address))...

problem to Get Date, month Year separately From database in Php File ?

i want to separate date, month, time, hour, min ,sec getting from database, for count down timer, in data base stored date is 2010/10/10: me using this code : $m=date('m',$row['Date']); $d=date('d',$row['Date']); output is month=31 date = 12.... ...

php and mysql primary key question

Hi All, I have one simple table. the primary key column name is id. I have almost 200 records and some how i deleted some of the records. Now the id column has following entries 1 2 4 5 6 8 9 Can any body tell me what query can I write that return me all the missing rows? For example 3,7 rows in above example. Or any php funtion that ...

Referencing a file in a parent directory

Is this the right way to go about referencing a file in a parent directory relative to a php source file?: require_once('../referenced_file.php'); ...

PHP classes, parse syntax errors when using 'var' to declare variables

I am a C# guy trying to translate some of my OOP understanding over to php. I'm trying to make my first class object, and are hitting a few hitches. Here is the beginning of the class: <?php require("Database/UserDB.php"); class User { private var $uid; private var $username; private var $password; private var $realname; ...

PHP Multiple form tokens

I understand the idea of generating a form token and storing it in a session, and also putting it as a hidden input in my forms. But how could I make this work if I have pages with multiple forms, is it still safe to use the same token for each form? And I still feel weary about bots and stuff on my website, can these form tokens reall...

cell data format problem while getting php excell output

Hi everyone,i created an application that takes the excell output of a table.There are long numbers in table cell.When i took the output the cells that have long numbers are seen like that 1234+E34.how can i fix that?Thanks for advance... ...

PHP Commercial Project Function define

Currently I am working with a commercial project with PHP. I think this question not really apply to PHP for all programming language, just want to discuss how your guys solve it. I work in MVC framework (CodeIgniter). all the database transaction code in model class. Previously, I seperate different search criteria with different fun...

HWID locking a PHP page?

Currently I sell a program, that accesses my webpage. The program is HWID (Hard Ware ID) locked, and the only reason I use the program to access the webpage instead of direct access via a webbrowser, is so that I can use HWID authentication. However, I've just been told I can code a script to get computer information, such as hardware I...