Jquery vs PHP - load an image into a div
<p>i'm looking for a php script server side that load an image in a div on client side.</p>

<p>first shot :
ajax.php</p>

<pre><code>if((isset($_POST['id'])) &amp;&amp; ($_POST['id']=="loadphoto") &amp;&amp; (ctype_digit($_POST['idp']))) {
    $query=mysql_query("SELECT articleid, photoid FROM articles_photos WHERE id='".$_POST['idp']."'", $mydb);
    if(mysql_num_rows($query)!=0){
        while($row=mysql_fetch_array($query, MYSQL_NUM)) {
            $path="./articles/photos/".$row[0]."/".$row[1];
        }

        echo $path;
    }
}
</code></pre>

<p>myjs.js</p>

<pre><code>function loadPhoto(mexid) {
$.ajax({
    type: 'POST',
    cache: false,
    url: './auth/ajax.php',
    data: 'idp='+escape(mexid)+'&amp;id=loadphoto',
    success: function(msg) {
        $('.articleviewphoto1').find("img").each(function(){
            $(this).removeClass().addClass('photoarts');
        });

        $('#'+mexid).removeClass().addClass('photoartsb');
        $('#visualizator').html('&lt;img src="'+msg+'" class="photoartb" /&gt;');
    }
});
return false;
</code></pre>

<p>}</p>

<p>tnx for the helps</p>
