php

function sending a null value to php file

Hey guys, I've got a function which sends the "id" value to a php file but all it's send is null.. can anyone spot why? (the value of id is not null) function send(point, name, message, type, file, id, lat, lng) { var html = "<b>" + name + "</b> <br/>" + message + '<IMG SRC=\"'+file+'\">' + ' <br> id = ' + id + "<a href=delete.php?id...

function called in function throwing undefined function error

using the object-oriented approach, i'm trying to call a public function in a function in the same class, but it throws an error: Call to undefined function h() php: class Name { . .. . public function h($s) { echo htmlspecialchars($s, ENT_QUOTES); } public function formatQuotes($row) { return "<p id...

SQL: Insert DateCreated value?

In my table I have a dateCreated column in the format of DATETIME. How do I insert the current datetime when I add the record to the database? ...

Authenticating as an Application

Where you type these things?: curl -F type=client_cred \ -F client_id=your_app_id \ -F client_secret=your_app_secret \ https://graph.facebook.com/oauth/access_token In other words, how I'll do it in PHP? Or manually? source ...

PHP write outside document root

Hello, I'm trying to create a file in a directory outside the document root of the web server. The folder has permissions 777 but php says Permission Denied: Warning: fopen(/home/site2/public_html/images/x.jpg) [function.fopen]: failed to open stream: Permission denied in /home/site1/public_html/test_sites.php on line 2 Permission proble...

Preventing a database from rejecting user input

I'm making a simple interface that will allow a user to modify pieces of CSS and HTML which are stored in a Microsoft SQL database. This interface uses PHP5 and ADOdb. For some reason this form will reject any input which contains one or more single quotes. This string, for example, is not allowed: "background-image:url('paper.gif');" ...

WAMP Setup - Connection resets when php tries to access mysql

I'm trying to install wordpress on a server running windows 2000 (not server edition), apache 2.2, php 5.2.9, and Mysql 5. When I get to page 2 of the setup, where it tries to connect to MySQL to add the tables, the connection is reset. This isn't an isolated error because the same issue is happening when I try to log in to phpMyAdmin. ...

PHP Bootstrapping Basics

I'm writing my first PHP app. Everyone talks about having a bootstrap.php to initialize your app. This makes sense and I've put together one that I'm happy with. There's two things I don't understand, and which no one seems to mention: Where do I call my boostrap from? Do I include it in every page? Please tell me there's a better ...

Facebook access tokens do not work? or i need something else?

I can make a search query using these tokens here: http://developers.facebook.com/docs/api#search in the links: https://graph.facebook.com/search?q=mark&amp;type=user&amp;access_token=2227470867|2.3eR1b7yrD6oU8Odh0PEhZA__.3600.1279843200-100001317997096|yDCYeMeuUisyjC7x5k_nuU3DjT0. (<-this token expires within hours) However I canno...

Why are my camel cased actions in Zend MVC attempting to call non-camelcased method names?

The Zend standard for action names is camelCase, yet if I create an action with camel casing, the request fails because it tries to call the method (action) without the camel casing! Example: I have an action named "changeEmail" in module "abc". The method is "changeEmailAction" (created by Zend Tool). If I try to access /abc/changeE...

PHP - What is a good way to produce an short alphanumeric string from a long md5 hash?

This is for the purpose of having a nice short URL which refers to an md5 hash in a database. I would like to convert something like this: a7d2cd9e0e09bebb6a520af48205ced1 into something like this: hW9lM5f27 Those both contain about the same amount of information. The method doesn't have to be direct and reversible but that w...

Load comment variables in a block

In a drupal block, you can access the node variables by using node_load(arg(1)). But how do you get the comment variables in a block? ...

How do I merge two objects?

I have an object, $foo, which has some methods and properties already defined and another object, $bar, which is just a set of properties. I want to merge the entirety of $bar into $foo such that all the properties of $bar become properties of $foo. So if beforehand I had, $bar->foobar, afterwards I should be able to use $foo->foobar. ...

How to make a controled "shuffle" order?

I have a set of quiz game questions in a sql database (javascript and sqlite actually). The questions all have a difficulty level from 1 to 5, 5 being hardest. Here is a simplified visualization of the data... +---------+--------------+ | id | difficulty | +---------+--------------+ | 1 | 1 | | 2 ...

PHP foreach fails at a random place, with no error given, and only on certain queries

I an issue that has me completely stumped. I am simply running a simple query with one parameter, putting the results in an array, and then looping through the array to display the information in a table. I will post the code at the end, though it is kind of dense, but mostly I'd liek to know what would cause a php script to die with n...

I have a page that uses a mysql connection. How can i make 1 mysql request using a new connection without messing up the current connection?

Hi, I currently have a page that is something like this <?php mysql_connect(...); mysql_query('the pages queries'); ### here ### mysql_query('the pages queries'); ?> but where it says ### here ###, i basically want to do this: mysql_connect(new server/new user) mysql_query(update db2.log ...) is there any easy way to do this so...

How do I use a standalone class in cakephp 1.3?

I have a standalone class I wrote in PHP for some very basic LDAP/AD functions. and I would like to use this class in a project I am working on in cakephp. It looks like in cakephp 1.2 I could just add the class as a vendor, however it looks like cakephp 1.3 removed support for vendors. So how would I go about calling a few function fro...

Correct link rel CSS stylesheet not being implemented for a menu

I have menu.php, and in the <head> section of menu.php, I have menu.css as a link rel tag of course, both of which work perfectly fine. Since menu.php is a 'menu', I've required it on pages that need a 'menu' in order to navigate around the website. However, whenever I require menu.php on a page that has its own CSS stylesheet, menu.php...

Anyway that I can ignored the error message from strpos() ?

Does anyone know any other way that I can use (beside of @strpos()) to ignored the error message that display from strpos() (Warning: strpos() [function.strpos]: Offset not contained in string in ....) ...

Write to directory without needing 777 permissions

Is this possible with php? ...