Hey,
I'm using jQuery to post a form to a php file, simple script to verify user details.
var emailval = $("#email").val();
var invoiceIdval = $("#invoiceId").val();
$.post("includes/verify.php",
{invoiceId:invoiceIdval , email:emailval },
function(data) {
//stuff here.
});
PHP Code:
<?php
print_r($_POST);...
Is there a built-in way to know if a given session variable is a serialized object? Say I retrieve a value like $_SESSION['foo'], but I don't know if it was originally a string or if it is a serialized object. Is there some way to check, or once serialized does PHP just see a string as a string as a string?
...
Is there a better way to write this code?
I want to show a default value ('No data') for any empty fields returned by the query:
$archivalie_id = $_GET['archivalie_id'];
$query = "SELECT
a.*,
ip.description AS internal_project,
o.description AS origin,
to_char(ad.or...
I'm looking for a PHP (with MYSQL) nested sets class with all needed functions.
For example:
createLeftNode, createRightNode,createRootNode, createSubNode,deleteNode and moveTree. Not only 1 left, 1 right, 1 up and 1 down but also a part of a tree in a nother tree.
Thanks!
...
Setup
I have a website that draws RSS feeds and displays them on the page. Currently, I use percentages on the divs that contain each feed, so that multiples can appear next to each other.
However, I only have two next to each other, and if the window resizes, there can be some ugly empty space on the screen.
Desire
What I'd like to ...
I'm thinking of using PDO in all of my future webapp. Currently (using what I've learned from SO so far), what I have in my site to handle database connection is a Singleton class like this :
class DB {
private static $instance = NULL;
private static $dsn = "mysql:host=localhost;dbname=mydatabase;";
private static $db_...
I wrote a php code like this
$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
but when I remove "http://" from $site I get this warning
Warning:
file_get_contents(www.google.com)
[function.file-get-contents]: failed
to open stream:
i try ( try and Catch ) but it didn't work .
...
hi
i want something like this
the user enter a website link
i need check the link if the link
doesn't start with 'http://' I want
to append 'http://' to the link .
how can I do that in PHP ?
...
Hi,
I am using the following code fragment in a php script to safely update a shared resource.
$lock_id = sem_get( ftok( 'tmp/this.lock', 'r'));
sem_acquire($lock_id)
//do something
sem_release($lock_id)
When I stress test this code with large number of requests I get an error:
Warning: semop() failed acquiring SYSVSEM_SETVAL for k...
Does anyone know how I can get a list of products belonging to a specific category from within a view file in Magento?
...
I've got a PHP command line program running. And I want to connect to a mysql shell straight from PHP. I've done this before in Python using os.execvp But I can't get the same thing to work in PHP.
I've tried the following functions:
system
passthru
exec
shell_exec
example:
system('mysql -u root -pxxxx db_name');
But they all see...
I am the tech intern for an online independent newspaper, and the writers on the staff are not tech-savvy. They don't quite understand how web pages work, and often they upload and include images straight from their digital cameras, or scanned from original media. These images become a burden when there are 10 images on the front page ...
I'm looking for a simple PHP framework for a 10-year-old child to build (with my help, of course) a NeoPets-like (but much simpler) website. The framework should simply registration/login, database connection and usage, session management. It should also have good documentation. I'm not sure we need MVC for this task.
Are there any rec...
How can I dynamically invoke a class method in PHP? The class method is not static. It appears that
call_user_func(...)
only works with static functions?
Thanks.
...
Many of us need to deal with user input, search queries, and situations where the input text can potentially contain profanity or undesirable language. Oftentimes this needs to be filtered out.
Where can one find a good list of swear words in various languages and dialects?
Are there APIs available to sources that contain good lists? ...
I'm having a little bit of trouble making a sticky form that will remember what is entered in it on form submission if the value has double quotes. The problem is that the HTML is supposed to read something like:
<input type="text" name="something" value="Whatever value you entered" />
However, if the phrase: "How do I do this?" is ty...
Right now we've got web pages that show UI elements, and web pages that just process form submissions, and then redirect back to the UI pages. They do this using PHP's header() function:
header("Location: /other_page.php");
This causes a 302 Found response to be sent; according to the HTTP 1.1 spec, 302 is for cases where "The reques...
Wordpress provides a function called "the_permalink()" that returns, you guessed it!, the permalink to a given post while in a loop of posts.
I am trying to URL encode that permalink and when I execute this code:
<?php
print(the_permalink());
$permalink = the_permalink();
print($permalink);
print(urlencode(the_permalink()));
print(urle...
I have a new VPS server, and I'm trying to get it to connect to another server at the same ISP. When I connect via mysql's command line tool, the connection is very fast.
When I use PHP to connect to the remote DB, the connection time may take up to 5 seconds. Queries after this are executed quickly.
This is not limited to mysql, usi...
Given a class instance, is it possible to determine if it implements a particular interface? As far as I know, there isn't a built-in function to do this directly. What options do I have (if any)?
...