For all of you who work with Doctrine, I've a question related to moveAsLastChildOf(). I'm using Doctrine 1.1.6 and Symfony 1.2
I have a nested tree, with lots of elements. I want to delete an element of the tree, so first I have to move all its children (and descendants) to its parent; and then delete it. I do the following:
// Get th...
Hello.
I have made this code for giving out +1 point, but it doesn't work properly.
mysql_query("UPDATE member_profile SET points= ' ".$points." ' + 1 WHERE user_id = '".$userid."'");
the $points variable is the user´s points right now.. I want it to plus one to it.. so example if he had like 5 points, it should be 5+1 = 6.. but it do...
<?php
$string = "hey";
foreach(range('a','z') as $i)
{
if($string == '$i')
{
echo $i;
}
}
?>
Why is this not working? please tell me.
...
Hello.
What i want to do is that every user gets 1 points every minute. Now i have the php code in the addpoints.php, and then i have tried myself with jQuery javascript:
function addpoints() {
var userid = document.getElementById('user_id_points');
var postFile = 'addpoints.php?userid='+ userid.value;
$.post(postFile, function(...
Hello!
Sorry for maybe dumb question, but i have HUGE problem with one case when i have some int variable with value of 0(zero).
switch ($starost_vozila){
case (0):
switch ($podaci['tip_motora']){
case ("motor1"):
$eko_taksa = 485;
...
Possible Duplicate:
How to Truncate a string in PHP to the word closest to a certain number of characters?
How can I shorten a string to a maximum of 140 chars without slicing through a word.
Take the following string:
$string = "This is an example string that contains more than 140 characters. If I use PHPs substring functi...
I have an array, and I want to get the first value into a foreach loop. then send that value to a function.
This does not work
foreach ($frequency as $i) {
showphp_AlexVortaro (getphp_AlexVortaro ($frequency[$i]));
showphp_Smartfm(getphp_Smartfm($frequency[$i]));
}
...
Hello,
$res (array)-> (count 50 (!) )
Example:
(
[1] => Array
(
[artistname] => Lady GaGa
[songname] => Love Games
[duration] => 3:31
[url] => 7e91a5ca16ae
[server] => 3
)
[2] => Array
(
[artistname] => DJ Layla
[songnam...
I have to set this up so that users can make labels, and track shipments, can someone outline the steps of how this works, including any interaction I need to do in regards to testing and contacting Fedex support, any special keys, gotchas?
...
I have a simple Java client application (Android app). I have to write a PHP server application which receives a request from the Java client application to write some data to a MySQL database or read some data from the MySQL database. It should respond with a status message (Write failed/success) or the data requested respectively.
How...
Hello all,
I have been reading a few questions previously asked and I haven't come across one that answers my question in "black and white" for me! So, apologies if this is repetitive. The question is probably similar to asking, "how long is a piece of string" but bear with me!
For a registration system, I have a user model with functi...
Probably an uber-newbie mistake. Here's my code:
<html>
<body>
<?php
if(isset($_POST["firstName"] && isset($_POST["lastName"]))){
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
echo $firstName;
}
else {
echo "First name was not written in, you suck!";
}
?>
</body>
I'm ge...
Consider the following pair of snippets, both do the same essentially.
<html>
<body>
<?php
if(isset($_POST["firstName"]) && isset($_POST["lastName"])){
//I'm copying the POST variable to a local one.
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
echo "<h1>Thank you for taking the census!<...
I am trying to make a Facebook Connect web app more "mobile friendly". I am currently able to allow iPhone users to log into the site using the normal Facebook Connect PHP libraries.
Here is the issue:
Using my iPhone I am able to log in successfully. However this leaves 2 Mobile Safari tabs open: the site and the cross domain helper fi...
How can i swap around the case of the characters in a string, for example:
$str = "Hello, My Name is Tom";
After i run the code i get a result like this:
$newstr = "hELLO, mY nAME Is tOM";
Is this even possible?
...
I just realized that you can't just use an if statement on a function, for example this doesn't work:
function sayHello()
{
echo "Hello World";
}
if(sayHello())
echo "Function Worked";
else
echo "Function Failed";
I also saw that a function can't be put as the value of a variable. So how can I do an if statement to check ...
I would like to install Xdebug (http://xdebug.org/) on my 64 bit Windows 7 machine to debug Drupal code running on PHP 5.2. The Xdebug download page does not provide a download for a 64 bit version compatible with PHP 5.2.
Many Drupal modules are not compatible with PHP 5.3, so it is not an option to switch to a later version of PHP.
W...
I'm new to PHP and trying to save some web pages to text files using PHP scripts.
Do you know any PHP script to load a web page into a file buffer and remove HTML tags?
...
I have an html form consisting of just radio buttons. The 2nd line of the following is in a loop, therefore assume there are multiple radio buttons. The value of each radio button printed out is a PHP variable.
<form action='delFile.php' method='post'>
<input type='radio' value=" . $row['fileName'] . " name='del' />
<input type='submit'...
What I am trying to do is create a 12 character id for articles on my website similar to how youtube handles their video id (http://www.youtube.com/watch?v=53iddd5IcSU). Right now I am generating an MD5 hash and then grabbing 12 characters of it like this:
$ArticleId = substr(MD5("Article".$currentID),10,12)
where $currentID is the nu...