php

How do I read a text file line by line??

Hi suppose I do have a text file with these lines name: Mathew Age : 32 Country : USA Location : California bla bla bla.... What I want is I want a php code which can read this file and display result to a webpage. ...

Hash tables VS associative arrays [PHP]

Recently I have read about hash-tables in a very famous book "Introduction to Algorithms". I haven't used them in any real applications yet, but wanted to. But don't know how to start. Can anyone give me some samples of using it, for example, how to realize dictionary application (like ABBYY Lingvo) using hash-tables? And finally wanted...

sendin mail in gmail using php

how can we sending a mail in gmail using php ? plz help me.... ...

Which is faster to load, PHP or ASP.NET MVC?

Lets say its just for a simple website with pages such as Home, About, Contacts, etc.. ...

Are Interfaces just "Syntactic Sugar"?

I've been playing mostly with PHP and Python. I've been reading about Interfaces in OO programming and can't see an advantage in using it. Multiple objects can implement the same interface, but multiple inheritance doesn't provide this as well? Why do I need to create an Interface "with no implementation" - mainly a "contract" - if I ...

Adding number should depend on current value

I want to add a number to a var. This number should be bigger when var is small and smaller when var is big. I have calculate the optimum values: when var=1, function should add 125. When var=50 function should add 420. I was thinking about sin function, but I have no idea how to "personalize" this function to work with it. (I am using p...

CodeIgniter: what makes a good model

What makes a good MVC model in CodeIgniter. What my 'user' model does now is basically using the same active record functions from the database library. The only difference is that you don't need to specify the database table and just do: $this->usermodel->where('username','test'), $user = $this->usermodel->get(); This feels kinda awk...

Unknown record property / related component "..." on "..." with sfDoctrineActAsTaggablePlugin

Hi, I'm using the symfony plugin sfDoctrineActAsTaggablePlugin to add a Taggable behaviour to some objects of my model. I followed the instruction given here but when I want to save a taggable element in the database I get : Unknown record property / related component "saved_tags" on "Mishidea" Mishidea is the name of the class/tabl...

PHP cries Syntax Error on simple SQL WHERE clause.

mysql_query('SELECT ID FROM documents WHERE (Key="' .$theKey. '" AND Value="' .$theValue. '")'); Isn’t this right? Also tried with a semicolon at the end of the string, but no luck. Driving me crazy, PHP keeps spitting out: You have an error in your SQL syntax; check the manual that c...

Print Terms in Node in Multiple Columns Sorted in Downward Order

I have approximately 20 content-taxonomy check boxes from one field ("features"). The checked terms display in node-example.tpl.php. I am trying to show these content-taxonomy terms in two columns displayed/sorted in a downward order instead of across. I am trying to cobble two bits of code to accomplish this...but my php skills are not...

drupal php: problem with hosting a new drupal site

I am a newbie to drupal. I try to host it on a free hosting (german) kilue.de.(apache, mysql5.0) To test what I have done locally , on the site : 1- I create the database using phpmyadmin 2 -I copied what I have under /var/ww using FTP Once I launch my site using given uurl , I have this message : * warning: realpath() [function.real...

can you prevent a php while loop from erroring out?

I was wondering if there was a way to prevent a while loop from prematurely erroring out or terminating. I've thrown a try/catch in there and it seems to keep terminating. (As to the cause why it's terminating, I'm still debugging). $stomp = $this->stomp; if(isset($queue) && strlen($queue) > 0) { error_log('Starting Moni...

Adding a JOIN statement in hook_views_query_alter()

I need to modify a query Views generates so that I can use highly custom filters. I have implemented the add_where() function with some ORs thanks to this question: http://stackoverflow.com/questions/1340423/or-operator-in-drupal-view-filters However this only solves a part of my problem. There are some fields that I cannot filter on be...

PHP Imagick "wand contains no images"

Hi all, When attempting to do a simple conversion from PHP, I receive this error : exception 'ImagickException' with message 'wand contains no images `MagickWand-2' @ error/magick-image.c/MagickSetImageFilename/10080' What is MagickWand doing there ?? I did not install it... Here is my simple code : $a = "/[...]/test.jp...

MySQL and PHP Microsoft Windows Error - Any idea what's happening?

I'm running the following code: <?php $dbc = mysql_connect('myforeignserver.wisc.edu:3306','mydb','mypassword'); echo "This Works"; ?> Instead of generating a this works, like it should, I get a windows bar which pops up and says Apache HTTP Server stopped working and was closed. I really have no idea what the issue is. Pleas...

is_int() cannot check $_GET in PHP?

Here is my code: <?php $id = $_GET["id"]; if (is_int($id) === FALSE) { header('HTTP/1.1 404 Not Found'); exit('404, page not found'); } ?> It always enters inside the if. ...

Simple php form = too simple to actually work?

Hey guys I'm sitting here wondering wheather this php contact form solution is too simple to actually work. Or, well it does work, but will it always work? Also, atm when you recieve the email, it says FROM: [email protected] which means that most mail clients will put it straight in the junkbox. How can I change it...

Using header("Location") from a template include file / Process include and save in variable

I am trying to figure out a way to do this: I want to have a core template file (structure.php): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <?php include_once(NAKIDROOT."includes/head.php"); ?> </head>...

How to run some Ant tasks in PHP project in Netbeans 6.8

I wanted to run some Ant scripts from a build.xml in my PHP project. This post and link talk about a Ant plugin but i cannot find it in NB 6.8. Update & Closed The only way i found to get the Run Target contextual menu is to copy a build.xml from a Java project. ...

How can I get page's <title> tag's content if it can't be parsed as XML?

I'm using PHP libcurl to load a page. Now I need to get this page's <title> tag's content, and some other information too. I've tried to parse it using SimpleXML, but with no luck, because the page isn't valid XML. Can you suggest some other way to easily get contents of <title> tag? Thank you. ...