php-general Digest 12 Jul 2010 15:27:29 -0000 Issue 6842

Topics (messages 306829 through 306833):

Recupero di pen drive e memory card non più accessibili
        306829 by: RDNewsLetter

Re: There has to be a better way!!
        306830 by: Richard Quadling

Re: Static Class Member References
        306831 by: Richard Quadling

help with sql statement
        306832 by: Adam
        306833 by: Ashley Sheridan

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Non vedi più i tuoi dati personali o le foto a te più care contenute nella tua 
pen drive o memory card perchè il supporto non viene più
riconosciuto dal sistema?

Devi sapere che abbiamo il 99% di casi positivi di recupero dati e files da pen 
drive o memory card.

Goditi l'estate ci penseremo noi a recuperare tutti i files nella tua memoria 
statica danneggiata.

Caratteristiche EcoStatic:

1.Ritiro del supporto a carico della RD data Rescue (valido solo per l'Italia e 
la Svizzera);
2.Entro 90 gg riceverai l'esito, e se: Non ci sono files, non ci sono costi;
3.Per diagnosi positiva riceverai i tuoi file a solo 250,00 €;
4.Scaricherai i tuoi files comodamente dal tuo computer (fino ad 1Gb compresso, 
altrimenti su DVD).

Per ulteriori informazioni contattaci:

- 800.031.677 (Italia)
- 091.68.20.545 (Svizzera)

Il servizio EcoStatic ha una durata limitata nel tempo, a discrezione della 
direzione di RD data Rescue Sagl che ne comunicherà il termine con una
nuova comunicazione.

 
Cambia la tua sottoscrizione (
http://lnx.rddatarescue.it/joomla/index.php?option=com_acajoom&Itemid=999&act=change&subscriber=88083&cle=7c921edaf253c451737bf94d12a5b3bc&listid=45
 )
Cancellati (
http://lnx.rddatarescue.it/joomla/index.php?option=com_acajoom&Itemid=999&act=unsubscribe&subscriber=88083&cle=7c921edaf253c451737bf94d12a5b3bc&listid=45
)

Powered by Joobi ( http://www.ijoobi.com )

--- End Message ---
--- Begin Message ---
On 11 July 2010 02:26, Jason Pruim <li...@pruimphotography.com> wrote:
>
> On Jul 10, 2010, at 12:03 PM, Ashley Sheridan wrote:
>
>> On Sat, 2010-07-10 at 11:58 -0400, Jason Pruim wrote:
>>
>>> Okay so I've been fighting with this for awhile now and haven't found
>>> a better way yet....
>>>
>>> What I want to do, is I have a small portion of my website included
>>> into a template. It is displaying hosting plans so on the main site
>>> "index.php" I want it to display a little bit of text (Same as on the
>>> main hosting page) and just 1 random hosting plan. then if they click
>>> on that plan and go into the main hosting section, I want them to see
>>> ALL the hosting plans.
>>>
>>> Here's the code that I'm using:
>>>
>>> if($_SERVER['PHP_SELF'] = "/index.php") {
>>>    $sql = "SELECT * FROM `hosting` ORDER BY RAND() LIMIT 1";
>>> }else{
>>>    $sql = "SELECT * FROM `hosting` ORDER BY `hostingSort` ASC";
>>>
>>> }
>>>
>>> Now... I know there MUST be a better way to do it but I can't see the
>>> tree's through the forest.
>>>
>>> Any other way I could do it?
>>>
>>> I'm avoiding having lots of duplicate code/text on my pages.
>>>
>>>
>>>
>>
>>
>> To avoid duplicating code, use an include file. If you already have some
>> form of include (for a DB for example) then you can include your other
>> includes in that.
>>
>> Also, not sure if it was a type in your email, but I think you want to
>> use == in your if statement there, instead of = ;)
>
> Hey Ash,
>
> I may not have explained it properly :)
>
> I have 2 files... hosting.php and hostingsmall.php which have the EXACT same
> content in them other then the SQL statement. Hostingsmall.php has a "LIMIT
> 1" at the end...
>
> What I want to do is be able to get rid of hostingsmall.php which is
> currently included on my main page and run it all off of hosting.php but
> still be able to limit the query at the front page...
>
> the $_SERVER['PHP_SELF'] seems to be doing the trick... Just wanted to find
> a better way since I've heard you should trust PHP_SELF...
>
> But if that's my best bet since it's working I can stick with it :)

