RE: [PHP-DB] finder (I AM REALLY SORRY)

2009-07-17 Thread Emiliano Boragina
Jajajajaja no Yves... really I dont want you for do my job... for that I
said "I'm really sorry" because I understand what do yo think. I reading and
writing code testing all... I ask for you because not undertand something
complicated like this multifinder... I see a lot of finder tutorials
searching all without selecting data search... I'm thinking I must write
more than 100 lines for particular search, but with the hel of he list I see
not... I do a code with the help of a web... and help from you, list.

Sorry if you think that... but itsnt...
Thanks a lot...

+  _
   // Emiliano Boragina _
   // Diseño & Comunicación //
+  _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+  _

-Mensaje original-
De: Yves Sucaet [mailto:yves.suc...@usa.net] 
Enviado el: Viernes, 17 de Julio de 2009 10:08 a.m.
Para: php-db@lists.php.net
Asunto: Re: [PHP-DB] finder (I AM REALLY SORRY)

Hi List,

Am I the only one who's getting the feeling that we're doing Emiliano's JOB 
here? Maybe he should try posting a job opening at his company to this list,

instead of letting us solve all his problems and write his entire 
application for him.

I'm all for helping each other out, but this has just been a stepwise 
build-up of how to write his real-estate application.

Just my two cents,

- Original Message - 
From: "Emiliano Boragina" 
To: 
Sent: Friday, July 17, 2009 12:16 AM
Subject: [PHP-DB] finder (I AM REALLY SORRY)


Sorry a lot of times!!!

Please... tell me (and help me) to know if this is right:



= $row['precio'] <= $f_hasta;



if($f_codigo == "")

