Query Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chelvan
    New Member
    • Aug 2008
    • 90

    Query Error

    hi forums !
    its me again.

    here my code, that i struggles...

    Code:
             $options=$_POST['options'];
    		 $hf=$_POST['hf'];
    		 $arr= count($options);
             if ($options){
                for ($i=0;$i<count($options);$i++){
    			 $pos[$i]= strlen($options[$i]);
    		        $name[$i]=substr($options[$i],0,$pos[$i]);
    			echo  $name[$i];
    
    		$sql_user=mysql_query("SELECT*FROM user WHERE username='$name[$i]'");
    		while($row=mysql_fetch_array($sql_user)){
    			echo $refno=$row['refno']."<br>";
    		}
    	}	
    }

    options[] is the name of my listbox. i able to pass it in to php thats print
    Code:
    echo  $name[$i];
    but the bellow query does not worked. i used the $name[$i] as where condition.


    why any errors in the query?


    thanks in advance
    chelvan
    Last edited by chelvan; Oct 30 '08, 05:29 AM. Reason: insert missed statements
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    do some debugging

    do an echo on mysql_error()


    Dan

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      SELECT*FROM ... won't work. You need spaces.

      Comment

      • chelvan
        New Member
        • Aug 2008
        • 90

        #4
        hi all

        thanks all of your response.

        please forgive me, i made a mad mistake on query on my where clause i checked different fields. now i correct that.


        so much sorry. before post i tried to find nearly 2 days. but i couldn't. then finally i did.


        any how thanks a lot.



        regards
        chelvan

        Comment

        Working...