php

PHP/SQLite with multiple SQL statements: $db->Query() works, $this->db_sqlite->query() fails

I am creating a class that handles various SQLite actions. My problem is: When I make a SQL string with multiple statements then it works when using standard PHP => $db->query() ... but it fails when making the same request from a method. It seems that the OO method skips everything after the first ";"-symbol in my SQL statement. Why is ...

Drupal Custom Node Form

I want to create an input form for registered user, separated from admin's content creation form. Each submission will create multiple node. To illustrate the case, I will use content type Project, and Review. Project: Title, Description, Owner, Rating. Review: Title, Reviewer, Project, Difficulty I have setup the content types along...

There is some way to do this string extraction faster?

I need to extract the virtual host name of a HTTP request. Since this willl be done for every request, I´m searching for the fastest way to do this. The following code and times are just some of the ways I had studied. So, there is some faster way to do this? $hostname = "alphabeta.gama.com"; $iteractions = 100000; //While Test $ti...

.htaccess for clean URL not working

I am working with PHP and htacess for the first time. I am passing a variables in a query string to a URL and want this URL to look clean. Please help. .htaccess file RewriteEngine On RewriteRule ^id-([0-9]+)/([0-9A-Za-z]+).html /detail.php?id=$1&display=$2 PHP code passing from one file to detail page URL is: <a href='/detail.ph...

Execute a PHP file, and return the result as a string

Let's assume I have the following file - template.php: <?php $string = 'Hello World!'; ?> <html> <head> <title>Test Page!</title> </head> <body> <h1><?= $string; ?></h1> <p>You should see something above this line</p> </body> </html> I'm aware that I can use file_get_contents() to get the conten...

Retrieving Multiple Result sets with stored procedure in php/mysqli

I have a stored procedure that has multiple result sets. How do I advance to the 2nd result set in mysqli to get those results? Let's say it's a stored proc like: create procedure multiples( param1 INT, param2 INT ) BEGIN SELECT * FROM table1 WHERE id = param1; SELECT * FROM table2 WHERE id = param2; END $$ The PHP is something li...

How to set up a website with WordPress ?

Hi, I'm a PHP developper, and i need for a client request to set up and create a template/theme for wordpress. I know a little about this blog engine, but i read i could use it as a CMS. As my website will be 6/7 pages so far. I'd have liked to know if it was just about writing a template, or will there be some others stuffs to do to...

PHP form validation for year

I'm using PHP to validate form input before the form data's submitted to a MySQL database. What would be the best way to validate a form input for the year only? I have a form input where users should input a date, in the form of a year only. Obviously I can check that the input's numeric and has only 4 characters, but what would be the...

Convert date to string upon saving a doctrine record

Hi, I'm trying to migrate one of my PHP projects to Doctrine. I've never used it before so there are a few things I don't understand. In my current code, I have a class similar to this: class ScheduleItem { private Date start; //A PEAR Date object. private Date end; public function getStart() { return $this->start; } public...

CodeIgniter form verification and class

I'm using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?php echo form_error('NAME'); ?> <br /><input id="NAME" type="text" name="NAME" class="" value="<?php echo set_value('NAME'); ?>" /> </p> I'd like to add a class to...

dynamicaly adding textboxes to zend_form

Hi, I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows in the database, e.g. $count = 0; //we now loop through the skill types and add them to the form. foreach($skillResult as $ski...

Generate content from form and publish on joomla

Hello, well, i'm here for ask to experts on joomla: there is a way to publish content, with a default template (bbcode or html), from data inputed in a form ? i need to gage my articles inside the webpage, and so, when submit the form, i need to catch this data and put into a joomla article. anyone can help me ? thanks, very much ! ...

PHP Foreach Problem?

I'm trying to get the $url value to display from the MySQL database but I can only get the $cat value to display correctly can someone please help me learn how to display the $url value. I now I'm doing something wrong. Here is the partial code. // Loop through each subarray: foreach ($parent as $id => $cat) { // Display the item: ...

hints on coding a dynamic form for mysql query

I'm a beginner and trying to generate as much of my own code as possible without just constantly asking others to write it for me, so with regard to this question I'm looking for hints in the right direction, rather than outright working examples. You people are all very talented, but I learn best if I reason it out myself. Should I hit ...

MySQL Query with two values matching

Howdy, I'd like to select out of one table all the entries that match two criteria SELECT * WHERE field1 IS $a AND field2 IS $b FROM TablaA something like that ... ...

designing a backend with an mvc framework in php

I do not know how to design a backend for my application. Of course I can always just create simple CRUD operations but I recently ran into the concept of scaffolding and some more "techniques" for your backend to be matched against your database schema. Any ideas on how I can use this "scaffolding" and other "backend design techniques"...

What does MYSQLI_NUM mean and do?

I just wanted a little bit of information on MYSQLI_NUM. And is it part of PHP or MySQL. ...

Mail function problem in PHP

I am having trouble sending emails with PHP. Can you see any problems in my code? php.ini mail settings: [mail function] SMTP = mail.ntserv.co.in smtp_port = 26 Code: <?php $to = "[email protected]"; $subject = "Test mail"; $message = "hi, How r u"; $from = "[email protected]"; $headers = "From: $from"; mail($to,$subject,$message,$he...

Does PHP copy variables when retrieving from shared memory?

If I run an shm_get_var(), will it return a "reference", keeping the data in shared memory? I'm wanting to keep an array about 50MB in size in shared memory so that it can be used by multiple processes without having to keep multiple copies of this 50MB array hanging around. If shared memory isn't the answer, does anyone have another id...

What would be the best way to send NSData through PHP into MySQL?

Ok I believe this must be a pretty common scenario. I need to send a NSData variable over a HTTP request through a PHP page which then subsequently stores it in MySQL. This will be retrieved later by some other HTTP call which then downloads it into a NSData again. What is the best way to do this? Should I convert the NSData into some s...