I found a drag and drop file upload system and i want use this code on my website. And I must connect with database. But a problem occurred during integrated. My problem is;
<a id="aaa" href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
$k = "{%=file.name%}";
echo $k; //output is: 4jkv1z2.jpeg
$sorgu="insert into images (image) VALUES ("{%=file.name%}");
mysql_query($sorgu); //output in table : {%=file.name%}
I can't get $k output in database. What can i do ?
Your templating engine (whatever it is) is looking for the replacement pattern in the html output of your code, not the code itself, thus when you echo the variable it actually echoes the replacement pattern, that gets replaced, but the sql query never gets outputted, thus never the pattern never gets replaced.
What you are trying to accomplish is not possible in the way you are trying it, take a look at the documentation of the templating engine or framework you are using. There might (must/should) be other ways to access the variable before the replacement.