php

Access Variable variables with an object

Hello, I don't really know how to decribe this problem, so I'm sorry if the title is a bit unclear. I got an object with array fields. I got the name of these fields stored in a variable and I want to reach an element in one of those array fields. e.g. $field_name = 'array_field'; $object = new stdClass(); $object->array_field= array...

what happens when $$[object name] is declared

i trying to debug a php script and came across a declaration like $cart = new form; $$cart = $cart->function(); ...

how to make all links on a page absolute ?

i have bunch of htmls on my disk and I know absolute adress of each of them, now I want to make every instance of src="", href="" inside a tags like a, script, img, iframe etc. to point to absolute patch if the given path is relative. I do not know what is the fastest way to do it, by regex, preg_match_all etc ? I want this script to ha...

how can i convert an area code into a state using PHP or python?

I have a phone number, including area code. Is there a PHP or python-accessible API or library that will return its corresponding state? e.g. 415 -> CA. 212 -> NY. ...

How to replace text URLs and exclude URLs in HTML tags?

I need you help here. I want to turn this: sometext sometext http://www.somedomain.com/index.html sometext sometext into: sometext sometext <a href="http://somedoamai.com/index.html"&gt;www.somedomain.com/index.html&lt;/a&gt; sometext sometext I have managed it by using this regex: preg_replace("#((http|https|ftp)://(\S*?\.\S*?))...

PHP and Keywords

Hi, I would like to know if I can make a php script that will allow me to echo keywords into a meta tag.To be more precise will the keywords echoed by the php script be indexed by search engines? I don't need the actual script I just need to know if this will be any good for indexing. ...

Getting total number of rows using SQL_CALC_FOUND_ROWS in Zend DB Table Select

Is there a way to get the total number of rows in Zend db select like with using SQL_CALC_FOUND_ROWS in a regular mysql query. I haven't been able to find a similar functionality for this apart from running the same query without the limit clause. ...

Lemon Parser-Generator: Are nonterminals not evaluated?

I try to learn parsers. Because my C skills are pretty low, I googled a PHP Lemon to learn sth about Parser Generators. Anyway, the code here should be readable for normal lemon friends, too. As always when handling parsing questions, I start with trying to produce a simple calculator first. So my first step is simply this: start(A) ...

Saving variables on server in php

hi, Is there a way, in php, to save a variable on server so it stay there for all of the requests (not session, need to be saved for all users ever)? i'm new in php, in asp.net is use the 'application' context. thanks. ...

PHP: How to get name value in <form name="form1" />

Is there a way to get the value of the name attribute in the form tag? I'm using PHP and don't see it in $_POST. ...

PHP, receiving POST'd sql in a php script, getting some mysql errors, should I be using addslashes?

In most cases whenan sql update query is posted my php script, it works without problem. However, in some cases I get an error from mysql. I'm using a encryption function to send data over the net, so it arrives as sent. If I post the same query into phpmyadmin, it always works. Do I need to add $sql = addslashes($sql); ? I'm hesitant...

PHP+Ajax : Add-a-friend system

I'm trying to make a little project for adding friends. When you click the add friend button you are sending an Ajax call with the friend id & username (they are the id and name attributes of each add button) to the add.php file. (The mysql structure is: 1 users table + X tables named the user's name(columns: friendid, ispending)) In the...

What is the error in including the css by php echo statement?

Hello there I am using the following code for display the requested content.It is not the main page and here in this time only I need a css.But this CSS is not working.I dont know what is the reason.Please help me on this. echo ' <html> <head> <title>My site</title> <link href="css/main.css"/> </head> <body> <div class="head...

Ajax methods - which is better?

I have a bunch of insert, update, and delete operations I need to execute via Ajax. Which of the following would be a better approach? Individual methods for each function (e.g. delete_foo, insert_foo, update_foo, delete_bar, insert_bar, update_bar, etc.) A "master" method and just pass a parameter to distinguish between operations. ...

PubSubHubbub error to confirm subscription

I use this code: <?php if(isset($_GET["hub_challenge"])) { echo $_GET["hub_challenge"]; } else { } $ch = curl_init("http://pubsubhubbub.appspot.com"); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch,CURLOPT_POSTFIELDS,"hub.mode=subscribe&hub.verify=sync&hub.callback=http://rssreaderbg.net/pubsubbub/example/index.php&amp;hub.topic...

rss feed in php,mysql

Any can help me, I am generating rss feed from my mysql table.one column(mess_data) has data as <b> Join Video Chat Now http://www.xyz.com/joinnowdemo.php?usr_response=ratul&amp;room=16&amp;usr_requested=jokam&lt;/b&gt; but when i put this on rss description tag <code> <description>$row['mess_data']</description> </code> is not wo...

Filter tweeter feed by username and hashtag

I have started using the twitter API and would like to filter the tweets by just pulling in tweets from a specific user under a certain #hashtag. Any ideas what the corrent syntax would be, or if its possible? This is the code I am currently using: <?php $username = "TwitterUsername"; // Your twitter username. $limit = "5"; // N...

How to selete listbox with options in Ajax PHP jQuery

I have 2 tables in my database call groups and players i am trying to select the group first and then the players show up in another listbox. can anyone help me out please. DB Groups id Name 1 Red Group 2 Blue Group 3 Yellow Group Players id name group_id 1 ...

Human Readable Date Using PHP

Hello. Please help me create a function to convert dates like 2010-10-04 17:45:50 Into something more pretty like 10 October at 17:45 And so it can hide years if they are not really needed and display date like today/yesterday at 17:45 This is a bit similar to how Facebook displays past dates. ...

Using vars from included file

Hi guys, I have exported an array using var_export($var,true); and stored it to a file arraystore.php When I include arraystore.php on another page and try to use the array it doesn't work? should it, or is there a way to import the var for use in the new page? Maybe serialising and sending as the constructor of the class in use on the...