php

what does @ means before include or require

hey guys i wonder what does @ means when we use it before include or require in php ?! such as : @include('block.php'); maybe its a noob question , but i need to know it guys ?! so sorry for that ...

cut text after (x) amount of characters

This is in wordpress (not sure that makes a difference) This bit of php outputs the post title <?php echo $data['nameofpost']; ?> It's simple text which can be anywhere up to 100 chars long. What i'd like is if the chars outputted are over 20 long to display '...' or simply nothing at all. Thanks ...

IIS 6.0 .htaccess

You can 'fake it' .php being a .html file using .htaccess: AddType application/x-httpd.php .html .htm how can i do this in using IIS 6.0? ...

How to find duplicated field values and delete them in MySQL

Consider we have a field named (username) in our table named (tpl_users), now this table has lots of duplicated rows I wrote this code to delete duplicated usernames: Delete FROM tpl_users WHERE username = username; How is it possible to delete duplicated usernames? ...

General Question about MD5

So im just playing around with PHP and the MD5 functionality, sorry if this sounds really silly, but I cant seem to understand, how is it possible to represent an unlimited number of characters of input into a 32 bit character output? Is my logic sound here? Or is there a limit to the input that a MD5 function can take? Thanks... ...

PHP exec not working with gcc

I just spent a few hours pulling my hair out over this. I'm trying to get gcc to compile a file from within PHP. $command = "/usr/bin/gcc /var/www/progpad/temp/tNu7rq.c -o /var/www/progpad/temp/tNu7rq.out"; exec($command, $output, $returnVal); echo $returnVal."<br />"; //returns 1 and no output file created. I'm running th...

how to add multiple filters to pagination?

Hey, I am trying to allow multiple filters to be selected for my pagination script. So in my pagination, when a user clicks the 'marketing' button(link) it queries the database just for the category that = marketing. The same goes for the other 2 filter buttons as seen in the script below. (automotive, sports). The problem is, I want t...

Run PHP code on a specific domain only

I need to echo out some specific php code only on the sub-domain of a site. This is where I am so far. <?php if($_SERVER['SERVER_NAME'] != "http://support.demo.com") echo "<?php bb_head(); ?>"; ?> Of course if this worked I'd not be asking a question. Help is appreciated. ...

IIS + PHP url rewrite

Is there any way to rewrite an url of a php app on iis? If yes, how ...

MySQL SELECT statement that groups results by id?

Hi all, I am trying to create a MySQL SELECT statement that will select a bunch of rows from a table and will group the results by the id of the row (multiple rows will have the same id). Here's an example of what I'm trying to do. Let's say I have the following table: id | name 1 | Art 1 | Arnold 1 | ...

How php and own frameworks works in background ?

i am new on web programming .i am good on c# .net platform on desktop. i tried to understand php and php frameworks but i get confused a little . i understand that a php file can import classes which is in the file into another php file with require_once function. but frameworks doesnt import his own classes with require_once function...

where to store helper functions?

i've got a lot of functions i create or copy from the web. i wonder if i should store them in a file that i just include into the script or should i store each function as a static method in a class. eg. i've got a getCurrentFolder() and a isFilePhp() function. should they be stored in a file as they are or each in a class: Folder::g...

Masspay and MySql

Hi, I am testing Paypal's masspay using their 'MassPay NVP example' and I having difficulty trying to amend the code so inputs data from my MySql database. Basically I have user table in MySql which contains email address, status of payment (paid,unpaid) and balance. CREATE TABLE `users` ( `user_id` int(10) unsigned NOT NULL auto_i...

How to persist a very abstract data type between sessions: PHP

I have an abstract data type that behaves much like stack. It represents a history of "graph objects" made by a particular user. Each "graph object" holds one or more "lines", a date range, keys, and a title. Each "line" holds a sql generator configured for a particular subset of data in my db. I would like for these "histories" to b...

popen fails with "sh: <command>: not found"

I'm developing a server application and I recently encountered this wierd error on a testing server (Debian Squeeze). Every executable I pass to popen fails with a msg: sh: sort: not found // happens to any command This happens regardless whether I point to the full path returned by "type" or keep it short . As mentioned earlier, thi...

YouTube API, jQuery attr won't swap element attributes (I think) in IE, but works in FF

JavaScript (jQuery) function display_youtube(new_url) { $('#movie_url').removeAttr('value'); $('#embed_url').removeAttr('src'); $(document).ready(function() { $('#movie_url').attr('value', new_url); $('#embed_url').attr('src', new_url); $('#shade').css('display', 'block'); $('#youtube_player')...

How important are classes? (PHP)

I dont know much about classes, but have a reasonable knowledge of PHP/MySQL. But why should I learn classes? I know they are important but what benefits can I see using them that I cant with? ...

How can I create an email newsletter by taking objects from a database?

Well, I'm trying to create a newsletter, that will send emails to users in a database. The newsletter itself would draw "events" and other activities from a database. Whats the best way to take that list, and put them in an email? I was thinking about putting them into an html page, then sending an html email, but not all emails support...

how can i retrieve the caller's path?

in a script i call another class with: Factory::folder(); but when i specify... dirname(__FILE__) ...i get the library's path, not the caller's. how can i have the caller's path? thanks ...

PHP 5.3 and '::'

Hello, I started into PHP with 5.3 and am using the '::' to access constants ex; class::const. However, when I try to use my code in an older PHP namely 5.1.6 and 5.2.12, I get an error that the '::' is unexpected. How do I access constants in these older versions of PHP5? ...