Hi
I'm reading programming best practices and it is said that when creating a function we should make it do a only single specific task.
I got model functions that retrieves data and it's related data. Example:
$this->Student->StudentAssignments();
Currently this function retrieves the student's assignments plus the question for each ...
Hello all,
I've just started getting familiarized with OO features of PHP, and I would like to ask you something about the $this variable. First of all, if a class that I'm using the $this keyword in does not have a defined property variable foo, does that mean that using the following code:
$this->foo = 5;
echo $this->foo;
will crea...
Hello, did someone knows a way to get a string from date that contains the format of the date?
<?php
$date = date ("2009-10-16 21:30:45");
// smething like this?
print date_format ($date);
?>
I ask this because I'd like to optimize this function I've wrote, usual to get date with a different timezone from server, without ...
A client just asked me to develop a site for her company and she particular requests the use to of the Zikula PHP framework.
I don't want to propose something different cause i think i can pull it off. I have two major concerns.
How can i build templates on Zikula?
How can i customize it?
I will be more than happy i could get links ...
I ran into this question: http://stackoverflow.com/questions/1552130
But applying the fix mentioned there does not work. Netbeans keeps saying the version of PHPUnit is too old and that I need at least 3.3.0, while I am using 3.3.9.
Screenschots:
I haven't editted anything about the files, I just downloaded the tgz, unzipped it all ...
Well the question title explains the question :D but here is an example none the less
asdf
asdf
<p>asdf
asdf
asdf</p>
how to i get it to regex the inside of the p tags and apply nl2br to it so the output would be:
asdf
asdf
<p>asdf<br />
asdf<br />
asdf</p>
Edit: In PHP
...
First let me explain that I have this script that should let users enter multiple tags that are separated by a comma for example, html, css, php, mysql and store each tag in the database and associating it to the question it was tagged too.
But for some reason the tags are not beign associated with the questions_tags table correctly to...
Hi,
Have a problem with a php script to get the title of a URL. It works when I run it manually, but not when I run it through cron.
Googled to get a small script to get the title of a URL:
function getTitle($url) {
$fh = fopen($url, "r");
$str = fread($fh, 7500);
fclose($fh);
$str2 = strtolower($str);
$start = str...
I'm going to work on an inspiration site for a NGO, and I'm looking to implement some sort of Facebook-esque event stream, with events like “Michael recommended apple pie”, “John commented on chocolate cake”, “Caramel fudge was posted 8 hours ago by Alice”, etc.
The thing is that these events are interest-based, so someone only be inter...
When I run a query directly in MySQL using phpMyAdmin it allows – (long dash, not normal -), but when I run this query from my PHP code, it turns them to –.
If you encode – it'll come %E2%80%93 (in JavaScript). %E2 becomes â, %80 becomes € and %93 becomes “. I don't understand when I run the query in phpMyAdmin it shaves data as –, bu...
I want to make a query using which I can check that URL which I am making for a new video entry is not present in my db.
My current query is:
SELECT Count(videoid) FROM video WHERE titleurl = 'test';
I am storing count in a variable $n Then checking it using the following PHP code
if ($n > 0){
return $output . "-$n";
}else{
return...
Hi,
I need to retrieve data from a Parent > Child > Child relationship category setup. And I have no CLUE as to the proper SQL query syntax for that.
Help?
Thanks,
Tomer
...
Update:
Ok.. I have read a lot of solutions...
Thank you so much everybody. I think I
will keep it simple and avoid the
encryption and just rely on two fields
matching in the database. I can keep
the id as it is (sequential) but add
for example a timestamp (with :
removed). Then I can put both through
the youtube ...
What does the following mean when displayed on the screen?
And what are some solutions to correct it?
Column count doesn't match value count at row 1
Code I think is giving me a problem.
$query2 = "INSERT INTO question_tags (tag_id, users_questions_id) VALUES ('$id',(SELECT id FROM tags WHERE tag='" . $tags[$x] . "'), '$page')";
I...
If i have two users one users have many posts in post table i.e
postid, post, userid, time(i.e timestamp)
and I have another table for friends i.e
id, friendid, userid, friend_sinc(i.e timestamp)
Now I want that users friend should see the posts of user1 after the date on which he added the user1 as friend. Not the posts older than...
I want to know if it's possible to get a remote flv file and have it 'stream' using PHP and exec function. I have 'curl' in my environnement so i want something like :
exec ('curl http://myhosts.com/myflv.flv', $out);
print $out;
Problem is that $out is returned as an array; i want to output the 'raw' stream returned by curl.
...
Hello guys, I was wondering if you could help me with the following:
I am passing some information filled in a form to the next page to show. I am using $_POST method. Although the information is shown in the browser when checking the code is shows an Notice: undefined index error and there is no trace of the value passed where it shoul...
Hi!
I have a form on my site which sends data to some remote site - simple html form.
What I want to do is to use data user enters into form for statistical purposes.
So I instead of sending data to the remote page I send it first to my script which resends it the remote site.
The thing is I need it to behave in exact way the usual form...
I'm using the menu_block module in Drupal for my menus. This works very well, but I want my menu items styled as an image menu. This cannot be done nicely with the default settings - the menu items look something like this:
<li class="leaf first menu-mlid-199"><a href="/this/is/some/nice/url" title="Homepage">Homepage</a></li>
I'm gue...
I'm generating migrations between different yaml schema files: i.e. running:
symfony doctrine:generate-migrations-diff
And the resulting migration file has a whole slew of changeColumn calls that weren't added in the last schema file change.
For example, if you run generate-migrations-diff without changing your schema file whatsoever,...