In php, ($myvariable==0)
When $myvariable is zero, the value of the expression is true; when $myvariable is null, the value of this expression is also true. How can I exclude the second case? I mean I want the expression to be true only when $myvariable is zero. Of course I can write
($myvariable!=null && $myvariable==0 )
but is ther...
Dear friends,
I have a problem with my client website.
my client website is xyz.com/abc.php but unfortunately one of our external link webmaster has given slash at the end of the url as xyz.com/abc.php/
now problem is google is reading text version pages of all the abc.php as duplicate content pages as cache text only version.
My web...
<?php
session_start();
if($_GET["log"] == "out") {
session_unset();
session_destroy();
echo "done";
}
$username = $_POST["user_login"];
$password = $_POST["user_pass"];
if($_SESSION['LoggedIn']) {
$_SESSION['LoggedIn'] = 1;
$_SESSION['user_login'] = $username;
$_SESSION['user_pass'] = $password;
echo $_SESSION['user_login'...
I was surprised when I just tried the following PHP code:
function foo()
{
foo();
}
foo();
I expected to get "500: Internal server error". Instead the connection was closed immediately (no bytes received), and the log files show that apache segfaulted. WTF? Is this a known bug in PHP? Are there some configuration options that I'm ...
Hi,
I've got an object, which contains semicolons in the property names, when I var_dump, I get:
object(Sales) {
[thisisa:propertyname] => 'some value'
}
So, how do I access the property? $object->thisisa:propertyname throws an error. I read somewhere a while ago you can wrap thisisa:propertyname in some characters (I've tried ...
I know this kind of thing cannot be adequately answered without a link to the live example. Unfortunately, I can't set one up right now as it's a back-end login and creating a safe public login would be too much to do at this point. Sorry. I'm hoping for ideas and input from people who may have experienced something similar in the past.
...
Hello,
First of all I am an autodidact so I don't have great know how about optimization and stuff. I created a social networking website.
It contains 29 tables right now. I want to extend its functionality by adding things like yellow pages, events etc to make it more like a portal.
Now the question is should I simply add the tables ...
Hi,
Could you please tell me how to extract content from PDF document using PHP? Formatting is the main problem im facing here. So let me know, if there are some ways to extract content with the same format and to display it on an online text editor.
Thanks
...
Say I have an associative array:
"color" => "red"
"taste" => "sweet"
"season" => "summer"
and I want to introduce a new element into it:
"texture" => "bumpy"
behind the 2nd item but preserving all the array keys:
"color" => "red"
"taste" => "sweet"
"texture" => "bumpy"
"season" => "summer"
is there a function to do that? Array_...
Ok so me and a friend are doing a mini presentation on PHP security (I'm not really into PHP though) and he asked me to find some examples of vulnerable PHP code (one that is prone to SQL injections and all other types of attacks). I was wondering are there any websites with both good and bad pieces of code showing how you should and sho...
I see there are several nice Accordion (UI) modules, but none seems to be able to display accordion for subsections of a single node/article.
E.g. article on my site has sections "Start", "Middle", "End" and I'd like to be able to see these sections wrapped each under other on a single node page.
Like
/node/x
Start (text available upon...
Hello. I am using ExtJS 3 here. I would like to populate a formpanel from database with fields to be submitted. Basically, I don't know witch fields my form will have and I want to generate all formpanel items from database. I could generate a JSON string to be passed as the response from the PHP file with the fields and everything but I...
I'm dealing with two question marks in a single entry website.
I'm trying to use urlencode to handle it.
The original URL:
'search.php?query='.quote_replace(addmarks($search_results['did_you_mean'])).'&search=1'
I want to use it in the single entry website:
'index.php?page='.urlencode('search?query='.quote_replace(addmarks($search...
I'd like a select box to appear on a form that I'm building, and I know that I can use
theme('select', $element); to generate a properly formatted select list. When I check http://api.drupal.org/api/function/theme_select/6, I can see more information about my variable, $element:
$element An associative array containing the properti...
The company has a PHP app that is in horrible condition. They want to start making plans to redesign it in .NET, however they need to run with the current design because of various reasons that I won't get into here.
They want to make some enhancements to the current design but do it in such a way that those enhancements can be in-part ...
I have serious problem in my application.
When I make 'CTE' select in my SQL Server database and then I use sqlsrv_num_rows to count rows amount in result object I got strange result: -1.
This value is not even in manual (link: http://msdn.microsoft.com/en-us/library/ee376931(SQL.90).aspx).
Sample code:
W have select 'CTE - Common Ta...
Good morning, all.
I've been doing websites now for about seven years (most of which have been in ASP.NET, but some just HTML) and I'm getting ready to make the move to PHP for my next project. Can anyone suggest some resources and/or tutorials that are more than the usual Hello World kind of thing?
Specifically, any guidelines on cod...
First things first: Neither this, this, this nor this answered my question. So I'll open a new one.
Please read
Okay okay. I know that regexes are not the way to parse general HTML. Please take note that the created documents are written using a limited, controlled HTML subset. And people writing the docs know what they're doing. They ...
Hi,
I am working on a web form that dynamically adds text fields as the user desires for multiple dates. In essence this is what happens... The user goes to the form, it has a primary date text field for the user, IF the user so desires he may add a date text field through clicking a button that says "Add Date". The javascript is as foll...
What exactly happened?
I don't know the undergoing so I can't understand how session_set_save_handler() actually works.
...