1
I would like to know how I can conduct a consultation with a number float
. In the bank I have an item with this number (3.4), but when I apply the following code, it is not showing the item with number (3.4).
$numerador = '3.4';
$lisagemMedias = mysql_query("SELECT * FROM `medias` WHERE `cat`='".$dadosGerais["cat"]."' AND `subcat`='".$dadosGerais["id"]."' AND `numero`='".$numerador."' ORDER BY numero");
$mediaDados = mysql_fetch_array($lisagemMedias);
$numeradorPonto = str_replace('.', '-', $mediaDados["numero"]);
echo $dadosGerais["nome"].' '.$numeradorPonto;
I would like to know how I can fix this so that I can perform both integer queries and (1,2,3). As numbers with values float
as (1.2, 3.4).
You can try putting a simple quotation mark before this numerator, as you do with the id
AND 'numero' = ' ".$numerador." '
– LucasMotta
already edited I forgot why here I typed this code by the tablet was bad in any case still not making appear the value with float 3.4
– Striffer
In your bank you are not saved with no comma?
– Maicon Carraro
Not this saved as 3.4 even I did it in case when I put a number like the 3-4 it converts to 3.4 to send this value to SQL and the type in SQL instead of the int and float in the number field I do not use varchar and char because it does not sort right in numerical order depending on what you want to do and in my case it was necessary the float.
– Striffer