php

PHP - PDO return escaping slash, how to remove it?

I am doing some select with PDO object, but after fetch result, I got string with escaped ' to \', how can I disable that? ...

JS/PHP: Wont alert error

<script type="text/javascript"> $(function() { $("#continue").click(function () { $.ajax({ type: "POST", url: "dbc.php?check=First", data: {full_name : $('#full_name').val(), usr_email : $('#usr_email').val()}, success: function(msg){ if(msg==1){ $("#First_1").hid...

Convert { Key : Value } Object Into Standard Variables with jQuery

I give you what I want in PHP : foreach($myarray as $key=>$value) { ${$key} = $value; } Now, can we do it with JS/jQuery ? This is the jQuery input, I want the classTD value as key, in other words the equivalent of the famous PHP statement ${$key} in the example above: data = {}; $('#resul_rech_doc_fact tr.document-2 td').each(func...

Combining static HTML, a Django backend and a PHP forum on one server?

I have a project coming up for client who is basically happy with how he manages his website. It's lots of HTML files (around 300 of them) that he insists on keeping flat HTML files so can easily edit and manage them using Dreamweaver. His site has a lot of traffic and so I'm looking into options of keeping things simple for him. He does...

shell command to restart an php program

hello, i need to restart my php program when the memory of the program exceeds 500 mb ... it can be done by any script in php or in shell ???? ...

AJAX call and JSON data

Good day! I'm learning to create AJAX calls to PHP scripts. Basically, I want to find the best solution to handle AJAX calls. In this question you can find my client-side part of the code. Basically, I'd like to verify my knowledge here and if I'm wrong, get any tips how to make it correct way. So... I'm using KohanaPHP framework (b...

Why does this PHP code just echo "Array" ?

Here is my code: if(isset($_POST['check']) AND $_POST['check'] == 'First') { $errormessage = array(); if(empty($_POST['full_name']) || strlen($_POST['full_name']) < 4) { $errormessage[] = "FEL - Vänligen ange fullständiga namn. Please enter atleast 3 or more characters for your name"; } if(!isEmail($_POST['usr_email'])) { $erro...

Arrange list in reverse_array within {foreach}

Hello, I am using {foreach} within smarty like this {foreach key=num item=reply from=$replies} //something goes here. {/foreach} Currently I am getting replies arranged like... Older --> Old --> New --> Newer I want to arrange them in this order Newer --> New --> Old --> Older How to achieve this ? Thanks Solved Thanks to ts ...

error occurred during data insert in mysql

my code - require 'database.php'; $uid = $_SESSION['UserId']; $title = $_POST['imgtitle']; $tag = $_POST['imgtag']; $date = date("d-m-y"); $q = "INSERT into album (`o_id`, `title`, `src`, `tag`, `date`) VALUES('$uid', '$title', '$image_name', '$tag', '$date'"; $result = $mysqli->query($q) or die(mysqli_error($mysqli)); if ($result)...

PHP: Conditional statement with possible empty variables

I'm creating a custom search form and when I try and sort the results I get all the objects displayed instead of the matched criteria. The reason I discovered was that some of the inputs from the form don't have a default value and when this is not declared in the conditional statement later on (for sorting) it just shows all the objects...

form 2 button + javascript issue

<form action="index.php?page=checkin" method="post" name="regForm"> <div id="First_1"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td> <table cellpadding="0" cellspacing="5"> <tr> <td style="padding: 5px;"> ...

Is this a reliable way to check the REQUEST_METHOD?

In my class, AController, I have the following method: private function determineRequestMethod() { if($_SERVER['REQUEST_METHOD'] == 'POST') { $this->requestMethod = AController::POST; } else { $this->requestMethod = AController::GET; } } This method is called from the constructor. POST and GET are class constants, ...

Wordpress separate comment and pingback on twenty ten theme

How to separate comments and pingbacks to the Twenty Ten theme? (default wordpress theme) According to the functions.php function twentyten_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> <...

Need help with MySQL query & PHP

I have the following 3 tables: (PK = Primary Key, FK = Foreign Key) Files Table File ID (PK) File Name ... ------------ --------- 1 a.jpg ... 2 b.png ... 3 c.jpg ... . . . . . . Tags Table Tag ID (PK) Ta...

How do I achieve this custom Soap request using PHP's Soap class?

I need to create a Soap request using PHP's Soap extension. I have searched and read both SO questions and the PHP.net manual, however, I have not been able to find a plain English explanation regarding how to implement a custom header with multiple namespaces, a special type, etc. Basically, I just find all the current documentation ver...

Text time to numbers [PHP]

I have multiple rows with time "42 sec" "1 min" "2 h 32 min" Is it possible to convert this to "00:00:42" "00:01:00" "02:32:00" with php? ...

Zend Framework: Looking For a Basic "stub" for a project

We've got a lot of ZF experience. Current project needs a basic user "control panel" and a staff "control panel" backend. We could roll this from scratch, but it seems like a waste of time. What we'd like: User Management (registration, forgot password, remember me, etc) ACL & Authentication A simple "backend control panel" for th...

DATE_FORMAT() in MySQL query

I'm trying to change this timestamp 2010-08-02 00:28:20 to month/day/year - 08/02/10 ..in the query (I know that doing it in the query is faster). $sql = "SELECT * FROM posts ORDER BY post_date DESC"; I tried using the DATE_FORMAT() in the query many ways but I can't seem to get it right.. Can someone please share how to ...

Not able to delete the database(mySQL) record in PHP, where did i go wrong?

Hi, I am trying to delete the records from the users table in mysql, the code goes like this. if(isset($_GET['id'])) { //create query to delete the record $query = "DELETE FROM users WHERE id =" . int($_GET['id']) or die(mysql_error()); //execute query if($mysqli->query($query)) { //print number of affected ro...

PHP Convert Date Then JSON Encode

Hello all, I've got the following MySQL query: <?php $sql = "SELECT * FROM my_table"; $result = mysql_db_query($DBname,$sql,$link) or die(mysql_error()); $rows = array(); while($r = mysql_fetch_assoc($result)) { $rows[] = $r; } print json_encode($rows); ?> Which outputs the following JSON format: [ { "id":"100", "due...