I have written a query to find similar ids based on tags from a current id, much like amazons, you would also like. The problem is, in my example I want to exclude bookid 30 from this search.
Here is my query:
note: $similar is basically a string filled with tags built up with a few "like %item% or"
$query = "SELECT * FROM books
...
OK I totally forgot how to skip arguments in PHP.
Lets say I have:
checkbox_field
(
$name,
$value = '',
$checked = false,
$compare = '',
$parameter = ''
)
How would I call this function and skip the second last argument?
checkbox_field('some name', 'some value', FALSE, '' , 'some parameter');
Would the above be correct? I c...
I don't understand the => part.
foreach ($_POST[‘tasks’] as $task_id => $v) {
What does it do in a foreach loop?
...
I've trying to build Joomla into my existing website so I can use it for premium content.
I've already got a custom-built authentication system that sets my own session variables.
For some reason, Joomla (which is located in a different directory) doesn't want to recognize these session variables, even when adding the session_start()...
Okay so I'm not using any session variables, rather my code looks like this:
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Enter your Twitter username and password:"');
header('HTTP/1.0 401 Unauthorized');
echo 'Please enter your Twitter username and password to view your followers.';
ex...
I have an array that looks like
$numbers = array('first', 'second', 'third');
I want to have a function that will take this array as input and return an that would look like:
array(
'first' => 'first',
'second' => 'second',
'third' => 'third'
)
I wonder if it is possible to use array_walk_recursive or something similar...
...
If i need to return a long i simply use the RETURN_LONG macro. But what do i do if i need to return an unsigned long long. If i use this macro the data gets corrupted...
...
Hi Guys,
I have a content editable area and im trying to disable enter/return and shift enter from creating a new paragraph, i have this working with the script below but it disables the buttoms all together, what i wish to do is have return just place a line break rather then go to a new paragraph.
$("#content").keypress(function(e){ ...
I'm trying to find a secure way to do the following:
Users enters value into html form.
Form is submitted.
PHP uses submitted value as the argument for the "scandir" function.
My theory is include logic in the php script that forbids absolute paths and requires the directory name to include a certain value.
My concern is that a hack...
I looked into the DP 6 search API and did not see a hook that would let me alter the search keys before they are passed into the search module to execute the search.
I want to do keyword expansion on the string that the user entered. For instance, if the user entered 'foo', I want to execute a search for 'foo' and 'bar'. There should ul...
what i want to try to do is be able to enter say a url onto a variable and once executed the page will scrape all input field names and export it to a text file.
for example.
if i have
<input type="text" name="firstname">
<input type="text" name="lastname">
<select name="sex">
<option>...</option>
...
</select>
the output would be
...
We've built a web service that needs to check constantly for email messages. Basically, an user sends us an email, and the server should make actions based on that email. We could use a crontab PHP script that checks for new messages every minute, with POP. But that's kind of offensive to the popserver and not very efficient (1min is too...
I have an import that needs to notify the user each time an item has been successfully imported into the database. Is there a way to loop, perform some functionality, provide the output message, and then loop through again with the same action?
...
Let's say I have this javascript:
<script language="javascript" type="text/javascript">
function addtext() {
var newtext = document.myform.inputtext.value;
document.myform.description.value += newtext;
}
</script>
and I want to enable it so I can click on some html link that says "add text" and I want the text to be @ . $usern...
Hello, we've inherited a PHP project from a client that requires IonCube. Our boxes all run on IIS7 and although we've followed the instructions for configuring it, it isn't loading the decoder library. Have any of you had any success with getting IonCube up and running on Win 2k8 (32bit)? I'm pulling my hair out over this so any help wo...
I initially started off with a small project, editing php files and such in notepad++. It used to be easy to think of a feature, and add it on as a separate file onto the project. As the project became larger, my productivity began to decrease because I couldn't remember all of the functions I made, and where they were stored etc... Then...
I am working on a website in PHP where people can make comments similar to a blog, and I only want particular tags to be allowed. Are there any pre-built libraries that process comments and produce valid XHTML Strict code? I would need to do this in JavaScript so I can generate a live preview like Stack Overflow, plus in PHP before savin...
HI,
I can't quite figure this out, I'm trying to pull records from MySQL, order them reverse-chronologically and limit the results to four per page (and using pagination to organize the pages). It is currently returning this error:
Fatal error: SQL in /Users/allan/Sites/4is_site/casestudylist.php on line 126
$limit = 'LIMIT ' .($pag...
Hi Friends
i am develop a webpage in that i need to calculate x days from a specified date , The problem is we exclude the saturday and sunday . For example $Shipdate = '06/30/2009' and the x is 5 means , i want the answer '7' [ie 30 is tuesday so after 5 days it will be sunday , so there is two holiday(saturday and sunday) so ...
I got sick of writing queries in my PHP as:
"WHERE '" . Database::escape($var) . "'";
The escape() function just calls mysql_real_escape_string() - but it's there so I can extend support to other databases later.
Having to single quote strings in the query was making my code more cluttered. So my idea was to create an other function ...