Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparison between two string variables

Status
Not open for further replies.

rachid

Programmer
Jun 19, 2000
2
FR
Hi,<br><br>Could help me to solve the following problem:<br><br>A numerical variable is sent from an &lt;input&gt; tag to a WML &lt;card&gt;. The value's type is string (checked by the PHP function gettype() ). When trying to compare it to another string variable which comes from a MySQL databases, there is no effect.<br>The second problem is when trying to convert the first variable to a double. The return value is always zero.<br><br><br>thanks in advance,<br>R. kaced<br><A HREF="mailto:rachid@rosebud.fr">rachid@rosebud.fr</A><br><br>
 
This is the syntax:<br><br>----------------------------------------------------<br><br>function stocker1($respSocHV,$tMin) { <br>$k = 0;&nbsp;&nbsp;//'$k' sert à indexer tous les 'last_closing_price' non nuls et ayant un taux &gt; $tMin<br>//Création de deux vecteurs-réponses puisque la requête réclame deux colonnes <br>while ( list($Name,$taux) = mysql_fetch_row($respSocHV) ) {<br>//Selection des taux supérieurs à '$tMin'<br>&nbsp;&nbsp;&nbsp;&nbsp;if ( $taux &gt; $tMin ) {&nbsp;&nbsp; $tauxS[$k] = $taux;&nbsp;&nbsp;<br> $vectNameS[$k] = $Name;<br>&nbsp;&nbsp;&nbsp;&nbsp;} else { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo(&quot;&lt;p&gt;Essayer un taux plus bas&lt;br/&gt;&lt;/p&gt;&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;$k++; <br>}<br>return array($vectNameS,$tauxS);<br>}<br><br>-----------------------------------------------------<br><br>echo(&quot;&lt;card&nbsp;&nbsp;id=\&quot;card011\&quot;&nbsp;&nbsp;title=\&quot;Taux minimal\&quot;&gt;<br> &lt;do&nbsp;&nbsp;type=\&quot;accept\&quot;&nbsp;&nbsp;label=\&quot;Les réponses\&quot;&gt; <br> &lt;go&nbsp;&nbsp;href=\&quot;#card0111\&quot;&nbsp;&nbsp;method=\&quot;post\&quot;&nbsp;&nbsp;/&gt;<br> &lt;/do&gt; <br> &lt;p align=\&quot;left\&quot;&gt;<br> Introduire un taux de variations minimal: <br> &lt;input&nbsp;&nbsp;name=\&quot;t\&quot;&nbsp;&nbsp;&nbsp;format=\&quot;*N\&quot; /&gt; <br> &lt;/p&gt;&lt;/card&gt;&quot;);<br><br>------------------------------------------------<br><br>echo(&quot;&lt;card&nbsp;&nbsp;id=\&quot;card0111\&quot;&nbsp;&nbsp;title=\&quot;Tri par taux\&quot; &gt;&quot;);<br>list($vectNameS,$tauxS) = stocker1($respSocHV,&quot;$(t)&quot;);<br>.<br>.<br>.<br>echo(&quot;&lt;/card&gt;&quot;);<br><br>-----------------------------------------------<br><br>The problem is when comparing each element $taux with $tMin<br>with the if statement. It does anything but the execution of the script goes inside the if statement.<br><br>Thank you very much for trying<br>Rachid<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top