<script> function formul(a, b, c, d){ return <?= mysql_fetch_row(mysql_query('SELECT formula FROM table_name')) ?>; } </script>