php

PHP file not being run

I have a PHP file that I'm trying to run. However, my web browsers act like it doesn't exist. For example, Firefox tries to open the PHP file Chrome says This webpage is not available. Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error. Internet Explorer says Internet Explorer cannot display the webpage I'm trying to access this php ...

Doctrine yaml for a One-To-Many And One-To-One Relationship

I have two objects: File and FileDetail. A File can have many FileDetails, but a FileDetail can only have one File. I can get this to work, but I can't delete anything from the database because of key constraints (I can't delete the File row because FileDetail depends on it, and vice versa). I have the following yaml: File: columns: ...

converting csv string to a string with spaces instead of commas in php

I'm having a string which is comma seperated like this $str = "john, alice, mary,joy"; Some are having space after comma and some don't. What I want to do is remove all the commas and make them like this: $str = "john alic mary joy"; What is the best way to do this in php? ...

Eclipse PHP Zend: "workspace in use" when i try to set my workspace in Apache2/htdocs ?

i am trying to use my workspace C:\Program Files (x86)\Zend\Apache2\htdocs, as i need to in order to use my Zend Server, but i get the error "workspace in use" i have: deleted all other copies of eclipse that i used looked for a .metadata folder but not found one in my current eclipse folder (brand new eclipse PDT with Zend) any ide...

How to check whether every character is alpha-numeric in PHP?

preg_match_all("/[^A-Za-z0-9]/",$new_password,$out); The above only checks the 1st character, how to check whether all are alpha-numeric? ...

PHP anchor question.

Is there a way to reload a PHP page when a users clicks a PHP link and then have the page jump to a certain spot on the same page using PHP or JQuery like an HTML anchor? Here is the PHP link below. <a href="../index.php?uid=' . $user_id . '&view=member">' . $user_name . '</a> ...

PHP DOM, Find the text within a certain div

I am currently working a developer tracker for a game without using regex. I have hit a road block when trying to parse html at certain parts. What I am trying to parse: <td class="alt1" id="td_post_139718"> <!-- message, attachments, sig --> <!-- icon and title --> <div class="smallfont"> <img class="in...

Elseif include, and echo an outside variable?

I have an Elseif statement, which gets a template name and includes the template PHP file which contains a large array, it outputs the result on the page. $template = str_replace("-","_","{$_GET['select']}"); if ($template == "cuatro"){ include("templates/cuatro.php"); echo $page_output; } elseif ($template == "o...

change the profile picture in twitter for every tweet

Hi, Is it possible to change the profile picture for every tweet via twitter api and it wouldnt change the profile pictures on the previous tweets? for example: i am going to tweet something good so i would want my profile picture to be something happy. and then on my next tweet which seems to be something not good, i would like to ch...

PHP function to turn arbitrary "description" into valid xml data for podcast feed

I am reading the documentation for creating a podcast feed suitable for iTunes, and the Common Mistakes section says: Using HTML Named Character Entities. <! — illegal xml — > <copyright>&copy; 2005 John Doe</copyright> <! — valid xml — > <copyright>&#xA9; 2005 John Doe</copyright> Unlike HTML, XML supports only five "named c...

SQL query works when run as query on server, but will not work from PHP code

I'm running this via PHP and well the first query gets run perfectly then right after it I run the second query and it does nothing. Its rows never get updated for some reason, but when I type out the query manually on the sql server, it works perfectly. Anyone have any idea why its not working in the php code? $qry = "UPDATE Matches S...

Redirecting IP if it's between a certain IP Range

I'm using a redirect if the user's ip is between a certain IP range. However, I'm using multiple ip ranges, so I'm wondering the best way to do this. I'm current using this to redirect, ); // read user ip adress: $ip = isset($_SERVER['REMOTE_ADDR']) ? trim($_SERVER['REMOTE_ADDR']) : ''; if (($i = array_search($ip, $deny_ips)) !== F...

Filling a PDF template with PHP

Hi there, I have a PDF file that functions as a template containing only textboxes. Is there any way I can fill the fields in via PHP? I have found examples of how to directly draw onto a PDF document when given x,y values, but I want to put values into my textboxes rather than doing that. ...

Increment by any constant number in a single SQL Update statement?

Update a field by +1 (or any other integer increment) in table in sql, (PHP - Im using txt-db-api) in a single update statement. Something like UPDATE tablename SET current_value = current_value+1 where condition=true Although field is integer type but is not Auto_Increment type. Edit Actually I am not using MySQL but a flat t...

How to using replace with variable?

$aaa = preg_replace('/<%var.\$(fullname).%>/is', $_SESSION["\1"], $aaa); ...

In PHP what is the most efficent way to get the last day of the previous month, regardless of what day of the month in the current month you are?

I need to be able to get the last day of the previous month into a date variable. The script could be run on any day of the current month. It needs to dynamically adjust even if the last day of the previous month falls on 29,30, 31 etc. What would be the best day to do this? ...

objects..better arrays?

I was just reading through a tutorial and they mentioned that Objects in php are just the better way of arrays. I am confused? Can someone clear the concept for me. thanks ...

Creating a PHP script that emails a file to the user

I'm planning to write a PHP script where a user goes to a particular page, clicks on a link, and a form comes up asking for the user's email to send the file to. After the user selects send to file is sent to their Gmail, Yahoo, Hotmail, whichever. After a successful send, an email is sent to me notifying me of the action. So far I've c...

How to upload Excel or CSV to MySQL data base using PHP?

I have an Excel file containing data(list of Phone numbers), and i want that data from, Excel file to be imported in to my Database table(for example called phonenumber_list) using PHP code? i know how to convert MySQl in to Excel, but can it possible in reverse? Please Help! ...

php, redirect to another page

Hi, how in php script redirect in to another page? Now i try header, but this don't work - before header() is echo. This, I do not want to use: echo "<meta http-equiv='refresh' content='1;URL=?".$link."'>"; ...