Hi there. I'm a new graduate and yave just started working a few weeks past as a web programmer. I've kind of been thrown in at the deepend and have been put straight on a project that appears on the face of it to be relatively simple, but there a lot of little intricacies that are making it quite difficult.
What sort of work rate will...
I set up a site on my local system using PDO and a MySQL Database. I used PDO because when the site goes on the live server I have to user SQL Server and I was hoping PDO would take care of all my query conflicts.
Now that I'm up on the live server I get an error whenever the application uses the "LIMIT" function. I realize this is a My...
I'm building a PHP application which has to interact with several structurally identical databases. I'd like to use a singleton factory to hand out connections to the databases and minimize the number of duplicate connections. I'd also like to wrap the database class with a few functions.
It would be extremely convenient if I could do a...
Im a little stuck. I developed a script and for some reason it is converting & in URLs to & automatically.
This is the line that is causing the issue:
$accessToken = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id=' . APPID . '&redirect_uri=' . APPURL . 'callback.php&client_secret=' . APISECRET . '&code='...
Hey everyone, I've been using PHPUnit to to do unit testing on a Symfony/Doctrine project I'm working on. It was working fine until yesterday when various classes dropped from 100% coverage to 98-99%. The reason for the change is because the opening left brace of these classes is no longer considered "covered" for some reason. Here's a s...
I have a listener which contains a preSave() method. Is there a way for me to halt doctrine
from calling the save method if a condition fails. Unfortunately I am not allowed to throw an exception. Is there any other way?
...
I wrote a script that sends chunks of text of to google to translate, but sometimes the text, which is html source code) will end up splitting in the middle of an html tag and google will return the code incorrectly.
I already know how to split the string into an array, but is there a better way to do this while ensuring the output stri...
I have a large list of strings (1500 email addresses to be more specific) and I need to look up a piece of data in a very large DB table for each of the strings (e.g. the primary key, mydataitem). How can I do it efficiently?
For example, this is way too slow (amongst other problems):
$stringArray = ('foo','bar','baz',..., 'for 1000s...
Flex vs. PHP: What are the pros and cons of each? Which language should I use?
...
I am working on an apartment CRM of sorts and I would like to allow renters to be able to pay bills online. My issue is that I don't know how you would implement a system that would work in this case. I would both need to accept payment from landlords/owners for providing a service to them and also allow them to collect rent from their r...
Hi,
I get UTF8 text from a database, and I want to show only the first $len characters (finishing in a word). I've tried several options but the function still doesn't work because of special characters (á, é, í, ó, etc).
Thanks for the help!
function text_limit($text, $len, $end='...')
{
mb_internal_encoding('UTF-8');
if( (mb_...
I run a server that is getting killed by the number of requests it is getting from one of our iPhone games for storing scores. By this I mean the server becomes unresponsive.
I only really know enough MySQL/PHP to get by, so I am floundering in my attempts to fix this. I am sure its a problem that can be optimised because we have a dedi...
I'm doing it to image uploads to prevent any embedded malicious code. Am I right in doing this?
But yeah my main question is how to actually do it, because I've never used ImageMagick before - I've just installed it on my server.
...
I created a custom template (mytheme/template/catalog/navigation/left_parent_category.phtml) to display the parent categories of the current category.
<?php
echo '<div class="box base-mini">';
echo '<ol>';
$currentCat = Mage::registry('current_category');
if ( $currentCat->getParentId() == Mage::app()->getStore()->getRootCa...
I have 2 database connections, and I want to get the last inserted ID from one of the connections.
$old_database = mysql_connect('host', 'username', 'password');
mysql_select_db('database1', $old_database);
$new_database = mysql_connect('host', 'username', 'password',true);
mysql_select_db('database2', $new_database);
$sql=mysql_query...
Hello,
I've saved a user's respective picture in a folder named 'profileportraits'. So when a user uploads their picture, it is saved into that folder. Furthermore, I also save the 'portrait path', i.e. the location/name of the photo onto a MySQL database for user data. My question is: I am able to echo the Portrait Path, where the user...
Hi,
Let's say I have a website called (example.com) which will have a php file (example.com/call.php).
call.php will have a post method that will post to the website exampleOne.com/login.php with the right parameters. exampleOne.com will return a header with a cookie that will confirm the authentication of the user, how do I obtain the ...
Using PHP 5.3.2 I'm handling an Exception in a catch block. After logging the error, I want to pass it on for the Framework to handle. When I try to rethrow the exception, throw $e, the current catch block is reexecuted causing a duplicate entry in my log and then the exception is passed on up.
...
hey guys,
i wonder if there's a secure way to deliver a password with an URL (like ?p=mypassword)
how can i encrypt and decrypt such a password so it's secure.
i guess md5 is not working in my case because the password must still be readable. It's an FTP passwort which gets passes along to the ftp_connect. i think md5 doesn't work in t...
I've got this snippet of code that I will be replacing in various places and I was wondering how would I write the pattern to preg_replace it? Thanks!
<div class="leftside item1">
<label for="item1">Item1</label>
</div>
I'd like to replace it with:
<div class="leftside item1">
<label for="item1">Item1</label>
</div>
<di...