php

How extract part of an URL in PHP?

So, I have this url in a string: http://www.domain.com/something/interesting_part/?somevars&othervars in PHP, how I can get rid of all but "interesting_part"? ...

Check server response in javascript.

I want to check server response in javascript. For example I have a server A which will host the script. On excuting the script it will check if the server B is responding or not. If yest continue other wise redirect to server C. Is this possible with Javascript/Jquery? If not what could be a possible solution in PHP? ...

sqlsrv_connect() not found..

Hey, I recently am working on an projekt that uses the "SQL Server Driver for PHP", i wanted to upgrade the existing driver to the new version (2.0), because I need some of the functions that have been implemented there. Now i replaced the old .dll in the php/ext directory and restarted the webserver. But now i recieve the following er...

'client_errors' warning in output from cron job that runs PHP on GoDaddy

Hi. I have several cron jobs that I've set up on my GoDaddy hosting account through their control panel. The commands look like this: /web/cgi-bin/php5 "$HOME/html/myfolder/cron_do_stuff.php" The jobs runs as scheduled, and the scripts work perfectly, and the output from the scripts always gets sent to my email address. I would lov...

two sql queries in one place

<?php $results = mysql_query("SELECT * FROM ".TBL_SUB_RESULTS." WHERE user_submitted != '$_SESSION[username]' AND home_user = '$_SESSION[username]' OR away_user = '$_SESSION[username]' ") ; $num_rows = mysql_num_rows($results); if ($num_rows > 0) { ...

Create a new instance in a static function of an abstract class

abstract class db_table { static function get_all_rows() { ... while(...) { $rows[] = new self(); ... } return $rows; } } class user extends db_table { } $rows = user::get_all_rows(); I want to create instances of a class from a static method defined in the abstract pa...

Breakpoint doesn't work if I press Resume when debugging osCommerce with xdebug in pdt?

Is this another bug of xdebug? I've already installed the latest version of xdebug for PHP 5.3 yesterday. Introduction of osCommerce is here. Here is the problem description: When I press Resume,the page is directly shown,though there are breakpoints there. Anyone met this problem? ...

For programming content, what simple-to-use-and-setup PHP based blog are the preferred ones?

I've since long wanted a place I can toss my programming related nuggets at. Every day I feel I solve something that I'll surely hit again in a not so distant future, but by then I most certainly will have forgotten about the previous solution I came up with. So I need to blog it down, quick and dirty, for my own documentation and memor...

Cakephp Request data from other controller

Is it possible to request data from an other controller in cakePHP? For example, i created 2 folders in pages called search and update (both with a index.ctp) and a controller and model in the correct folders. Both pages are using a different db source, and i wnat to display some data from the search controller into the view of the upd...

Is there any way to maximize PHP_INT_MAX?

I can't find this row in php.ini, so is there any way to do that? So ok, I understood, the answer is not, then how should I calculate the result of this task if I want it do with php? The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? ...

how to communicate with messenger like vark.com with php?

i wonder how one can communicate with messenger with php like vark.com? is this possible or do i have to use java for it? thanks ...

Remake of this "contact form" to send out emails (Ajax)

I have followed this tutorial, and made everything like the tutorial says... When I click submit it says "this wont actually send out emails". Here is the tutorial So my Q is this, would it be too hard to "actually send out emails" with this? How can I implement it into this? Thanks PS: No JQuery please... ...

Grant Permission to Folder using PHP

I need to grant write permission to temporary folder of all local machine (if it does not have)which access my php site. Is it possible using PHP? ...

PHP echo if post equals, help

I am trying to echo the action for my form if a post equals 'paypal' This is what I have: <?php if $_POST['method'] == 'paypal' echo 'action="paypal/process.php"' else echo 'action="moneybookers/process.php" '?> Do i need to print the variable before I do this? what am I doing wrong? I get this error: Parse error: syntax error, un...

Dynamic pages using FPDF

Hi, I have a link on a page which generates a pdf. I am using fpdf for the same. My requirement is that we have to generate a single pdf with different pages each having footer and header. E.g. a students makes a payment through cash, cheques. I have to generate a pdf displaying payment mode , amount etc. I am running a loop for each i...

Google PHP $event->getEventStatus() incorrect output

I am attempting to check event statuses (google php calendar api), but am getting different results on my local machine as compared to the development/test server. $eventStatusUrl = $event->getEventStatus(); returns the following locally "http://schemas.google.com/g/2005#event.confirmed" but returns the following on the dev serv...

relative path not working for images in css

Hi, I have the following file structure: C:/wamp/myproject/admin/webroot/images I have an index.php file lying inside the admin folder which calls a header.inc.php file lying in the same folder. header.inc.php has the following code- <td align="left" valign="top" class="header-bg"> <table width="100%" border="0" cellspacing="0" cellp...

php: array_replace_recursive alternative

I need a solution for array_replace_recursive, because my php-version isn't high enough. I want to use this code: $_GET = array_replace_recursive($_GET, array("__amp__"=>"&")); easy, isn't it? ...

Problem inserting UMLAUT into mysql database using a php script

Hi all i am developing a script which takes a csv as an input, it then reads the file and insert its contents to a mysql database. So the problem comes while inserting the data to the database. It converts UMLAUT into random characters. FYI -- My database is in latin_german_ci. [ i have also tried changing it to UTF8] i am able to dis...

unable to connect to database on a networked drive

Hi, I'm trying to connect to an access database from a php script using ODBC. When I put the db on my local c: drive create a system DSN i can connect no problem, but when it's on the networked drive I get the error: Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Microsoft Access Driver] '(unknown)' is n...