ibrahimjan
-
Posts
57 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by ibrahimjan
-
-
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
-
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
- 1
-
CONCAT sql
in 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??
-
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'"
-
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.
-
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
How can I get tr index
in JavaScript
Posted
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