By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

Query Error

P: 90
hi forums !
its me again.

here my code, that i struggles...

Expand|Select|Wrap|Line Numbers
  1.          $options=$_POST['options'];
  2.          $hf=$_POST['hf'];
  3.          $arr= count($options);
  4.          if ($options){
  5.             for ($i=0;$i<count($options);$i++){
  6.              $pos[$i]= strlen($options[$i]);
  7.                 $name[$i]=substr($options[$i],0,$pos[$i]);
  8.             echo  $name[$i];
  10.         $sql_user=mysql_query("SELECT*FROM user WHERE username='$name[$i]'");
  11.         while($row=mysql_fetch_array($sql_user)){
  12.             echo $refno=$row['refno']."<br>";
  13.         }
  14.     }    
  15. }

options[] is the name of my listbox. i able to pass it in to php thats print
Expand|Select|Wrap|Line Numbers
  1. 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
Oct 30 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 1,584
do some debugging

do an echo on mysql_error()

Oct 30 '08 #2

P: 13,264
SELECT*FROM ... won't work. You need spaces.
Oct 30 '08 #3

P: 90
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.

Oct 30 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.