Jump to content

ibrahimjan

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by ibrahimjan

  1. Like astralaaron said using closest class and the index class in jquery you can get the index of the tr, have a look at the fiddle. https://jsfiddle.net/8hL46ftj/ hope this helps $('img').click(function(){ alert($(this).closest('tr').index()) })
  2. thank you, what I did was changed the vale of group_concat_max_len from my.ini permanently, that worked very well.this is what I found out: The result is truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. The value can be set higher, although the effective maximum length of the return value is constrained by the value of max_allowed_packet. The syntax to change the value of group_concat_max_len at runtime is as follows, where val is an unsigned integer: SET [GLOBAL | SESSION] group_concat_max_len = val;-- http://dev.mysql.com/doc/refman/5.0/...n_group-concat
  3. Hi I created a relations sql statement between three tables, the problem is that my table tx and img is limited to only 1024 characters, is there a way I can change the data typ to display more than that, like use type = TEXT?? This is my statment: SELECTCONCAT('{"weID":"',wb.weID, ',"size_h":"',wb.size_h, ',"size_w":"', wb.size_w,'","text":[') as bs, CONCAT (GROUP_CONCAT(DISTINCT'{"weID":"',wt.weID,'","txtID":"',wt.txtID, '","txtText":"', wt.txtText, '","txtColour":"', wt.txtColour,'"}')) as txt, CONCAT(GROUP_CONCAT(DISTINCT '{"weID":"',wi.weID,'"',',"imgName":"',wi.imgName,'","imgName":"', wi.imgName,'","imgMTX5":"', wi.imgMTX5,'","imgMTX6":"',wi.imgMTX6,'","imgWidth":"',wi.imgWidth,'","imgHeight":"', wi.imgHeight,'","imgZindex":"', wi.ImgZindex,'"}'))as img FROM wb, wt, wi WHERE wb.weID = wt.weID and wb.weID = wi.weID GROUP BY wb.weID ORDER BY GROUP_CONCAT(DISTINCT wb.weID) ASC
  4. ibrahimjan

    CONCAT sql

    Hi All, I got this sql connection to my table wb, it all seems to work fine in phpmyadmin, when testing sql, but when i want to us it, it comes up with: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING inC:\----------\test3.php on line 75 line 75 is the $query_wb $query_wb = "SELECT CONCAT( "[", GROUP_CONCAT( CONCAT("{weID:'",`weID`,"'"), CONCAT(",weName:'",`weName`,"'}") ) ,"]") AS json FROM wb;"; any Ideas how to make it work??
  5. Ok I think I got my SQL sorted, it's a full array now, but have to change my original PHP.Any help in changing my original PHP to outpu like the above json string, is much appreciated. "SELECT wb.weID, size_h, size_w, imgID, imgName, txtID, txtText FROM wb JOIN wi ON wi.weID = wb.weID JOIN wt ON wt.weID = wb.weID WHERE wb.weID = '-126555895'"
  6. Ok, what I need to do is loop through $back to show all rows, at the moment its only displaying one which is "-126555895" obviously as set in the sql statement, but maybe I need to change my sql to show all records of $back, but $images and $text need all to show corresponding joint data by "weID" and I am having proper difficulties joining them. At the moment it's easy to set up because we are only showing one record "-126555895", I need to show all the records in the above json layout. I hope this makes senesce, its very hard to explain multidimensional arrays, any help is appreciated.
  7. Please have a look at my json data to see what I want to do: [ { "weID": "-126555895", "size_h": "700", "size_w": "494", "images": [ { "imgID": "1535689403", "imgName": "1321865407" } ], "text": [ { "txtID": "-1892792786", "txtText": "4.99" }, { "txtID": "1583276033", "txtText": "$" } ] }, // i cant seem to loop through my data to get more results looking like this:{ "weID": "3444555435", "size_h": "500", "size_w": "294", "images": [ { "imgID": "-454646555", "imgName": "77774433" }, { "imgID": "1535689403", "imgName": "1321865407" } ], "text": [ { "txtID": "15834443333", "txtText": "more text" } ] }] //my PHP code: $back = mysql_query("SELECT weID, size_h, size_w FROM wb WHERE weID=-126555895");$images = mysql_query("SELECT imgID, imgName FROM wi WHERE weID=-126555895");$text= mysql_query("SELECT txtID, txtText FROM wt WHERE weID=-126555895"); //all my above SQL statements have weID in common, how can I link them together, to show all my results rather then one "-126555895"?? $model = array(); while($e = mysql_fetch_assoc($back)){ $model['weID'] = $e['weID']; $model['size_h'] = $e['size_h']; $model['size_w'] = $e['size_w']; while($h = mysql_fetch_assoc($images)) { $model['images'][] = array( 'imgID' => $h['imgID'], 'imgName' => $h['imgName'] ); while($f = mysql_fetch_assoc($text)){ $model['text'][] = array( 'txtID' => $f['txtID'], 'txtText' => $f['txtText'] );}; };}; echo json_encode ($model); mysql_close($con); I need it to loop through so it can display all the records in
  8. If new data is created or updated on the server on a regular intervals, the js needs to check every 5sec or so to reload the new data, the ASP file is producing the new data. to prove that at the moment the only way to see the new data take place is by refreshing the full page. Can I not just refresh the Div's or that wont work?? thanks
  9. I added setinterval around the ajax, but I am getting the data to reload new set every 5sec, rather than refreshing the current data? please have a look. setInterval(function(){ $.ajax({ dataType: "json", url: "/jsondata.asp?LAYID=-1707637504", cache: false, success: function(data, status) { for(var i = 0, l = data.length; i < l; i++){var d = data[i]; $('.inner').append('<p><h1>' + d.DesignID + '</h1></p>'); //This is the Text Array/// for(var j = 0, k = d.Text.length; j < k; j++){ $('.inner').append('<p><h2>TEXT'+[j+1]+'</h2></p>'); $('.inner').append('<p>' + d.Text[j].TxText + '</p>');}}},});}, 5000);
  10. Hi I moved things around a bit, and came up with the following. Is there any way I can add a refresh function, to get new json data every 30 sec?? without refreshing the page. Thanks. $.ajax({ type: "GET",data: "{}",contentType: "text/plain",dataType: "json",url: "/jsondata.asp?LAYID=-1707637504", cache: false,success: function(data, status) { for(var i = 0, l = data.length; i < l; i++){ var d = data[i]; $('.inner').append('<p><h1>' + d.DesignID + '</h1></p>'); //This is the Text Array///for(var j = 0, k = d.Text.length; j < k; j++){ $('.inner').append('<p><h2>TEXT'+[j+1]+'</h2></p>'); $('.inner').append('<p>' + d.Text[j].TxText + '</p><hr>'); }}}});
  11. Thank you, I see what you mean, much better approach thanks. it seems to be working fine now, thank you for your time.
  12. Hi I have a json Data coming from an ASP script, this works all fine, please have a look at the data at:http://jancodesign.c...YID=-1422732274now I have created my JS to read this data please have a look at: http://jancodesign.com/js/JsonRead.js The problem is that I get the "DesignID" to show but not the "TxText" instead of the data to show I get "undefined"Any Ideas as why this is happening??Thank you
×
×
  • Create New...