Forums

help sql

loul1933 31 Mar, 2011
Hi at all

<?php
$kilom = JRequest::getString('kilom', '', 'post');
if ($kilom) {
    $kilom2 = $kilom * 1,1; 
    $kilom = $kilom * 0,9;
  echo " WHERE `kms` >= $kilom and `kms` <= $kilom2 ";
}
<!-- echo " WHERE `kms` = $kilom "; -->
?>


i have put this simply code in my wher sql and it dont works

i have test the sql in phpmyadmin "where kms >= 90 and kms <= 110 and it is good
the code take a response and make 2 variables to emulate the between clause in where ?

Thank's at all
GreyHead 31 Mar, 2011
Hi loul1933,

Please try using . as a decimal point instead of , $kilom2 = $kilom * 1.1;

Bob
loul1933 31 Mar, 2011
hi Bob,

I have do that and the résult is...

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SQL=SELECT count(*) FROM jos_crb_parcours

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SQL=SELECT count(*) FROM jos_crb_parcours You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SQL=SELECT count(*) FROM jos_crb_parcours "

I do not undeerstand how the sql code is generate can you tell me that please?

JL
loul1933 02 Apr, 2011
Hi Bob,

What is the solution to see the execution of the code in chronoconnectivity

I have look to mysql to see the rules of the command "where" and i have see nothing to debug my problem

Thank's at you

JL
loul1933 02 Apr, 2011
Hi Bob,

YESSSSS i have found a solution : parentheses

echo " WHERE (`kms` >= $kilom) AND (`kms` <= $kilom2) ";

and the result is good

My question to debug is always "d'actualité"

Nice W-E

Jean Louis
GreyHead 02 Apr, 2011
Hi Jean Louis,

Well done; et bon weekend a vous aussi.

Bob
This topic is locked and no more replies can be posted.