I suppose I swear at $, because there is no jQuery connection.
UPDATE
There are more questions about what is written in the code. After all, by what is written, you will display the result of only the last element. the text will be many times overwritten and + to this you will have n + <script></script> blocks. I would suggest putting the script blocks out of the loop, and inside the loop, first make a large line, divided for example \n between entries. And at the end assign it to $("#mytext").html(result);
UPDATE2
<?php require 'connect.php'; mysql_set_charset( 'utf8' ); $sql_select = "SELECT * FROM users"; $result = mysql_query($sql_select); $row = mysql_fetch_array($result); // that string we will printf out $resultStr = "<script type=\"text/javascript\"> $(function(){ $('#mydiv').text(\" "; do { $resultStr+="Номер телефона: ".$row['name'].",Email: ".$row['email']." \n"; //Проверку я не добавлял - это уже сам =) } while($row = mysql_fetch_array($result)); $resultStr+=");}); </script>"; printf($resultStr); ?>
Sorry for my crooked code, I’m not phpshnik once, but somehow it will work a bit easier (it is desirable that #mydiv be as large as possible or even textarea at all - then it’s possible not to insert through .text, but through html)