Search Results

Search found 35003 results on 1401 pages for 'table variable'.

Page 16/1401 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Adding dynamic data to a table

    - by user559780
    I've the following table in my application. I've a ajax request which will fetch the results to be shown in the table. How add these results to the table with out overridding the header every time? <table id="itemList"> <td>Name</td> <td>Price</td> <td>Quantity</td> <td>Total</td> </table> Then the ajax data is as shown below var items = [ { Name: "Apple", Price: "80", Quantity : "3", Total : "240" }, { Name: "Orance", Price: "50", Quantity : "4", Total : "200" }, { Name: "Banana", Price: "20", Quantity : "8", Total : "160" }, { Name: "Cherry", Price: "250", Quantity : "10", Total : "2500" } ]; Now I'm trying something like this but it is not working var rows = ""; $.each(items, function(){ rows += "<tr><td>" + this.Name + "</td><td>" + this.Price + "</td><td>" + this.Quantity + "</td><td>" + this.Total + "</td></tr>"; }); $( "#itemList" ).text('<tr><td>Name</td><td>Price</td><td>Quantity-</td><td>Total</td></tr>' + rows );

    Read the article

  • Problem with variable inside gsp

    - by xain
    Hi, I have a loop inside a gsp page, and I want to do a calculation on the fly, so I set a variable: <g:set var="total" value="0" /> And in the loop: <g:each in="${mob}" var="m"> ... <g:set var="total" value="${total+(m.q*m.sts.uf)}"/> ... </g:each> The "total" value does not correspond to the expected calculation. m.q is an integer, and m.sts.uf is a float. Any hints ? Thanks.

    Read the article

  • To share a table or not share?

    - by acidzombie24
    Right now on my (beta) site i have a table called user data which stores name, hash(password), ipaddr, sessionkey, email and message number. Now i would like the user to have a profile description, signature, location (optional) and maybe other things. Should i have this in a separate mysql table? or should i share the table? and why?

    Read the article

  • PHP and MySQL echoing out a Table

    - by user1631702
    Okay, so I've done this before, and it worked. I am trying to echo out specific rows on my database in a table. Here is my code: <?php $connect = mysql_connect("localhost", "xxx", "xxx") or die ("Hey loser, check your server connection."); mysql_select_db("xxx"); $quey1="select * from `Ad Requests`"; $result=mysql_query($quey1) or die(mysql_error()); ?> <table border=1 style="background-color:#F0F8FF;" > <caption><EM>Student Record</EM></caption> <tr> <th>Student ID</th> <th>Student Name</th> <th>Class</th> </tr> <?php while($row=mysql_fetch_array($result)){ echo "</td><td>"; echo $row['id']; echo "</td><td>"; echo $row['twitter']; echo "</td><td>"; echo $row['why']; echo "</td></tr>"; } echo "</table>"; ?> It gives me no errors, but It just shows a blank table with none of these rows. My Question: How come this wont show any rows in the table, what am I doing wrong?

    Read the article

  • PHP Global variable in class is reset

    - by Robert
    I have a web form that manipulates records in a MySQL database. I have a method for displaying an edit interface for both creating new records and editing them if ($_POST['new_page']) { print "<h2>Create new page</h2>\n"; $isNew=1; $this->EditForm(); } else if($_POST['edit']){ print "<h2>Edit page</h2>\n"; $isNew=0; $this->EditForm(); } I am trying to use the global variable $isNew to determine where a record is to be added or updated. However, whenever my SaveChanges() function is run, $isNew is always 0. $isNew is declared immediately after the class declaration, outside all of the functions. class Editor{ public $isNew;

    Read the article

  • Pass variable name to a function in r

    - by Misha
    Is it possible to pass just a variable name in a function call and have it utilised as such within the function?? pseudocode: q<-function(A){ b<-(w%in%A.2|w%in%A.7) factor(b,levels=c(F,T),labels=c("non-"A,A))} w<-c(0:10) e.2<-c(1,2) e.7<-c(6,7) what I´d like to do is q(e) and have returned non-e,e,e,non-e,non-e,e,e,non-e,non-e //M q<-function(A) { a2<-get(paste(a,".2",sep="")) a7<-get(paste(a,".7",sep="")) b<-(w%in%a2|%in%a7) factor(b,levels=c(F,T),labels=c(paste("non-",a,sep=""),a)) } q("e") Thx, M

    Read the article

  • How to remove margin at top of table?

    - by George Edison
    I have the following HTML: <div></div> <table> <tr><td>Test</td></tr> </table> ...and the following CSS: div { /* nothing yet */ } table { margin: 0px; border-collapse: collapse; padding: 0px; } No matter what I do, there is still a gap between the table and the DIV. This occurs on Google Chrome 5.0.375.70 beta on Linux. (And it seems to occur on other Webkit-based browsers too.) How can I get rid of the space?

    Read the article

  • Problem with variable argument function in C++

    - by Freezerburn
    I'm trying to create a variable length function (obviously, heh) in C++, and what I have right now works, but only for the first argument. If someone could please let me know how to get this working with all the arguments that are passed, I would really appreciate it. Code: void udStaticObject::accept( udObjectVisitor *visitor, ... ) { va_list marker; udObjectVisitor *i = visitor; va_start( marker, visitor ); while( 1 ) { i->visit_staticObject( this ); //the if here will always go to the break immediately, allowing only //one argument to be used if( ( i = va_arg( marker, udObjectVisitor* ) ) ) break; } va_end( marker ); } Based on my past posts, and any help posts I make in general, there is probably some information that I did not provide that you will need to know to help. I apologize in advance if I forgot anything, and please let me know what you need to know so I can provide the information.

    Read the article

  • jQuery table rebuild

    - by Happy
    We have a table: <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> <td>7</td> <td>8</td> <td>9</td> <td>10</td> </tr> </table> We update this table by throwing into each <tr> only 3 <td>. It must look like: <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td>8</td> <td>9</td> </tr> <tr> <td>10</td> </tr> </table> How can we do this? Thanks.

    Read the article

  • Javascript global variable not working properly?

    - by Fabian
    My jQuery code: $(document).ready(function() { chrome.extension.sendRequest({get: "height"}, function(response) { height = response.value; }); $("#id").css("height", height+"px"); }); You don't have to be concerned about the chrome.extension.sendRequest(), basically it communicates with a background page to fetch the value for "height" from localStorage and stores the value in global variable height. The problem lies in $("#id") not being assigned the height value. However if I were to modify it such that it is now: $(document).click(function() { $("#id").css("height", height+"px"); }); it works. Any idea why?

    Read the article

  • dynamically insert new rows in the table (JavaScript) ?

    - by Karandeep Singh
    <script type="text/javascript" language="javascript"> function addNewRow() { var table = document.getElementById("table1"); var tr = table.insertRow(); var td = tr.insertCell(); td.innerHTML= "a"; td = tr.insertCell(); td.innerHTML= "b"; td = tr.insertCell(); td.innerHTML= "c"; td = tr.insertCell(); td.innerHTML= "d"; td = tr.insertCell(); td.innerHTML= "e"; } </script> <body> <table id="table1" border="1" cellpadding="0" cellspacing="0" width="100%"> <tr id="row1"> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> </tr> </table> <input type="button" onClick="addNewRow()" value="Add New"/> </body> This example is for dynamically insert new row and cells in the table. But its behavior is different in all browsers. Internet Explorer = It add row in the last and new added cells are starts from first. Chrome/Safari = It add new row in the first and new added cells are starts from end. Mozilla Firefox = It is not working. Sir, I want new added row in the last and new added cells starts from first like(Interner Explorer) in all browsers. If you have any solution for same behavior please tell me. Thanks,

    Read the article

  • Hyperlinks within a table - '<a href="">'.$row['username'].'</a>'

    - by Taimur
    Hi, I have made a leaderboard table on my site, which returns the users in the MySQL database with the highest scores (score is a separate field). The fields in the leaderboard table are 'rank' 'username' and 'score'. I would like to link each username in the table to it's own profile page. The profile pages are in the format /profile.php?user=$username. How would I go about adding an <a href> within the table (which is echoed in php): echo '<tr><td>' .$a. '</td><td><a href="profile.php?user=' .$row['username']. '">' .$row['username']. '</a></td><td>'.$row['count'].'</td></tr>'; I've tried the above, but it doesn't seem to work. It shows the usernames, but they don't have any hyperlinks. Thanks

    Read the article

  • jquery updating a div in ajax diesnt work properly, when using a variable

    - by maschek
    hi, i got the following code var zieldiv = $(this).attr(\'id\'); $.ajax({ url: \'index.php?params\', type: \'POST\', data: { color:thenewcolor, zieldiv:zieldiv }, timeout: 50000, beforeSend: function() { $("#" + zieldiv).css({background: "#" + thenewcolor} ); } }); I use this for dragging a small div into a bigger div. the variable at the beginnning would give out the string "test1". So in the ajax.thing the css of a div which matches the var zieldiv should be updatet. Problem is, if i would place a string instead a var into the $(...) like $("#test1") it acts like its supposed to, the #test1 gets updated. but if i use the var $("#" + zieldiv) the parent div, which is surrounding the #test1-div gets updated. but i know for sure the var zieldiv contains the string "test1", because when passing it to php it contains "test1". so i think this is a little strange. do you have any ideas? thanx, maschek

    Read the article

  • how to access a firefox extension variable from the current document/window

    - by bosky101
    my firefox extension has an object myExt . myExt = { request: function(){ //makes request to server}, callback: function(json) { //do something with this } }; From a dynamically added script element, I make a call to a server that returns json, i want the json to be sent to myExt.callback that exists within my extension's js code. //from my extension, i add a script element myExt.request(); //from server i get the following response myExt.callback ( {"some":"json"}) ; //but the window doesnt find a reference to myExt how do i make a reference to myExt variable from the webpage ?

    Read the article

  • database table design

    - by e.b.white
    I design the tables as below for the system which looks like a package delivering system For example, after user received the package, postman should record in system, and the state(history table) is "delivered",and operator is this postman, the current state(state table) is of course "delivered" history table: +---------------+--------------------------+ | Field | Desc | +---------------+--------------------------+ | id | PRIMARY KEY | +---------------+--------------------------+ | package_id | package_tacking_id | +---------------+--------------------------+ | state | package_state | +---------------+--------------------------+ | operators | operators | +---------------+--------------------------+ | create_time| create_time | +---------------+--------------------------+ state table: +---------------+--------------------------+ | Field | Desc | +---------------+--------------------------+ | id | PRIMARY KEY | +---------------+--------------------------+ | package_id | package_tacking_id | +---------------+--------------------------+ | state | latest_package_state | +---------------+--------------------------+ Above is just the basic information to record, some other information( like invoice, destination,...) should be recored as well. But there are different service types like s1 and s2, for s1 it is not needed to record invoice but s1 need, and maybe s1 need some other information to record (like the tel of end user). After all, at delivering way stations there are additional information to record, and for different service type the information type is different. My question is: 1. For different service type, shall I need to declare different tables(option A) or just one big table which can record all information for all types(option B)? 2. If option A, since the basic information above is MUST, how can prevent from declaring there duplicate fields in different tables?

    Read the article

  • Help getting the following create table function to work with mysql and C#

    - by Matt
    string createTable = "CREATE TABLE IF NOT EXISTS " + m_strDatabase + "_TimeLogs (logName VARCHAR(16), logTime INTEGER, logCountry TEXT, UNIQUE(logName)) TYPE=MyISAM;"; When this runs, no table is created. No errors either. Im using an ODBC connector. the variable passes in the db name, so that the table created would be users_TimeLogs if the database was called users for example. Am I doing something wrong?

    Read the article

  • Change master table PK and update related table FK (changing PK from Autoincrement to UUID on Mysql)

    - by eleonzx
    I have two related tables: Groups and Clients. Clients belongs to Groups so I have a foreign key "group_id" that references the group a client belongs to. I'm changing the Group id from an autoincrement to a UUID. So what I need is to generate a UUID for each Group and update the Clients table at once to reflect the changes and keep the records related. Is there a way to do this with multiple-table update on MySQL? Adding tables definitions for clarification. CREATE TABLE `groups` ( `id` char(36) NOT NULL, `name` varchar(255) DEFAULT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8$$ CREATE TABLE `clients` ( `id` char(36) NOT NULL, `name` varchar(255) NOT NULL, `group_id` char(36) DEFAULT NULL, `active` tinyint(1) DEFAULT '1' PRIMARY KEY (`id`), KEY `fkgp` (`group_id`), CONSTRAINT `fkgp` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

    Read the article

  • getting parameter value from a table using javascript

    - by kawtousse
    hi every one; I want to get the parameter in my table(HTLML) table every time the user click edit button. The table contains in each row an edit button like following: retour.append("<td>"); retour.append("<button id=edit name=edit type=button onClick= editarow()>"); retour.append("<img src=edit.gif />"); retour.append("</button>"); retour.append("</td>"); to get the value of each row where edit is clicked using javascript I do the following: function editarow(){ var table = document.getElementById("sheet"); var buttons = table.getElementsByTagName("button"); for(var i=0; i<buttons.length; i++) { if(buttons[i].name=="edit") { buttons[i].onclick = function() { var buttonCell = this.parentNode;//cell var editThisRow = buttonCell.parentNode;//td var er=editThisRow.parentNode.attributes[1].value; alert(er); } } } } but i didn't get the values expected. thanks for help

    Read the article

  • problem with the table width in IE?

    - by Harish Kurup
    I am using table to display a set of data, my HTML code goes here... <table border="1" cellspacing="0" cellpadding="0" style="width: 780px;"> <tbody> <tr> <td style="width: 780px; height: 25px;"> <pre width='100' style='width: 780px; word-wrap: break-word;'> the data goes here..... </pre> </td> </tr> <tr> <td style="width: 780px; height: 25px;"> <pre width='100' style='width: 780px; word-wrap: break-word;'> the data goes here..... </pre> </td> </tr> </tbody> </table> this table works ok in firefox, safari, and IE8. But the problem arise in IE7, IE6.. asthe table expands and goes out of the screen(i.e expands towards right hand side in x-axis).... is there any hack to fix it?

    Read the article

  • Change row table color with javaScript

    - by Slim Mils
    I try to change the background of rows in my table with javaScript but it's not working. This is my code. However I tried to create my table with html and it's work. P.S : I want to use webkit. Help please. Code : var table = document.getElementById("tab"); var rowCount = table.rows.length; for(var i=0;i<6;i++) { row = table.insertRow(rowCount); row.id = "row"+i; cell1 = row.insertCell(0); var content = document.createElement("output"); content.innerHTML = i ; cell1.appendChild(content); rowCount++; } $(document).ready(function(){ $('td').each(function(i) { $('#tab').on('click', '#row'+i, function(){ document.getElementById("row"+i).style.background = 'white'; //alert(i); }); }); //example2 $('#td1').on('click', function(){ document.getElementById("td1").style.background = 'white'; }); });

    Read the article

  • Pass variable number of variables to a class in PHP

    - by user325282
    I need to pass a variable number of strings to instantiate different classes. I can always do a switch on the size of the array: switch(count($a)) { case 1: new Class(${$a[0]}); break; case 2: new Class(${$a[0]}, ${$a[1]}); break; etc... There has to be a better way to do this. If I have an array of strings ("variable1", "variable2", 'variable3", ...), how can I instantiate a Class without manually accounting for every possibility?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >