Hi, I made an PHP OOP Cart Class like this
print_r($_SESSION["cart"]);
the result is:
Array ( [1] => 1 [3] => 2 )
How can I print this session, like a "real" cart?
example:
echo "Your basket: ";
echo "ItemID: ".$cartid." Itemnumber:".$cartnumber;
The adding to basket part:
if (isset($_POST['submit']))
{
$cart= new Cart(...
I need to get the basics of this function. The php.net documentation states, for the blowfish algorithm, that:
Blowfish hashing with a salt as follows: "$2a$", a two digit cost parameter, "$", and 22 base 64 digits from the alphabet "./0-9A-Za-z". Using characters outside of this range in the salt will cause crypt() to return a zero...
hi, i have a website, lets say:
http://www.domain.com/
and im using rewrite module
but! i have a subfolder
forum.domain.com
and i dont want the htaccess to affect this directory, how to do it?
please, its real urgent
...
Hi,
I have an XML file with some CDATA nodes. I want to change the text inside the CDATA node (keeping it as CDATA node). So, I guess I first need to read the CDATA node and then write it back. But, I am not sure how to do that in PHP. I was able to create a new CDATA node but how can I edit a CDATA node? Is there a direct way to do tha...
I want to split a string into two variables, the first word and the rest of the string. The first word is only ever going to be one of 4 different words.
$string = explode (' ', $string, 2);
$word = $string[0];
$string = $string[1];
The above seems like it works, but I'm wondering if there is a better way.
...
Users can do advanced searches (they are many possible parameters):
/search/?query=toto&topic=12&minimumPrice=0&maximumPrice=1000
I would like to store the search parameters (after the /search/?) for an email alert.
I have 2 possibilites:
Storing the raw request (query=toto&topicId=12&minimumPrice=0&maximumPrice=1000) in a table wit...
Hey everyone,
I've recently started a new web development project for an embedded device and wanted to solicit some recommendations for technologies to use. The device will serve HTML pages which include AJAX code to retrieve data from a JSON server. We're tentatively using Cherokee as the web server, though we're not tied to it.
Curre...
I'm new to PHP development, and I'm wondering if the community has any guidelines for inline documentation of code using comments. I'd love something like Python's PEP 257, but I'd settle for a format used by a popular document extraction tool, or even the documentation standard of a popular product.
...
Hi,
I'm not asking about uploading a file from a browser to a php script, there's plenty of tutorials about that already. I'm asking about this:
I have a php script that has accepted a file from the user, and the file is currently on the hard disk of server 1. I want to upload the file from server 1 to a php script on server 2, using t...
Hi everyone,
I have a image slideshow each image sliding after 4 seconds and a message is displayed at end of each slide. I could record the message when button is clicked but couldn't record the message at the end of each slide if button is not clicked.
Here is my code:
and I also want to display random images without repetition. Can...
I have a variable ($myClass[0]->comment;) that has carriage return in it. I want to replace all the carriage return in that variable with "\n"
how can I do that.
below may help a bit
$myClass[0]->comment;
Here is some output
<?php
$test = explode(chr(13),$myClass[0]->comment );
var_dump($test);
?>...
Following Models:
class User extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn ( 'iron', 'integer', 4 );
}
public function setUp() {
$this->hasMany ('Field as Fields', array(
'local' => 'id',
'foreign' => 'owner_id'
));
}
}
class Field exte...
I have been looking at Zend AMF and AMFPHP to see if either can operate as a client and I am not finding anything that says it definitely can or cannot operate as a client.
Is this possible withe either of these libraries? Are there other solid AMF libraries for PHP that will provide a client interface?
...
Hi guys,
I have a table that outputs all my contacts via a while loop from my database.
my syntax is like this:
SELECT * FROM contacts WHERE id = $_SESSION['user_id'] ORDER BY name ASC LIMIT 5
that pulls out all my data and only gives me 5 results.
Now my goal is to have a little button that opens up a model box with jquery (this I...
Hi,
I want to attribute some tags to some of the objects of my doctrine model.
I found sfDoctrineActAsTaggablePlugin which seems to be precisely what I need.
The problem is that when I want to save a Taggable object, I get this error:
Unknown record property / related component "saved_tags" on "Mishidea"
Mishidea is the name of the...
I am running PHP (on Apache/Windows) and I am trying to connect to a LDAP server to authenticate users. PHP's LDAP plugin is just OpenLDAP.
While I've been successful in connecting to the LDAP server without SSL, I can't do it WITH SSL. I know I got everything right, except OpenLDAP won't connect to the server without the CA certificate...
I need some PHP code that does a dump of all the information in an HTTP request, including headers and the contents of any information included in a POST request. Basically, a diagnostic tool that spits out exactly what I send to a server.
Does anyone have some code that does this?
...
Hi,
I'd like to play a bit with functional programming in PHP. I think it's intersting to try out something different when always writing oop in php.
However, I'd like to use namespaces. My namespaces are equal to the file structure:
namespace my\Models\User;
/my/Models/User.php
Is their a way to do something like autoloading for th...
Hi. I hava a function that looks something like this:
require("config.php");
function displayGta()
{
(... lots of code...)
$car = $car_park[3];
}
and a config.php that look something like this:
<?php
$car_park = array ("Mercedes 540 K.", "Chevrolet Coupe.", "Chrysler Imperial.", "Ford Model T.", "Hudson Super.", "Packard ...
I have a command line application I need to execute from my PHP web application. Say the command is the following:
foo -arg1 -arg2 -arg3
Based on certain conditions, the command line application will prompt user to hit the enter key (e.g. "Please press enter to continue.").
From my PHP application, how do I execute the command line A...