Note that there are some explanatory texts on larger screens.

plurals
  1. PODouble request mysql/php for ajax
    primarykey
    data
    text
    <p>1 : I know my db is pretty mess-up, but I DON'T HAVE ACCES. I know they are crappy builded.</p> <p>2 : There is my database and my 2 tables: http://www.freeimagehosting.net/iu741</p> <p>3 : I got 3 dynamics lists, the first 2 are ok, but I got problem at my Third one.</p> <p>4 : My explode are well done of this field (22312,123,2145,1233) then i take those results and i send them by json_encode to my JS, and my JS send those resylts to my select/options. My result are: http://www.freeimagehosting.net/gltie</p> <p>5: So I want to keep this list fonctionnal, to put the number in value, but the name of the hostel in option (visible).</p> <hr> <p>My code JS:</p> <pre><code>$(function(){ $('#destination').change(function(){ $.getJSON('/dev/select2.php', {'destination': $(this).val()}, function(data) { var items = ''; $.each(data, function(key, val) { items += '&lt;option value="' + val + '"&gt;' + val + '&lt;/option&gt;'; }); $('#hotel').html(items); }); }); }); </code></pre> <p>My code php:</p> <pre><code>$requete = "SELECT DISTINCT deHotels FROM sirev_Dests WHERE deDestName = '". $_GET['destination'] ."' ORDER BY deDestName"; $connect = mysql_connect("&amp;&amp;&amp;&amp;&amp;&amp;","&amp;&amp;&amp;&amp;&amp;&amp;","&amp;&amp;&amp;&amp;&amp;&amp;"); mysql_select_db("&amp;&amp;&amp;&amp;&amp;&amp;", $connect); $res = mysql_query($requete) or die(mysql_error()); if ($res) { $row = mysql_fetch_assoc($res); $items = explode(',', $row['deHotels']); /* $newrequete = "SELECT hoName FROM sirev_Hotels WHERE hoCode = $items "; $donewrequete = mysql_query($newrequete) or die(mysql_error()); */ die(json_encode($items)); } </code></pre> <p>So actually, i got difficulty to send the good result at my JS. I can send the number in value and in option, but i dont know how to construct a 2 dimensional table and send it my json encode... i put my SECOND request in commment for the moment. </p> <p>Can some one help me? I hope im enough clear..sorry for my english by the way, im from Quebec city.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload