php

Frustration with Zend_Gdata and obtaining an Event URL for Google Calendar

Hey everyone, I posted a question about this last night, but I don't think it was clear enough. I am using the Zend_Gdata package with PHP to add events to my Google Calendar. I can successfully add events. However, when I add an event, I want to add that event's URL to a database so that if I ever need to delete that event, I can ret...

best way to get friends actions for a social network php/mysql

I have a social network similar to myspace but I use PHP and mysql, I have been looking for the best way to show users bulletins posted only fronm themself and from users they are confirmed friends with. This involves 3 tables friend_friend = this table stores records for who is who's friend friend_bulletins = this stores the bulletins...

SQL - Query Help: Finding a Local Maximum

I have a table which has data from a graph. for example index value 0 3 1 5 2 7 3 6 4 8 5 9 6 12 7 11 8 10 9 14 10 13 I need to a query that returns the results where the value is at a local maximum, i.e. the value at a particular index is greater than the value at index+1 and in...

Echo block of HTML that contains PHP functions

I have a simple if-else statement--if true, I'd like it to echo this content: <div id="login"> <h2>Login</h2> <div class="box"> <form method="POST" action="index.php/login"> Username/Email:<br /> <input type="text" name="username" value="<?php echo set_value("username"); ?>" size="50" class="form" /> <?php echo...

How to use sessions in place of a querystring

Using PHP.. I have a small app that I built that currently uses a querystring to navigate and grab data from a database. The key in the database is also in the string and that is not acceptable anymore. I need to change it. I would like to hide the db key and use a session in place of it but I'm not sure how to do that. In fact, there ar...

Eclipse PDT "tips" ?

Hi ! (Yes, this is a quite opened and general and subjective question -- it's by design, cause I want tips you think are great !) I'm using Eclipse PDT 2.1 to work in PHP, either for small and/or big projects -- I've been doing so for quite some times, now, actually (since before 1.0 stable, if I remember well)... I was wondering if a...

How do you install simplehtmldom in ubuntu

Hi, I am trying to write a screen scraper in php. I am having a nightmare trying to figure out how to do regular expressions. However I have found a library that is suppose to remove the need to use regular expressions when screen scraping. It is called simplehtmldom. However I can't even figure out how to install it. I have downlo...

How to store processed file in users desktop?

I have created a website.In that scaling an image option is created.. Now i want to store that scaled image in users desktop..But its saving in code existing folder.. Please help me by sending php script to store that file in desktop ...

Stacking a variable in reverse in PHP

I have a loop spitting out values and are put into a string: $all_values = ""; while loop { $value = "..."; $all_values .= $value . ","; } Output: 1,3,8,2,10... What's the simplest way to output the same thing but numbers in reverse so the above example would come out like ...10,2,8,3,1 ...

Database command runs glacially in my PHP script, quickly in phpMyAdmin

Hi, I have an extremely large MySQL database (about 1 million items) and am running a fairly complex query on that database. It takes about 2 seconds when I enter the SQL command into phpMyAdmin but it takes around 1-2 minutes to generate that same output using PHP code. Why would there be such a time difference? If it was a poorly ex...

Retrieve a complete list of all Categories, Sub Categories, Sub Sub Categories, etc. in only one SQL query

I have following table structure and data in MySQL CatID CatName ParentCatID ------------------------------- 1 Shirts NULL 2 Short Sleev 1 3 Long Sleev 1 4 Collarless 2 5 Collar 2 6 Collarless 3 7 Collar 3 8 Square Cut 4 9 Round Cut ...

what is the best way in php to reverse letters in words

i have a string . i want to reverse the letters in every word not reverse the words order. like - 'my string' should be 'ym gnirts' ...

PHP - get image from byte array

Hi I am trying to create a back-end for my mobile application. I am sending an image's contents as a byte array in the HTTP request's body (output stream) I want to read this stream of bytes in the PHP script and get back an image. Can someone please tell me how I can do that? Thanks. ...

Accessing $_SERVER['DOCUMENT_ROOT'] value in .htaccess file

I need the path specified in $_SERVER['DOCUMENT_ROOT'] to be accessible in .htaccess file. Is there a way to access it there? I basically need to point to a file kept at the root and need the actual file system path and not the URL path. So instead of using a hard coded value, I'd like to be able to use a variable. Thanks. ...

Most efficient php if structure

What runs faster? Setting a default value and changing it- $foo = ""; if($bar) { $foo = "someValue"; } Or- if($bar) { $foo = "someValue"; } else { $foo = ""; } ...

MySQL: printing data just once for each grouping

I'm coding in PHP/MySQL and have the following query to fetch products and product group data: SELECT products.id,products.name,product_groups.id,product_groups.name FROM products INNER JOIN product_groups ON products.id=product_groups.id WHERE products.name LIKE '%foobar%' ORDER by product_groups.id ASC So this query fetches products...

String parser/separation in PHP

I have data which I wish to be pasted into a textbox, it will be in the form E.G Ryu Aiter D78:21:87:13 177 /177 1 / 6 Ryu Chronos D78:21:26:21 182 /182 0 / 6 Ryu Hermes D78:21:26:22 201 /201 0 / 6 Ryu Hefaistos D78:31:75:10 136 /136 1 / 2 Ryu Krotos D78:84:96:11 170 /170 1 / 6 Ryu Heros D78:65:51:31 175 /175 2 / 5 Ryu Arachnos D78:13:8...

Is there any way to output the filtered data from Zend_Filter_Input?

Is there any way to output all filtered data from the class Zend_Filter_Input? ...

How to capture x screen using PHP, shell_exe and scrot

I'm building a web page screen capture application for an internal R&D project. Environment: Ubuntu 9.04 (default desktop install), Apache, PHP. So far I've got a bash script that takes one parameter (URL), fires up firefox, grabs the screen and saves it as a PNG. I've tried running this from terminal and it works fine. Here's the Bas...

Return value on condition failing in PHP

I need a return false if the query fails... where do i put it... function asas($username,$password){ $qry = "SELECT * FROM members WHERE login='$username' AND passwd='".md5($password)."'"; $result = mysql_query($qry); while($row = mysql_fetch_array($result)) { return(array($row['use...