php

php/symfony/doctrine memory leak?

I'm having problems with a batch insertion of objects into a database using symfony 1.4 and doctrine 1.2. My model has a certain kind of object called "Sector", each of which has several objects of type "Cupo" (usually ranging from 50 up to 200000). These objects are pretty small; just a short identifier string and one or two integers. ...

help with simple query

My config table: name | value --------+------ version | 1.5.6 title | test How I try and get it: $getCfg = mysql_query("SELECT * FROM config"); $config = mysql_fetch_assoc($getCfg); echo $config['title']; Equals to: Notice: Undefined index: title in C:\web\index.php on line 5 How would I get the value where the name is tit...

Naming conventions for cookies in PHP

When it comes to cookies and PHP, what naming style do you use? Here are a few styles I can think of: lower_case camelCase UPPER_CASE ...

Why imageboard scripts do not use database?

I was very surprised when downloaded two imageboard php scripts. There is no connection to database, threads and posts are listed as files and folders. Is this way faster than standard mysql database connection or there is another reason? ...

Will PHP load all files references in a page?

I am working on a cache class, I would like to be able to set and get cached items from 5 different storage mediums. Memcache, APC cache, file cache, sessions, cookies. Maybe even a 6th (database could be added as a 6th). My goal is to make this flexible enough that I can use it in the future on many projects very easily (portable). ...

How to know if an object from a relation exists in the database.

Hello. I'm using Symfony with Doctrine. I have two classes defined, Person and Student, a relation one to one. Each Student is related to a Person, but not every Person has a relation with a Student. When I call ... $person->getStudent(); ... I always get and object, regardless some Person's doesn't have a Student. How can I know ...

Is it bad to call a singleton method many time over and over on a page in PHP?

In PHP if I create a singleton method for like 5 different caching classes (memcache, apc, session, file, cookie) Then I have a main cache class which basicly routes my set() and get() methods to the appropriate caching class. Now lets say I need to use the session, cookie, memcache, and file cache all on the same page. My main cache ...

PHP namespace simplexml problems

Evening guys. Firstly to say, I have read http://stackoverflow.com/questions/1133897/how-do-i-parse-xml-containing-custom-namespaces-using-simplexml. I'm parsing an XML document from a source not mind, and they use a custom namespace. <?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:moshtix="http://www.moshtix.com.au"&g...

how to change these lines of javascript from scriptaculous to jQuery syntax

I am rewriting a helper class which was originally built on top of Scriptaculous. I am moving to jQuery - however, I am stuck on a couple of lines, that I need help with (see below): Note: the javascript code is interpersed with php variables (the sigils being a dead give away) Statement 1 'new Insertion.Before(\'' . $updateContainer ....

Mysql subquery fails, need help :)

I have a table PICTURES: username varchar(50) picture_id varchar(50) datetime ...and I have a table FRIENDS: user_1 varchar(50) user_2 varchar(50) datetime When you have friends on the website your username goes in user_1, and your friend username's go in user_2. For each new friend a new row... I want to show the 5 last ...

Any php function to download an image from web and save it in my server?

Hi, is there a function in php which allows to download external file from another server, and put it in mine ? Thank you ...

Is there ANYTHING bad about the Registry design pattern?

Is the Registry design pattern a good solution for this in PHP? For a social network site (facebook, myspace). let's say I have a Database class which creates a single DB connection and lets me do DB stuff and a Sessions class which lets me handle sessions as well as a Cache class which lets me cache items and retrieve them. SO that...

Posting information and retrieving results using Ajax

I would like to using (Ajax) PHP or Javascript, Post information to http://en.lernu.net/cgi-bin/vortaro.pl then read the results back (Not from lernu.net). I am trying to learn Ajax, PHP + Javascript, Nobody there know's how to help me. I would very much like doing this without touching Lernu's code, So if there is a way to do it al...

Unable to send email through gmail using PHPMailer_v5.1

I am trying to send email through gmail using PHPMailer_V5.1. Getting the following error, SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (41961176) SMTP Error: Could not connect to SMTP host. The following is the code which came with the PHP...

Get MYSQL Data Into AJAX

I'm an AJAX novice and I'm having major trouble trying to get data out of mySQL and into my javascript function. What I want to do is loop through my data in php and somehow send that data into various named divs on the page. Here's the code from my javascript page: function loadPageContent(){ var projectID = getQuerystring('pid'); ...

is there a way to not stop script if errors found?

Hi, i have a php script which sometimes makes some light errors that are not important, but the script stops executing next lines. i want some ini_set or something to make it executes all the script even if there is warning or errors. note: i can't fix those errors. Thanks ...

Find text in string in PHP

This should be pretty straightforward, but I can't seem to find an explanation anywhere on how to do it. I have a string in PHP. That string might contain within it somewhere the substring ":ERROR:". I need to find if it has that string. strpos() has worked perfectly up to this point, until today when ":ERROR:" was the first item in th...

Drupal: Fivestar Block with voting axis

I'm using fivestar 1.19 with voting axis. I believe the default fivestar block/fivestar function uses only the default 'vote' tag. fivestar_widget_form($node) I need to pass my custom fivestar tag to the function. Attempting to follow the answer below: For me $object is $node. <?php function custom_fivestar_widget ($object) {...

Updating MySql using AJAX in jQuery Dialog Box

I have the following code and the SELECT is working correctly to pull in the form data, however, the UPDATE statement is not working. Any suggestions on what could be corrected to make it work would be greatly appreciated. <?php include 'includes/config.php'; require_once('includes/auth.php'); if ( isset( $_GET['aj'] ) &&...

How to stop PHP from logging PHP Notice errors

Hello, I'm trying to not log notice errors, which are being written to an error log file on my server. I've tried (at the top of my index.php): ini_set('display_errors', 0); error_reporting(E_ALL ^ E_NOTICE); But I'm still getting PHP Notice errors in said error log file. I'm on a shared hosting environment, so I can't edit my php.in...