php

Why is this Variable Disappearing?

This should probably have a simple answer I just can't figure out. Anyway, I have a php document and inside of it I define <?php $pathprefix = '../'; ?> Later in the document I use an <?php require([somefile.php]); ?> and inside of somefile.php, I have a line that says <?php echo($pathprefix); ?> but the '../' I assigned to $pathprefix...

Better Than MVC Pattern

I know there has been much shout about the goodness of MVC pattern. My question is that is there any pattern better than MVC to be implemented in PHP? I don't know but other pattern might have advantages over the MVC pattern. So actually I am in search whether there is something better than MVC. Thanks in advance. ...

CodeIgniter, newbie questions

Hi, I want to program in the CodeIgniter few domain and 2 admins under a linux machine. one.com two.com three.com ....com and in addition to i need two backend systems. reports cms only few things are similar between the domains. and can be shared what is the best folder structures for that? after you suggest your structure, how do...

Get the __FILE__ constant for a function's caller in PHP

I know the __FILE__ magic constant in PHP will turn into the full path and filename of the currently executing file. But is there a way I can get the same information for a function's calling file? For example: //foo.php: include "bar.php"; call_it(); //bar.php function call_it() { echo "Calling file: ".__CALLING_FILE__; } which ...

PHP: display entries from Database in groups of five?

Hi, Is it possible and if so, how can I do it, to select all entries in a table in my database and then display five results at the time in one group. Meaning: A example is that I've 15 records total in my database, then I want to present my data like this: <div class="1-5">Record[1], Record[2], Record[3], Record[4], Record[5]</div> ...

getting the "include path" to a file in PHP

I can get the currently executing file with the __FILE__ magic PHP constant, but this gives me /var/www/vhosts/.../httpdocs/stacktrace.php. I am trying to get the name of the file so I can pass it into a hidden form field, and then run that script again after the form is submitted. The script whose file name I am trying to get could be ...

How to export all functions inside PHP extension?

I opened php_sqlite.dll & php_sockets.dll using Depends.exe. I saw only 1 function in both: get_module How can I export all functions in extension to dll files when compiling the .dll? AFAIK, ZEND_FUNCTION is used to declare functions in the modules. Please kindly advise. Thank you very much! ...

Is there anyway to run PHP script automatically without user interaction?

hi, I want to send mail to user daily. For that I will store the database some records. The PHP Script will send each record daily as mail to the user. These should be done automatically without admin or user interaction. Please give me some help or suggestion ...

Retrieving names of over-ridden theme hooks in views 2 (Drupal 6)

I have a created a view (lets call it my_view). In the theme: information section if the view I have noted one of the suggested template names (views-view--my-view--default.tpl.php (or close to that)), and created my own template file with that name. This all works fine and when I visit the theme registry, I can see there is a hook the...

How to download an image with PHP?

Suppose the url of the image is here: http://sstatic.net/so/img/logo.png How to download it with PHP? ...

cross platform issues in webpages

Hello, I am developing some basic html pages, i am setting colors of text usimg color code #e7eddf it seems fine in windows but seems different in mac. Can you explain me why its happening and also suggest me some work around for that?? I am using firefox on both the mac and windows ...

How to install cron. Im a newbie

I want to run PHP scripts automatically. For that I googled and I came to know about CRON. But I dont know how to install and use it. Im using only PHP, CSS, HTML, and running on XAMP apache server on localhost. How to install. Help Me plz ...

Visibility schedule

I want to have a simple database table to keep track of scheduled category visibility on a site index. Basically it will tell the index to display a Christmas category between Thanksgiving and Christmas day. So far I'm thinking of using a table like this, schedule_id SMALLINT, start_date TIMESTAMP, end_date TIMESTAMP, category_id SM...

python for in control structure

I am a php programmer trying to understand python's for in syntax I get the basic for in for i in range(0,5): in php would be for ($i = 0; $i < 5; $i++){ but what does this do for x, y in z: and what would be the translation to php? This is the full code i am translating to php: def preProcess(self): """ plan for the arra...

sqlite databases won't open in anything else than PHP

I recently ported one of my PHP applications from MySQL to SQLite to make it easier to administrate. For some reason, I can access a the sqlite database from PHP and it works perfectly, but if I try to open it with something else, like sqlitemanager, or the sqlite firefox plugin, the database just seems blank, or it won't open it. Any i...

Most concise and complete Recursive Association Support in CakePHP?

I'm currently mucking about with CakePHP, deciding if I'll use it in an upcoming web application. The problem is, I've got several tables which at some point share relevant data with each other. If I were to write all the code myself I would use an SQL query using rather a lot of different joins and subqueries. But from what I understan...

PHP Script stops processing on a warning error?

Hello all, I have a PHP script that stops processing (it seems to be) on a PHP warning. The error is general "PHP Warning: fopen" - "failed to open stream: No such file or directory". Should PHP stop here? I thought only on fatal errors? Is there a way to get it to continue? ...

HTML PHP Progress Bar

I have a website with a form that uses PHP to send the form data. Is there a way to create a progress bar on the page that looks like it is in action, so that people don't click the button more than once after it's clicked and sending the PHP information. Thanks. ...

want to check day already exist

Hi frnds,i am having one table which is having 7days mon,tue...sun i am inserting some records to these fields..if i i select/enter monday or any exisiting day in drop down or text field it should say day alredy exist else it should insert...i am using following code getting some problem with this whenever i insert values its saying day ...

Remove first line in text file without allocating memory for entire text file

Hey all, I have a very large text file and all I need to do is remove one single line from the top of the file. Ideally, it would be done in PHP, but any unix command would work fine. I'm thinking I can just stream through the beginning of the file till I reach \n, but I'm not sure how I do that. Thanks, Matt Mueller ...