{

 $sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE
'";

 if ($f_inmueble > 0) { $sql_BUSQUEDA .= " inmueble LIKE
'%$f_inmueble%' "; }

 if ($f_operacion > 0) { $sql_BUSQUEDA .= "AND operacion LIKE
'%$f_operacion%' "; }

 if ($f_precio) { $sql_BUSQUEDA .= "AND precio = '$f_precio' "; }

 if ($f_moneda == 1) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' ";
}

 if ($f_moneda == 2) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' ";
}

 if ($f_region > 0) { $sql_BUSQUEDA .= "AND region LIKE
'%$f_region%' "; }

 if ($f_barrio > 0) { $sql_BUSQUEDA .= "AND barrio LIKE
'%$f_barrio%' "; }

 if ($f_ambientes > 0) { $sql_BUSQUEDA .= "AND ambientes LIKE
'%$f_ambientes%' "; }

 if ($f_dependencia > 0) { $sql_BUSQUEDA .= "AND dependencia LIKE
'%$f_dependencia%' "; }

 if ($f_cochera > 0) { $sql_BUSQUEDA .= "AND cochera LIKE
'%$f_cochera%' "; }

 if ($f_ubicacion > 0) { $sql_BUSQUEDA .= "AND ubicacion LIKE
'%$f_ubicacion%' "; }

 if ($f_apto > 0) { $sql_BUSQUEDA .= "AND apto LIKE '%$f_apto%' "; }

 $sql_BUSQUEDA .= " ORDER BY principal.id DESC";

 $result = mysql_query($sql_BUSQUEDA,$conn);

}

else

{

 $sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE
codigo = '$f_codigo'";

 $result=mysql_query($sql_BUSQUEDA,$conn);

 $row=mysql_fetch_row($result);

}

?>



Thanks a lot!



+  _
   // Emiliano Boragina _
   // Diseño & Comunicación //
+  _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+  _






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] finder (I AM REALLY SORRY)

2009-07-17 Thread Yves Sucaet

Hi List,

Am I the only one who's getting the feeling that we're doing Emiliano's JOB 
here? Maybe he should try posting a job opening at his company to this list, 
instead of letting us solve all his problems and write his entire 
application for him.


I'm all for helping each other out, but this has just been a stepwise 
build-up of how to write his real-estate application.


Just my two cents,

- Original Message - 
From: "Emiliano Boragina" 

To: 
Sent: Friday, July 17, 2009 12:16 AM
Subject: [PHP-DB] finder (I AM REALLY SORRY)


Sorry a lot of times!!!

Please... tell me (and help me) to know if this is right:



= $row['precio'] <= $f_hasta;



if($f_codigo == "")

{

$sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE
'";

if ($f_inmueble > 0) { $sql_BUSQUEDA .= " inmueble LIKE
'%$f_inmueble%' "; }

if ($f_operacion > 0) { $sql_BUSQUEDA .= "AND operacion LIKE
'%$f_operacion%' "; }

if ($f_precio) { $sql_BUSQUEDA .= "AND precio = '$f_precio' "; }

if ($f_moneda == 1) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' ";
}

if ($f_moneda == 2) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' ";
}

if ($f_region > 0) { $sql_BUSQUEDA .= "AND region LIKE
'%$f_region%' "; }

if ($f_barrio > 0) { $sql_BUSQUEDA .= "AND barrio LIKE
'%$f_barrio%' "; }

if ($f_ambientes > 0) { $sql_BUSQUEDA .= "AND ambientes LIKE
'%$f_ambientes%' "; }

if ($f_dependencia > 0) { $sql_BUSQUEDA .= "AND dependencia LIKE
'%$f_dependencia%' "; }

if ($f_cochera > 0) { $sql_BUSQUEDA .= "AND cochera LIKE
'%$f_cochera%' "; }

if ($f_ubicacion > 0) { $sql_BUSQUEDA .= "AND ubicacion LIKE
'%$f_ubicacion%' "; }

if ($f_apto > 0) { $sql_BUSQUEDA .= "AND apto LIKE '%$f_apto%' "; }

$sql_BUSQUEDA .= " ORDER BY principal.id DESC";

$result = mysql_query($sql_BUSQUEDA,$conn);

}

else

{

$sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE
codigo = '$f_codigo'";

$result=mysql_query($sql_BUSQUEDA,$conn);

$row=mysql_fetch_row($result);

}

?>



Thanks a lot!



+  _
  // Emiliano Boragina _
  // Diseño & Comunicación //
+  _
  // emiliano.borag...@gmail.com  /
  // 15 40 58 60 02 ///
+  _






--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] finder (I AM REALLY SORRY)

2009-07-16 Thread Jack van Zanen
not quite

if $f_inmueble > 0 is false (<=0) than this will not be part of the search
and the next line will add a AND following the WHERE which is syntax error

so try this:

$sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE
1=1 '";  //1=1 is always true

if ($f_inmueble > 0) { $sql_BUSQUEDA .= " AND inmueble LIKE
'%$f_inmueble%' "; }


2009/7/17 Emiliano Boragina 

> Sorry a lot of times!!!
>
> Please... tell me (and help me) to know if this is right:
>
>
>
> 
> include "conn.php";
>
>
>
> $sql = "SELECT * FROM principal FULL JOIN detalles FULL JOIN aestrenar FULL
> JOIN fotos ON principal.id=detalles.id=aestrenar.id=fotos.id ORDER BY id
> ASC";
>
> $result=mysql_query($sql,$conn);
>
> $row=mysql_fetch_row($result);
>
>
>
> $f_codigo = $_REQUEST['codigo'];
>
> $f_inmueble = $_REQUEST['inmueble'];
>
> $f_operacion = $_REQUEST['operacion'];
>
> $f_desde = $_REQUEST['fpreciodesde'];
>
> $f_hasta = $_REQUEST['fpreciohasta'];
>
> $f_moneda = $_REQUEST['moneda'];
>
> $f_region = $_REQUEST['region'];
>
> $f_barrio = $_REQUEST['barrio'];
>
> $f_ambientes = $_REQUEST['ambientes'];
>
> $f_dependencia = $_REQUEST['dependencia'];
>
> $f_cochera = $_REQUEST['cochera'];
>
> $f_ubicacion = $_REQUEST['ubicacion'];
>
> $f_apto = $_REQUEST['apto'];
>
>
>
> if(($f_desde <= 0) || ($f_desde == "")) { $f_desde = 0; }
>
> if(($f_hasta <= 0) || ($f_hasta == "")) { $f_hasta = 0; }
>
> if(($f_ambientes <= 0) || ($f_ambientes == "")) { $f_ambientes = 0; }
>
> $f_precio = $f_desde >= $row['precio'] <= $f_hasta;
>
>
>
> if($f_codigo == "")
>
> {
>
> $sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE
> '";
>
> if ($f_inmueble > 0) { $sql_BUSQUEDA .= " inmueble LIKE
> '%$f_inmueble%' "; }
>
> if ($f_operacion > 0) { $sql_BUSQUEDA .= "AND operacion LIKE
> '%$f_operacion%' "; }
>
> if ($f_precio) { $sql_BUSQUEDA .= "AND precio = '$f_precio' "; }
>
> if ($f_moneda == 1) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' ";
> }
>
> if ($f_moneda == 2) { $sql_BUSQUEDA .= "AND moneda = '$f_moneda' ";
> }
>
> if ($f_region > 0) { $sql_BUSQUEDA .= "AND region LIKE
> '%$f_region%' "; }
>
> if ($f_barrio > 0) { $sql_BUSQUEDA .= "AND barrio LIKE
> '%$f_barrio%' "; }
>
> if ($f_ambientes > 0) { $sql_BUSQUEDA .= "AND ambientes LIKE
> '%$f_ambientes%' "; }
>
> if ($f_dependencia > 0) { $sql_BUSQUEDA .= "AND dependencia LIKE
> '%$f_dependencia%' "; }
>
> if ($f_cochera > 0) { $sql_BUSQUEDA .= "AND cochera LIKE
> '%$f_cochera%' "; }
>
> if ($f_ubicacion > 0) { $sql_BUSQUEDA .= "AND ubicacion LIKE
> '%$f_ubicacion%' "; }
>
> if ($f_apto > 0) { $sql_BUSQUEDA .= "AND apto LIKE '%$f_apto%' "; }
>
> $sql_BUSQUEDA .= " ORDER BY principal.id DESC";
>
> $result = mysql_query($sql_BUSQUEDA,$conn);
>
> }
>
> else
>
> {
>
> $sql_BUSQUEDA = "SELECT * FROM principal FULL JOIN detalles WHERE
> codigo = '$f_codigo'";
>
> $result=mysql_query($sql_BUSQUEDA,$conn);
>
> $row=mysql_fetch_row($result);
>
> }
>
> ?>
>
>
>
> Thanks a lot!
>
>
>
> +
>  _
>   // Emiliano Boragina _
>   // Diseño & Comunicación //
> +
>  _
>   // emiliano.borag...@gmail.com  /
>   // 15 40 58 60 02 ///
> +
>  _
>
>
>
>


-- 
Jack van Zanen

-
This e-mail and any attachments may contain confidential material for the
sole use of the intended recipient. If you are not the intended recipient,
please be aware that any disclosure, copying, distribution or use of this
e-mail or any attachment is prohibited. If you have received this e-mail in
error, please contact the sender and delete all copies.
Thank you for your cooperation


Re: [PHP-DB] finder

2009-07-16 Thread Jack van Zanen
and also represents poor/lazy programming (in my opinion) leaving you open
to all sorts of trouble if columns get added or deleted.

I always advise to querry exactly what you require.

Sorry for this comment but op seems to be fairly novice on SQL and could
benefit from this post.

Brgds


Jack

2009/7/17 Corin Schedler 

> The * is a SQL shortcut. It means, in this case, all columns. So, in the
> SQL you posted it means get all columns from the buildings and city
> tables.
>
> corin
> dubdromic.com
>
> On Thu, Jul 16, 2009 at 06:50:20PM -0300, Emiliano Boragina wrote:
> > Hi again…
> >
> > I searching in www and find this (to do the finder):
> >
> > $sql = "SELECT buildings.*, citiy.* FROM buildings, city WHERE
> > buildings.idcity = city.id ";
> >
> >
> >
> > Dont understand “building.*”... what do it means?
> >
> > Thanks.
> >
> >
> >
> > +
>  _
> >// Emiliano Boragina _
> >// Diseño & Comunicación //
> > +
>  _
> >// emiliano.borag...@gmail.com  /
> >// 15 40 58 60 02 ///
> > +
>  _
> >
> >   _____
> >
> > De: Dan Shirah [mailto:mrsqua...@gmail.com]
> > Enviado el: Miércoles, 15 de Julio de 2009 09:17 a.m.
> > Para: Emiliano Boragina
> > CC: php-db@lists.php.net
> > Asunto: Re: [PHP-DB] finder
> >
> >
> >
> > But with that it doesnt difference between full and empty field…
> >
> > If the user want search on two posibilities on ten...
> >
> > Maybe I'm not understanding what you're asking...
> >
> >
> >
> > Or maybe you don't understand the query...
> >
> >
> >
> >
> >
> > Say your form has 10 checkboxes.
> >
> >
> >
> > If the users picks 3 out of ten boxes and clicks submit, the example I
> gave
> > you will search your database looking for all records that match the 3
> check
> > boxes.
> >
> >
> >
> > if $houses equals $_POST['houses'] then $houses will be empty if the
> > checkbox was not clicked and will not be included in the query.
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Jack van Zanen

-
This e-mail and any attachments may contain confidential material for the
sole use of the intended recipient. If you are not the intended recipient,
please be aware that any disclosure, copying, distribution or use of this
e-mail or any attachment is prohibited. If you have received this e-mail in
error, please contact the sender and delete all copies.
Thank you for your cooperation


Re: [PHP-DB] finder

2009-07-16 Thread Phpster





On Jul 16, 2009, at 5:50 PM, "Emiliano Boragina" > wrote:



Hi again…

I searching in www and find this (to do the finder):

$sql = "SELECT buildings.*, citiy.* FROM buildings, city WHERE
buildings.idcity = city.id ";



Dont understand “building.*”... what do it means?

Thanks.



+   

 _

  // Emiliano Boragina _
  // Diseño & Comunicación //
+   

 _

  // emiliano.borag...@gmail.com  /
  // 15 40 58 60 02 ///
+   

 _


 _

De: Dan Shirah [mailto:mrsqua...@gmail.com]
Enviado el: Miércoles, 15 de Julio de 2009 09:17 a.m.
Para: Emiliano Boragina
CC: php-db@lists.php.net
Asunto: Re: [PHP-DB] finder



But with that it doesnt difference between full and empty field…

If the user want search on two posibilities on ten...

Maybe I'm not understanding what you're asking...



Or maybe you don't understand the query...





Say your form has 10 checkboxes.



If the users picks 3 out of ten boxes and clicks submit, the example  
I gave
you will search your database looking for all records that match the  
3 check

boxes.



if $houses equals $_POST['houses'] then $houses will be empty if the
checkbox was not clicked and will not be included in the query.




Select all columns ( fields ) from the building table

Bastien

Sent from my iPod
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] finder

2009-07-16 Thread Corin Schedler
The * is a SQL shortcut. It means, in this case, all columns. So, in the
SQL you posted it means get all columns from the buildings and city
tables.

corin
dubdromic.com

On Thu, Jul 16, 2009 at 06:50:20PM -0300, Emiliano Boragina wrote:
> Hi again…
> 
> I searching in www and find this (to do the finder):
> 
> $sql = "SELECT buildings.*, citiy.* FROM buildings, city WHERE
> buildings.idcity = city.id ";
> 
>  
> 
> Dont understand “building.*”... what do it means?
> 
> Thanks.
> 
>  
> 
> +  _
>// Emiliano Boragina _
>// Diseño & Comunicación //
> +  _
>// emiliano.borag...@gmail.com  /
>// 15 40 58 60 02 ///
> +  _
> 
>   _  
> 
> De: Dan Shirah [mailto:mrsqua...@gmail.com] 
> Enviado el: Miércoles, 15 de Julio de 2009 09:17 a.m.
> Para: Emiliano Boragina
> CC: php-db@lists.php.net
> Asunto: Re: [PHP-DB] finder
> 
>  
> 
> But with that it doesnt difference between full and empty field…
> 
> If the user want search on two posibilities on ten...
> 
> Maybe I'm not understanding what you're asking...
> 
>  
> 
> Or maybe you don't understand the query...
> 
>  
> 
>  
> 
> Say your form has 10 checkboxes.
> 
>  
> 
> If the users picks 3 out of ten boxes and clicks submit, the example I gave
> you will search your database looking for all records that match the 3 check
> boxes.
> 
>  
> 
> if $houses equals $_POST['houses'] then $houses will be empty if the
> checkbox was not clicked and will not be included in the query.
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] finder

2009-07-16 Thread Emiliano Boragina
Hi again…

I searching in www and find this (to do the finder):

$sql = "SELECT buildings.*, citiy.* FROM buildings, city WHERE
buildings.idcity = city.id ";

 

Dont understand “building.*”... what do it means?

Thanks.

 

+  _
   // Emiliano Boragina _
   // Diseño & Comunicación //
+  _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+  _

  _  

De: Dan Shirah [mailto:mrsqua...@gmail.com] 
Enviado el: Miércoles, 15 de Julio de 2009 09:17 a.m.
Para: Emiliano Boragina
CC: php-db@lists.php.net
Asunto: Re: [PHP-DB] finder

 

But with that it doesnt difference between full and empty field…

If the user want search on two posibilities on ten...

Maybe I'm not understanding what you're asking...

 

Or maybe you don't understand the query...

 

 

Say your form has 10 checkboxes.

 

If the users picks 3 out of ten boxes and clicks submit, the example I gave
you will search your database looking for all records that match the 3 check
boxes.

 

if $houses equals $_POST['houses'] then $houses will be empty if the
checkbox was not clicked and will not be included in the query.



Re: [PHP-DB] finder

2009-07-15 Thread Dan Shirah
>
>  But with that it doesnt difference between full and empty field…
>
> If the user want search on two posibilities on ten...
>
Maybe I'm not understanding what you're asking...

Or maybe you don't understand the query...


Say your form has 10 checkboxes.

If the users picks 3 out of ten boxes and clicks submit, the example I gave
you will search your database looking for all records that match the 3 check
boxes.

if $houses equals $_POST['houses'] then $houses will be empty if the
checkbox was not clicked and will not be included in the query.


RE: [PHP-DB] finder

2009-07-15 Thread Emiliano Boragina
But with that it doesnt difference between full and empty field…

If the user want search on two posibilities on ten...

+  _
   // Emiliano Boragina _
   // Diseño & Comunicación //
+  _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+  _

  _  

De: Dan Shirah [mailto:mrsqua...@gmail.com] 
Enviado el: Miércoles, 15 de Julio de 2009 08:54 a.m.
Para: Emiliano Boragina
CC: php-db@lists.php.net
Asunto: Re: [PHP-DB] finder

 

Hello… I must to do a finder with 10 posibilities.

This 10 can be full or empty.

(sorry... I just ask this but I’m not understand yet)



I know how to do a finder about any field, but this is my first time with
one like this where the user can find a “house” in a “zone” or find anything
in that “zone”.

I must use IF the field empty SELCET... if the field is full SELECT... that
with all??

Please... help...

Thanks a lot

 

$house = $_POST['house'];

$zone = $_POST['zone'];

$abc = $_POST['abc'];

 

$query = "SELECT * FROM real_estate WHERE 1 = 1";

if ($house != "") {

   $query.="AND house = '$house'";

}

if ($zone != "") {

   $query.="AND zone = '$zone'";

}

if ($abc != "") {

   $query.="AND abc = '$abc'";

}

 



Re: [PHP-DB] finder

2009-07-15 Thread Dan Shirah
>
> Hello… I must to do a finder with 10 posibilities.
>
> This 10 can be full or empty.
>
> (sorry... I just ask this but I’m not understand yet)
>
>
>
> I know how to do a finder about any field, but this is my first time with
> one like this where the user can find a “house” in a “zone” or find
> anything
> in that “zone”.
>
> I must use IF the field empty SELCET... if the field is full SELECT... that
> with all??
>
> Please... help...
>
> Thanks a lot


$house = $_POST['house'];
$zone = $_POST['zone'];
$abc = $_POST['abc'];

$query = "SELECT * FROM real_estate WHERE 1 = 1";
if ($house != "") {
   $query.="AND house = '$house'";
}
 if ($zone != "") {
   $query.="AND zone = '$zone'";
}
 if ($abc != "") {
   $query.="AND abc = '$abc'";
}