Harpreet wrote:

> I am using concat in my sql and it runs fine on mysql client. But when use
> din php it gives me an error:
> Supplied argument is not a valid MySQL result resource in
> <b>/var/www/html/scripts/cfg_code_delete.php</b> on line <
>
> $ssql="select concat(category, "-", code) as fill_column, code_id as
> submit_column from sys_code_tbl order by category";
> echo "<OPTION  selected value=\"\"></OPTION>";
> $result = mysql_query($ssql);
> while ($row = mysql_fetch_array($result))
>   {
>       echo "<OPTION
> value='".$row["submit_column"]."'>'".$row["fill_column"]."'</OPTION>";
>   }

>
>
> Help is appreciated.

1) Check your return values:
$result = mysql_query( $ssql );
if( ! $result ){
  print "Query Failed: $query<br>\n";
  exit;
}
while( ... )


2) You did not escape the quote in the query string. It shold be like:
$ssql="select concat(category, \"-\", code) as fill_column, code_id as

b.



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to