Hello all I have some problemes inserting a substring in a where clause. All the code works xith a simple where= . I am soinf something wring in the substring but i can't find out what. Any help is welcome . Tks ! <?php $cible=$_REQUEST['cible']; mysql_connect("xxxxxxxxx", "root", "xxxxxxxxx") or die(mysql_error()); mysql_select_db("xxxxxxxx"); ?> <select name="city" id="city" style="width:auto; margin-right:10px;" onChange="getxxxxxx('xxxxxxxx.php?diagrefs='+this.value)" > <?php $req = "[B]SELECT * FROM xxxxxxxxxx WHERE SUBSTRING(field_xxxxxxx,0,2)=$cible[/B]"; $result = mysql_query($req); while($row=mysql_fetch_array($result)) { echo '<option value="'.$row['xxx'].'">'.$row['xxxxxx'].' - '.$row['xxxxx'].' - '.$row['xxxx'].'</option>'; } Code (markup): ?> </select>
Hello Thanks for your answer, i actually got the answer from another forum. My script works if I use ,1,2 in the substring. If i use ,0,2, it comes back empty. This point is actually explained black on white in the documentation. I should have RTFM