If the only difference between the 2 files is the SQL statement, then
maybe you could ...

<?php
// hosting.php

// Define SQL
$sql = ' ... ';

// Include template
include 'template.php';
?>

And the same for hostingsmall.php, except you have a different SQL statement.

--- End Message ---
--- Begin Message ---
On 11 July 2010 23:19, Daniel Kolbo <kolb0...@umn.edu> wrote:
> Hello PHPers,
>
> I'm having some trouble understanding some PHP behaviour.  The following
> example script exhibits the behaviour which I cannot understand.
> [code]
> <?php
>
> class A
> {
>        public static $a = 3;
>
>        function __construct()
>        {
>                //self::$a = $this; //[i]
>                self::$a =& $this; //[ii]
>        }
> }
>
> class B extends  A
> {
>        function __construct()
>        {
>                parent::__construct();
>        }
> }
>
> class C {
>        var $c;
>
>        function __construct()
>        {
>                $this->c =& A::$a;
>        }
>
> }
>
>
> $c = new C;
> $b = new B;
> $cee = new C;
>
> var_dump($c->c); // [i] prints object(B), but [ii] prints int 3
> var_dump($cee->c); // [i] prints object(B), and [ii] prints object(B)
>
> ?>
> [/code]
>
> Why does $c->c print 'int 3' ?
>
> I'm nervous to use "self::$a = $this;" because I don't want to be
> copying the whole object.  However, isn't $this just a reference to the
> object, so "self::$a = $this;" is just copying the reference and not the
> actual object, right?
>
> Thanks in advance


What do you think the value should be?

A static property is bound to the class and not to an instance of the class.

So, &A::$a is a reference to the static value. If you alter the value,
it will be altered for a subclasses of A and for any other reference
to it.

--- End Message ---
--- Begin Message --- I was google searching, and the only SQL mailing list I found is currently giving a 503 error, so I hope you don't mind me asking my SQL question here, since there are a lot of SQL gurus here. I am having a syntax problem:

Instead of doing a query like this::

select SMS_R_SYSTEM.Name from SMS_R_System where (SMS_R_System.SystemOUName = "example.com/COMPUTERS/MAIN CAMPUS/ABC") or (SMS_R_System.SystemOUName = "example.com/COMPUTERS/MAIN CAMPUS/XYZ")

I'd like to shorten it in the where clause to:

select SMS_R_SYSTEM.Name from SMS_R_System where (SMS_R_System.SystemOUName = "example.com/COMPUTERS/MAIN CAMPUS/ABC", "example.com/COMPUTERS/MAIN CAMPUS/XYZ")

But I'm getting a syntax error.  Any idea why my SQL syntax isn't valid?



--- End Message ---
--- Begin Message ---
On Mon, 2010-07-12 at 10:24 -0500, Adam wrote:

> I was google searching, and the only SQL mailing list I found is 
> currently giving a 503 error, so I hope you don't mind me asking my SQL 
> question here, since there are a lot of SQL gurus here.  I am having a 
> syntax problem:
> 
> Instead of doing a query like this::
> 
> select SMS_R_SYSTEM.Name from SMS_R_System where 
> (SMS_R_System.SystemOUName = "example.com/COMPUTERS/MAIN CAMPUS/ABC") or 
> (SMS_R_System.SystemOUName = "example.com/COMPUTERS/MAIN CAMPUS/XYZ")
> 
> I'd like to shorten it in the where clause to:
> 
> select SMS_R_SYSTEM.Name from SMS_R_System where 
> (SMS_R_System.SystemOUName = "example.com/COMPUTERS/MAIN CAMPUS/ABC", 
> "example.com/COMPUTERS/MAIN CAMPUS/XYZ")
> 
> But I'm getting a syntax error.  Any idea why my SQL syntax isn't valid?
> 
> 
> 


The short answer is your syntax isn't valid, which means that what
you've written isn't valid SQL :p

What I think you're looking for instead is something like this:

SELECT SMS_R_SYSTEM.Name FROM SMS_R_System WHERE
SMS_R_System.SystemOUName IN ("example.com/COMPUTERS/MAIN CAMPUS/ABC",
"example.com/COMPUTERS/MAIN CAMPUS/XYZ")

which lets MySQL compare the field against an array of different values
within the brackets.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---

Reply via email to