php

Drupal - How to update a CCK NodeReference field programmatically?

I'm trying to create a node (B type) & assign it to a A type node's CCK nodereference field using node_save() method. $node_type_A = node_load($some_nid); $node_type_A->field_type_B_node_ref[]['nid'] = $node_type_B_nid; $node_type_A = node_submit($node_type_A); node_save($node_type_A); As the result, a new B type node will be create...

PHP MySQL database problem

Code 1: <?php class dbConnect { var $dbHost = 'localhost', $dbUser = 'root', $dbPass = '', $dbName = 'input_oop', $dbTable = 'users'; function __construct() { $dbc = mysql_connect($this->dbHost,$this->dbUser,$this->dbPass) or die ("Cannot connect to MySQL : " . mysql_error()); mysql_select_db($this->dbName) or die ("Datab...

Modify XML attribute PHP DOM

I have an XML file that looks like this. <collections id="my collections"> <category id="my category"> <record id="my record"> <title>Some Info</title> </record> </category> </collections> I am looking for away to replace any attribute in the above XML file with a new attribute,Using PHP DOM and Xpath. Any help is highly ...

How can I add a plugin to the registry while using a Zend_Form?

I have a zend form that I'm initializing as follows: $form = new Form_XYZ(); I have a display group in that form, which I'm calling like this: $form->addDisplayGroup($generalSettingsGroup, 'general', array( 'legend' => 'General', ...

Formal name of Magento’s Class Override Design Pattern?

Magento is a newish (past 5 years) PHP based Ecommerce system with an architecture that's similar to the Java Spring framework (or so I've been told) One of the features of the Framework is certain classes are not directly instantiated. Rather than do something like $model = new Mage_Foo_Model_Name(); you pass an identifier into a s...

MYSQL update query php

I am trying to use an update query to change values held in a database, the new values I am trying to store are held in php variables. I'm not sure what it is I'm doing wrong. mysql_query("UPDATE user SET status='full' WHERE user_id = '$user_id'")or die(mysql_error()); here is the error message Duplicate entry '91317691' fo...

PHP preg_replace need help with pattern

Exsample preg_replace('/\{[a-zA-Z.,\(\)0-9]+\}/', 'Replaced', 'Lorem ipsum dolor sit {tag1({tag2()})}, consectetur adipiscing elit.'); The result: Lorem ipsum dolor sit {tag1(Replaced)}, consectetur adipiscing elit. Question As you can see "tag2" has been replaced, But i whant to replace "tag1" Do anyone know how i can do this? (I...

Best way to handle Many-to-Many relationships in PHP MySQL

I am looking for the best way to handle a database of many-to-many relationships in PHP and MySQL. Right now I have 2 tables: Users (id, user_name, first_name, last_name) Connections (id_1, id_2) In the User table id is auto incremented on add and user_name is unique, but can be changed. Unfortunately, I don't have control over the us...

clean html a string by element id using php

Hi, as you can see by the subject am looking for a tool for cleaning up a HTML string in php using a HTML id property, example: According to the following PHP string I wish to clean the HTML erasing the black11 $test = ' <div id="block1"> <div id="block11">Hello1 <span>more html here...</span></div> <div id="block12">Hello2 <s...

Generating Graph with 2 Y Values from Text File

Hi all, I have remade my original post as it was terribly formatted. Basically I would like some advice / tips on how to generate a line graph with 2 Y Axis (temperature and humidity) to display some information from my text file. It is contained in a textfile called temperaturedata.txt I have included a link to one of my posts from t...

CodeIgniter Images

Hi, Using CodeIgniter, I am trying to place several images onto my view page as follows ... <?php foreach($results_found as $item): ?> <tr> <td><?php echo base_url();?>images/$item->img.jpg</td>? <td><?php echo $item->title ?></td> </tr> ... but all this displays is the url for the images. I've stored the names of the image...

Mysql - NOW() function calling

Hello, I'm using php for making queries for mysql. Here is one: UPDATE `subscribers` SET `curDate` = NOW() WHERE `e_mail` = "$resEmail" curDate - DateTime type. The problem is that after this query curDate of given email is 0000-00-00 00:00:00 What's wrong? ...

php website url matching question

hi, i am new to a php site, only familiar with .net web forms sites. i can't figure out how routing is working on this php site. www.oursite.com/suggestions.php is to suggestions.php www.oursite.com/suggestions also loads the php fine www.oursite.com/suggestions/ loads the php, but no css is applied www.oursite.com/suggestions/anythin...

Javascript - find swfobject on included page and call javascript function

I’m using the following script on my website to play an mp3 in flash. To instantiate the flash object I use the swfobject framework in a javascript function. When the function is called the player is created and added to the page. The rest of the website is in php and the page calling this script is being included with the php include f...

php calling mail and failing

hi i am trying to set up a home page with an email form, where i can fill out email address and subject and comments and the php page will run mail -s [email protected] $comments how can I do this via php to call the linux command? thanks in advance ...

Is it possible to 'snag' a web page image in PHP?

What I mean is to get the rendered HTML and make a Jpeg/GIF out of it. The idea is to make a digital snapshot of a page. ...

disconnect dialup from php

I have an application for a client and it asks me to retry the internet connection in order for the host to acquire a new ip. Problem is, I can't find a way to disconnect and connect back again with the internet connection using php. Any ideas? ...

Non PHP site generates PHP errors

Hello. I have this error appearing: Parse error: syntax error, unexpected T_STRING in /home/ondesign/public_html/ywamleicester.org/index.html on line 1 Which I think is a PHP error. However, the site in question is an out of the box iweb design with no PHP in it. I have no idea what could be doing it. ...

have PDF form, need to port to website

So here is what I have: a PDF form (job application) that a client is requesting to put on their website as a form and the data gets sent to them when an applicant on the site fills the form out. My idea is as follows: dissecting the PDF, taking its fields and making the HTML form, then processing on the server side, creating the new PDF...

php socket servers, actionscript 3 and multiplayer

So I am thinking about creating a multiplayer game and I was wanting to use php because I already have a php server. Is it possible to make a socket server that will be able to handle a actionscript multiplayer game. The game won't be big. so we wont need any huge amount of data pushing through. just some software that is probably reliab...