php

Get all posts from the same month and year for sidebar display

The Wordpress blog I'm building is published like a magazine; the first day of every month, several (nine, to be exact) posts are published in rapid succession. When a reader views one of these nine posts, the other 8 posts should appear in the sidebar. I have a function I've written to accomplish this, but I'm having some issues that ...

idea to add javascript array to database using PHP

i need to push data in javascript array into database using PHP first i have multidimentional array in js. Brady [0] [0] = "1"; Brady [0] [1] = "Carol"; Brady [1] [0] = "2"; Brady [1] [1] = "Jan"; Brady [2] [0] = "3"; Brady [2] [1] = "Mike"; and i have table in database such as (id, name) second if i need to delete some rows in arra...

get latitude longitude based on address api

Hi all, I am using http://code.google.com/apis/maps/documentation/geocoding/ api from google to get geolocation based on address. I put an address like this :"1600 Amphitheatre Parkway, Mountain View, CA", and getting the needed results, and I just need from here latitude and longitude. It works well from my localhost, but then I try to ...

MySQL syntax error in SELECT query

Hi everyone i'm getting this syntax problem and i don't see anything wrong with my query. I'm kind of new at SQL as i'm still an undergrad. I'd really appreciate it if you could help me with this. This is the code. : $results = mysql_query("SELECT event.nameevent,event.eventid FROM event,sub WHERE sub.userid=$userid AND event.e...

Header location not working properly

I have a php script that renders an image (with imagick) and saves it to some directory "SITE_ROOT.$filePath", then does a header('Location: ' . SITE_ROOT.$filePath), the file it redirects to is a png image. If I go to the path directly, like just type it in the URL bar I can save the image and everything works fine, however when I rel...

How to ignore special characters(" ' , - \ / etc) while data insert.

I storing articles in database that contains special characters like ", ', etc. but it gives error while saving in MySQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's and Moral Science's books in school. I clearly remember the picture of a Hin...

Make curl follow redirects?

I'm trying to make curl follow a redirect but I can't quite get it to work right. I have a string that I want to send as a GET param to a server and get the resulting URL. Example: String = Kobold Vermin Url = www.wowhead.com/search?q=Kobold+Worker If you go to that url it will redirect you to www.wowhead.com/npc=257. I want curl to re...

PHP & MySQL question.

I have this script that loops to make a category tree. But I want it to display specific categories that a user picks like in the example below. On a side note the script loops in-order to build the url link to the category. I guess what I'm trying to say is that I just want to know how to display specific categories and their full url...

POST variables sending correctly in FF3.6 but not in FF4 beta

Can anyone think of any reason why a $_POST variable might be correctly send on Firefox 3.6 but not in Firefox 4 beta. I have print_r($_POST) and this value simply doesn't show at all in FF4. Here is the input html: <input type="image" src="images/btn_preview.gif" value="preview" name="buttonPreview"/> Last line of the POST array in F...

PHP/JS Form Class - Array vs OO

I have recently begun working on a PHP/JS Form Class that will also include a SQL Form builder (eg. building simple forms from sql and auto inserts/updates). I have tried several classes (zend_form, clonefish, PHP Form Builder Class, phorms etc) but as yet haven't come across a complete solution that is simple, customizable and complet...

Display only queried ID+row PHP/MySQL

Hi, I have my data stored in a MySQL table, which includes an auto_increment ID number (unique) for each new row. I'd like users to be able to get a certain ID number, using the $_GET function. eg. User loads http://mysite.com/id.php?id=123 Page displays ID number 123 along with the row. echo $row['id']; echo "<table>"; echo "<tr> <t...

Location searching...

For the site I am building I want the user to be able to search for a location, however because I don't have a list of locations for the UK, I have developed a script in PHP which calls: http://ajax.googleapis.com/ajax/services/search/local in order to get the lat and lon coordinates of this location to store in the database for future u...

Remote alternative to local storage for low-security user data?

Suppose you're developing an independent, small sub-page for a big and well frequented web portal. The sub-page shows entries from a public event calendar, and allows users to highlight those especially interesting to them. The highlighted events shall be highlighted (and maybe shown on a separate list) on each future visit of that user...

error while using mysql_real_escape_string()

my code- require 'database.php'; $title = mysql_real_escape_string($_POST['title']); //line 48 $cat = $_POST['cat']; $txtart = mysql_real_escape_string($_POST['artbody']); //line 50 $date = date("d-m-y"); $q = "INSERT INTO tblarticle (art_title, art_cat, art_des, art_date) VALUES ('$title', '$cat', '$txtart', '$date')"; ERROR--> Wa...

Rewrite .php to .aff and treat .aff as php

Hello, On my website I have an affiliates/ folder. Inside that I have showgames.php I want to be able to access the file as www.website.com/affiliates/showgames.aff Inside affiliates folder,I placed this .htaccess AddType application/x-httpd-php .php .aff RewriteEngine on RewriteBase / RewriteRule ^(.*)\.php$ $1.aff [R=permanent] ...

OpenID registration

Hi. Who to create openid registration as on this site? ...

handle a time object from php in flex (parse it to a Date object)

I've got a php backend which delivers a time (e.g. '07:00:00'). This time is recognized as a string but I need it as a Date. So what I need is: Convert a string '07:00:00' to a Flex Date object. Is there a way to do this (without using regular expressions)? ...

php, simulate include? Cache system

I'm trying to create a small template system and have a function that loops over an array of items. Currently I'm using the output buffering functions and include so i can load up the template file while it has scope to the class. function loadTemplate($name, $vars) { $buf = ''; $path = $name . '.html'; if (file_exists($path...

Trouble with imagepng

I am struggling with PHP's GD library. I have written a script called foo.php which outputs a png: header('Content-type:image/png'); $img = imagecreatefrompng($url) or die('bad url:'.$url); imagepng($img); imagedestroy($img); It works fine. Its purpose is to accept a GET parameter and then spit out the appropriate graph: (e.g.) fo...

How to add a new header menu in wordpress?

How to add a new header menu in wordpress? ...