在数据库返回的术语之间添加%20

I have a database of 2 word names and they have a space between them however in order for my api call to work I need a %20 between the first and second word.

Currently mysql_query returns Anas platyrhynchos and I need it to return Anas%20platyrhynchos

any quick solution?

You can use PHP urlencode. That should solve your problem.

you can use the replace() function to return the correct string from your query

replace(columnname,' ','%20')

Alternatively you can use the urlencode() function to do this in your PHP code

You can do this on the PHP side using urlencode

You will need to urlencode the returned result from the database. This will add %20 and other special URL characters I am assuming you need.

Use Replace function.

Select Replace(colName, ' ', '%20')