Welcome Guest, Not a member yet? Register   Sign In
PHP 4.4 problem (I think)
#1

[eluser]NachoF[/eluser]
ok, so Im getting a php error
"Parse error: syntax error, unexpected T_OBJECT_OPERATOR in ..../system/application/models/requirementsmodel.php on line 16"
it works just fine on my localhost but not the webhost which doesnt use php 5....
heres the line
Code:
$this->db->select('id,nombre')->from('modulos')->where('id_Moto', $id_Moto);

I called them and they said they cannot switch to php5... piece of crap... venezuela is really a third world country.... anyway, is there any way to chance that line so that it doesnt use chaining and it works with php 4?
#2

[eluser]tomcode[/eluser]
Code:
$this->db->select('id,nombre');
$this->db->from('modulos');
$this->db->where('id_Moto', $id_Moto);

That's what You want ?
#3

[eluser]NachoF[/eluser]
[quote author="tomcode" date="1242083750"]
Code:
$this->db->select('id,nombre');
$this->db->from('modulos');
$this->db->where('id_Moto', $id_Moto);

That's what You want ?[/quote]

I mean that makes sense but do you think that php4 will not give me an error anymore?? after all $this->db->select('id','nombre'); is chaining too,... just not that deep... Ill try and see.
#4

[eluser]tomcode[/eluser]
The syntax I used should work under PHP 4.

The differences 4 -> 5 are not too important, but I'd use a PHP 4 developing environment.

There are quiete some packages available which allow You to have PHP4 / switch between the two.

For Mac You can use Mamp, for PC You surly have a larger choice (I did use EasyPHP).
#5

[eluser]davidbehler[/eluser]
Actually $this->db->select(); is not chaining. $this is the object you are in (your model), db is an attribute of that object holding an instance of the db class and select is a method of the db class. Chaining means calling several methods after another where every method returns the object and that's used to call the next method.

PHP4 does not support chaining,e.g.
Code:
$this->db->select('id,nombre')->from('modulos')->where('id_Moto', $id_Moto);
with select, from and where being methods of the db class that each return the db object.

So you have to divide that into 3 different calls, just like tomcode proposed:
Code:
$this->db->select('id,nombre');
$this->db->from('modulos');
$this->db->where('id_Moto', $id_Moto);
#6

[eluser]tomcode[/eluser]
@waldmeister

nicely explained Smile




Theme © iAndrew 2016 - Forum software by © MyBB