php

2nd PDO exec get MySQL Syntax error or access violation: 1064

Hello! I am new here. The code and error below I try to solve in three days. Could anyone help me? $db = new PDO('mysql:dbname=' . DBNAME . ';host=' . DBHOST, DBUSER, DBPASS, array(PDO::ATTR_PERSISTENT => true)); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->exec("INSERT INTO A (phone, city, address) VALUES ('12345...

php shared host and mod_security

I'm having difficulty with a php script using copy() on a shared remote host. I've read here the host may simply not allow the use of the copy() function. I started a trouble ticket and the trouble was half fixed and blamed on mod_security. I persisted and now my script is working. A strange last response, after the fix was this: "Unfor...

How to extract a node attribute from XML using PHP's DOM Parser

Hey, I've never really used the dom parser before and now I have a question. How would I go about extracting the url from this <files> <file path="http://www.thesite.com/download/eysjkss.zip" title="File Name" /> </files> Thanks ...

PHP Looping through an array with strings AND an array inside

Hi all, This is a basic looping question but with a twist, so it's likely that i'm missing something easy - apologies in advance... I'm trying to pull the results from an array $testoutput - which is filled with 3 arrays: Running the following code: foreach ($testoutput as $ID => $Array) { echo $Array . "<BR>"; } Returns: ARRAY ...

Using a form to update data in MySQL

Having trouble getting my form to UPDATE records in my database even after searching the web and viewing the other answers on stack-overflow. Here is my current NON functioning code: if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { session_start(); $tablename = $_SESSION['MM_Username']; $amount=$_POST['amount'];...

Form Variable in PDO Query

A Submit button for a form located on my page triggers the code below, but I am unsure of how to save the numeric value of a textbox named 'amount' into a php variable which I can use in the below PDO query. I am unsure of the syntax. Thanks in advance! if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $amo...

PHP: how to get a list of classes that implement certain interface?

I've got an interface interface IModule { public function Install(); } and some classes that implement this interface class Module1 implements IModule { public function Install() { return true; } } class Module2 implements IModule { public function Install() { return true; } } ... class ModuleN ...

php passing c struct data throught socket programming

Dear All, How to make a php socket client that needs to perform socket_sendto to linux C socket server which has following struct typedef struct { UI2 todo; char rz[LNG_RZ + 1]; char saId[LNG_SAT_ID + 1]; char user[LNG_USER + 1]; char lang[LANGLEN + 1]; SI4 ...

Is it worth getting a clean error log on production site?

2 days ago we switched in our office from PHP 5.2.x to 5.3.x and it caused some problems at first, but we managed to fix 'em pretty fast. Since lots of bugfixes were done by looking at error logs, something popped up in my mind. Well, there are all these PHP Notices about undefined variables and other, as I consider, not urgent, messag...

How to get Drupal's $base_url to work on a cron job?

Hello there, How to get $base_url to show the correct url for my Drupal site when I'm running a cron job? Do I have to set the global $base_url manually for that to happen? Do I have to run the cron job as a registered user? When I run mysite.com/cron.php by hand everything seems to work fine: $base_url is set to the correct url. Ho...

Repeating escaped chars in a PHP date function, within Drupal6/Views

I am trying to make a custom php date function for use within D6 that will show dates in the correct format for Chinese. I created the date format within the Date API area of D6, something along the lines of: Y\年n\月j\日 In the Date admin area, this correctly display as "2010年10月22日". My problem occurs when I bring this over to Views w...

delphi for php form in center

i have created a delphi for php page in radphp , how can i make it center of the browser is it possible to make it only using php code. ...

pcntl_fork and then pcntl_exec or pcntl_exec and then pcntl_fork

Explanation: Part of the app that I'm creating requires checking of thousands of records and acting on them in a timely manner. So for every record, I want to fork a new process. However, I need a DB connection to do some more checking of that record. As I understand it, the child inherits the DB connection. So subsequent forks have DB e...

Logging API calls

I've written an API and currently am looking at what is the best way to provide logging for the system. We want to be able to have an overview of the calls being made, if particular calls are being hit very often and such. What is the best way to log and present all this information simply? Simply wondering if there are any pre-built ...

Zend: Create action in a specific controller in specific module with command line

I want to create a testAction in testController of testModule with command line. So I go to tesModule directory(cd application/modules/test) and run the following command. zf.sh create action test -c test It created a action in application/modules/test/controllers/testController.php but it created testAction's test.phtml file in appl...

Get a list of attribute options from Magento

I've been grabbing attribute options from Magento like so: <?php if ($attribute->usesSource()) { $options = $attribute->getSource()->getAllOptions(false); } ?> It's been working fine until I tried to get the options for the built in 'color' attribute -- I got the following error: PHP Fatal error: Call to a member function setA...

Why is PHP's SoapClient creating a different namespace for the header than the body?

I'm trying to communicate with the eWay server and had everything working until we ended up needing to switch to a different API. The problem is that SoapClient is creating a different namespace for the header (that includes the authentication) then from the body, which, obviously, doesn't get me any results. Instead, I get eWay's server...

PHP function to replace a (i)th-position character

Hello all Is there a function in PHP that takes in a string, a number (i), and a character (x), then replaces the character at position (i) with (x)? If not, can somebody help me in implementing it? Thanks. ...

MySQL query display problem.

How can I display the users friends correctly on the users and friends side using my MySQL tables? My current code screws this up. Users Friends Table CREATE TABLE users_friends ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_id INT UNSIGNED UNSIGNED NOT NULL, friend_id INT UNSIGNED NOT NULL, friendship_status TINYINT(1) UNSIGNED NOT N...

php getting array key column dynamically

Hi, I am trying to dynamically get a specific data array by using a function (parsing an excel file, so for instance, I can grab the fourth column of the file as follows): foreach ($obj->Worksheet->Table->Row as $row) { $rows[] = (string)$row->Cell[4]->Data; } My problem is im trying to dynamically specify the "cell" to get and ...