Search found 2563 matches

by AbraCadaver
Wed Nov 06, 2013 12:20 pm
Forum: PHP - Code
Topic: strpos - why won't it find the word?
Replies: 8
Views: 1145

Re: strpos - why won't it find the word?

Yes, but not if you don't put n the page $catname = 'black t-shirts'; IF you just take what's in the variable without writing it as you put it here, it doesn't work. Sure it does. If shirt is part of $catname. Post the output of: echo $catname; if (strpos($catname, 'shirt') !== false) { echo "...
by AbraCadaver
Wed Nov 06, 2013 11:59 am
Forum: PHP - Code
Topic: strpos - why won't it find the word?
Replies: 8
Views: 1145

Re: strpos - why won't it find the word?

Nice dialogue you have going with yourself, so I hate to interrupt, but:

Code: Select all

$catname = 'black t-shirts';

if (strpos($catname, 'shirt') !== false) {
    echo "yes";
}
echos yes
by AbraCadaver
Mon Oct 28, 2013 2:40 pm
Forum: PHP - Code
Topic: Simple addition issue in PHP
Replies: 2
Views: 750

Re: Simple addition issue in PHP

I am trying to learn PHP, how would I start this? Given an input of an expression consisting of a string of letters and operators (plus sign, minus sign, and letters. IE: ‘b-d+e-f’) and a file with a set of variable/value pairs separated by commas (i.e: a=1,b=7,c=3,d=14) write a program that would ...
by AbraCadaver
Mon Oct 14, 2013 4:48 pm
Forum: PHP - Code
Topic: Call to a member function query() on a non-object
Replies: 2
Views: 5044

Re: Call to a member function query() on a non-object

Maybe NOT isset():

Code: Select all

public static function  dataConnect()
{
    if(!isset(self::$db))
    {
            try
            {
                self::$db = new PDO(self::$dsn, self::$username, self::$password);
by AbraCadaver
Wed Oct 09, 2013 2:37 pm
Forum: General Discussion
Topic: PHP CODE NEED for question URGNENTLY
Replies: 2
Views: 2395

Re: PHP CODE NEED for question URGNENTLY

Celauran wrote:Yeah, we're not doing your homework for you.
Well, not for free!
by AbraCadaver
Wed Oct 02, 2013 9:59 am
Forum: PHP - Code
Topic: get future date
Replies: 1
Views: 734

Re: get future date

I'm not sure what format your date needs to be in, but you need to read the docs for the two functions. Here's an example:

Code: Select all

$date1 = date('Y-m-d', strtotime('+1 day', $newdate));
by AbraCadaver
Wed Oct 02, 2013 9:53 am
Forum: PHP - Code
Topic: Simple question re \n in strings
Replies: 7
Views: 1286

Re: Simple question re \n in strings

Also, when debugging etc. Do you prefer this: [text]<div class="topic-actions"><div class="buttons"><div class="reply-icon"><a href="./posting.php?mode=reply&f=1&t=138469" title="Post a reply"><span></span>Post a reply</a></div></div><div cla...
by AbraCadaver
Tue Oct 01, 2013 10:46 am
Forum: PHP - Code
Topic: Illogical in_array Behavior, not really...
Replies: 2
Views: 783

Re: Illogical in_array Behavior, not really...

Both "0e2411" and "0e2319" are being typecast to int 0.
by AbraCadaver
Mon Sep 30, 2013 2:21 pm
Forum: PHP - Code
Topic: Why Exponential value is string?
Replies: 2
Views: 690

Re: Why Exponential value is string?

$name1 = 10e10;
var_dump($name1);


it also shows 10000000000 => String

how is this possible
No.
[text]float(100000000000)[/text]
by AbraCadaver
Mon Sep 30, 2013 12:40 pm
Forum: Javascript
Topic: Passing array from php to javascript using json_encode
Replies: 2
Views: 3948

Re: Passing array from php to javascript using json_encode

That is a json encoded array. You need to decode it in the javascript.
by AbraCadaver
Sat Sep 28, 2013 9:56 am
Forum: PHP - Code
Topic: How to access array contents and serialize data
Replies: 3
Views: 853

Re: How to access array contents and serialize data

Why are you serializing it?
by AbraCadaver
Wed Sep 25, 2013 9:48 am
Forum: PHP - Code
Topic: Read Text File From Client Machine
Replies: 7
Views: 2102

Re: Read Text File From Client Machine

Have the client machine either copy the file to a share on the server or some other intermediate share that is accessible to both the client and server. Maybe have this copy done after the desktop app creates the text file.
by AbraCadaver
Tue Sep 24, 2013 3:58 pm
Forum: PHP - Code
Topic: unsure about syntax i havent encountered before?
Replies: 5
Views: 858

Re: unsure about syntax i havent encountered before?

eoinahern wrote:so basically ALL its doing is echoing out the variable. i dont like the look of that myself either to be honest.
And it needs to be enabled in the server configuration in order for it to work.
by AbraCadaver
Wed Sep 18, 2013 12:46 pm
Forum: PHP - Code
Topic: How do you filesize of an image from DB?
Replies: 21
Views: 4241

Re: How do you filesize of an image from DB?

Code: Select all

$image = "/images/pages/$row->image";
var_dump($row->image);
var_dump(filesize($image));
You probably need:

Code: Select all

$image = "/images/pages/{$row->image}";