I've been playing with PDO and got quite a shock, so I thought I'd run this past you all. I love PDO, and I thought that the "prepare once, execute many" idea behind prepared statements was beautiful. Now previous to using prepared statements, I used to build up a long SQL 'VALUES' clause by looping through an array of "records" to insert, instead of running an INSERT query on every 'record' in the array. Sensible enough. So should I now dump that for "multiple executes" in my array loop? Well I tried. Here's my experience... I'm using a simple 'members' …

Member Avatar
Member Avatar
+4 forum 7

Hello everybody. There is a row in my db table I have set it's type as "TIMESTAMP". How should I fill in? Should get the current timestamp in php and send it to that row, correct? So how can I do that?

Member Avatar
Member Avatar
+0 forum 5

Hi. I'm working on my own CMS, i want the script to echo 3 posts in every page, and want the script to echo from the recent post and back to the oldest post. I mean like this: For example there is totaly 30 posts; First page => posts 30-29-28 Second page => posts 27-26-25 .... This is my script: <?php include('connection.php'); $error = FALSE; $result = FALSE; try { $row = $conn->query("SELECT MAX(id) AS last_id FROM Posts")->fetch(PDO::FETCH_OBJ); echo $row->last_id; echo "<hr>"; $last_id = $row->last_id; $total = $conn->query("SELECT COUNT(id) as rows FROM Posts") ->fetch(PDO::FETCH_OBJ); $perpage = 3; $posts = $total->rows; …

Member Avatar
Member Avatar
+0 forum 16

I have this code to add row to my table function addRow(tableID){ var table=document.getElementById(tableID); var rowCount=table.rows.length; var row=table.insertRow(rowCount); var colCount=table.rows[0].cells.length; var cell1=row.insertCell(0); cell1.innerHTML= rowCount+1; for(var i=0;i<colCount;i++){ var newcell=row.insertCell(i+1); newcell.innerHTML=table.rows[0].cells[i+1].innerHTML; }} and this for AJAX function function CLO() { var a=document.getElementById("keyword").value; var b=document.getElementById("chapter").value; if (a == ""&& b == "") { document.getElementById("CLO").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("CLO").innerHTML = …

Member Avatar
Member Avatar
+0 forum 1

Hello. There is an html table in admin page, with head columns (POST ID | POST TITLE | POST AUTHOR | ACTION). And in each row, will contain a post id, a post title, a post author that gets from database. And in the Action column, there is a "delete" word that is a link with href="#" for now. I want the script when i click on the delete word in each rows, erase that row of data from the table of the database and from the html table. I don't know how should i do that. Just need guidance …

Member Avatar
Member Avatar
+0 forum 44

Hello I have an SQL query that i want to concatenate the fields and display it in a way that those concatenated fields will be displayed first row will have 4 columns,second row will also have 4 columns....etc. for instance the query `SELECT imageurl, caption, template FROM template; The Result imageurl caption template image001 cap001 temp001 image002 cap002 temp002 image003 cap003 temp003 image004 cap004 temp004 image005 cap005 temp005 image006 cap006 temp006 image007 cap007 temp007 image008 cap008 temp008 I want it to be displayed this way cap001 cap002 cap003 cap004 image001 image002 image003 image004 temp001 temp002 temp003 temp004 cap005 cap006 cap007 …

Member Avatar
Member Avatar
+0 forum 4

hi. i got 2 tables next to each other: .contact-names & .guest-list and a left and a right button between those tables and a drop down list. by default both tables have the message "Please select an event" from the drop down. when an event is selected .contact-names will be filled with names from database which was hidden by default while .guest-list is empty. when a 3 rows(names) from .contact-names is selected background for those rows change to red. and then when right button is clicked those three names get appended to .guest-list(class for guest-names tbody). the problem arises when …

Member Avatar
Member Avatar
+0 forum 2

How to pass an row from resultset to an array[some index]=$row;

Member Avatar
Member Avatar
+0 forum 2

hi all! it might look similar to previous question but actually different.. i'm trying to calculate stock value. for this i want to use "average last purchase value" of item. like if closing stock is 14 and purchase detail is like this 2014/2/2 15pc @ 38000 2014/2/15 5pc @ 36000 2014/3/1 5pc @ 35000 now i want to calculate it from the last row moving up till we reach the number of closing stock value of 14pcs is (5 + 5 + 4)@(35000, 36000, 38000) (i might have failed to explain it more clearly. if so, please ask ur confusion …

Member Avatar
Member Avatar
+0 forum 27

Here some old fashioned line input routine, better idea nowadays would be to use GUI input box with real editing. Anyway, it is quite simple with Python to do this basic routine for terminal based program.

Member Avatar
Member Avatar
+4 forum 3

i have 2 tables one holds and id number for a transaction and the other tables holds the data for that transaction i can populate the first datagridview with the "id" data. I want to be able to select the row on the datagridview (id) and show the details for that transaction in another table Me.Tbl_Transactions_HeaderTableAdapter.ClearBeforeFill = True Me.Tbl_Transactions_HeaderTableAdapter.Fill(Me.DataSet_Sys.tbl_Transactions_Header) Me.Tbl_Transactions_HeaderDataGridView.Refresh() this populates the datagridview with the "id" data, how do i then click on a row and the details show in another datagridview. if i add the code for the transaction data on form load, then it populates all the …

Member Avatar
Member Avatar
+0 forum 3

hey guys. so i was thinking of creating this page that has 2 different tables : table1(table1 filled with names that are populated from database but lets not think about that part for now) and table2(empty), table1 rows are clickable and when doubleclick on one row the data in that row appends to table2 row but i would like that to also work on table2(moves from table2 to table1). obviously there are other functions that i would like these 2 tables to do but in order to do that i need to figure out the doubleclick functions. I am also …

Member Avatar
Member Avatar
+0 forum 2

hey guys so im trying to delete a row using checkbox but i get an undefined index error = Notice: Undefined index: check in D:\Xampp\htdocs\EMS2\event.php . i think its because the checkbox is echoed(?)maybe? or is it something else that i overlooked? <tbody class="tbody-event-list-table2"> <?php require "connection.php"; $check = mysql_query("SELECT * FROM event") or die(mysql_error()); if(mysql_num_rows($check) > 0) { while($row = mysql_fetch_array($check)) { $id = $row['event_id']; $name = $row['event_name']; $start = $row['start']; $end = $row['end']; $venue = $row['event_venue']; echo "<tr> <td><input type='checkbox' name='check' id='check' class='check' value='$id'/><a href='' class='event-link'>$name</a></td><td>$start</td><td>$end</td><td>$venue</td>"; ?> <?php if(isset($_POST['del_event'])) { if(count($_POST['check']) !=0) { $array = array("check" => $_POST['check']); …

Member Avatar
Member Avatar
+0 forum 4

I need to write a code that is gonna remove a whole row/column in a matrix(either static or dynamic matrix)

Member Avatar
Member Avatar
+0 forum 6

HI, so im trying to add new rows to my table using the codes that were given but the row doesnt stick, as in it disappears just after clicking a button. Am i doing something wrong? <script type="text/javascript" charset="utf-8"> var giCount = 1; $(document).ready(function() { //initialise the table $("#tables").dataTable( ); }); function fnClickAddRow() { $('#tables').dataTable().fnAddData( [ "Table "+ giCount, "Table "+ giCount] ); giCount++; } </script> <div style="float:right;height:0;width:500px"> <form method="" action=""> <div style="float:right;height:0;"> <input type="submit" name="addT" value="Add Table" onclick="fnClickAddRow();" /> </div> <table id="tables" border="2" rules="all" cellspacing="5px" cellpadding="5px" width="500px"> <thead> <tr> <th>Table</th> </tr> </thead> <tbody> </tbody> </table> </form> </div>

Member Avatar
Member Avatar
+0 forum 2

How can we detect redundant rows.and maintain their count. if the rows are like 11111 11111 10101 11111 the result i want is 11111 4 10101 1

Member Avatar
Member Avatar
+0 forum 3

I am trying to make a dynamic data table . I need row will add dynamically in table and only latest four row show in table . I don't need to show all data in table. here is my code to show dynamic row: $('#history').append('<tr><td>'+labordate+'</br>'+ formattedStart+'</td><td>'+formattedEnd+'</td><td>'+lengthFormatted+'</td><td>'+timeBetweenFormatted+'</td></tr>') Thanks for any help

Member Avatar
+0 forum 0

Hello, how to get id of selected row or clicked cell row in datagrid in vb6.0? Thanks

Member Avatar
Member Avatar
+0 forum 1

Hello I am using jxls quite fine. I'm sort of on my last lap with exporting my data to a file. However all I want to know is, how do I display my collection in the same row please? I've manage to do this downwards in the same column, but I'm not sure how to display them across in the same row. There website telss me how to do multiple collections across, but not one. Oy. I hope someone has an idea, because it "seems" simple enough.....seeems, but I judt don't tknow the syntax.

Member Avatar
Member Avatar
+0 forum 1

I have a 31,000 line spreadsheet, that will become a printed book. Based on the current column width (which has to stay the same for printing purposes) there are many lines that are only one line of text, and others that wrap to multiple lines. For some reason, for lines that are only one line (no wrapping needed) excel creates slightly larger padding below the text (even after auto fit), which creates a strange visual break (as if it's a new paragraph) and also makes the document longer than it needs to be because of the extra spacing. I'd like …

Member Avatar
Member Avatar
+0 forum 22

I created two dropdown which is filled with data fetched from mysql database by using the ajax and php function, Second dropdown is dependent on the first one and show relevant data. I placed both dropdown in adjacent to one another in table cell format. For the first row the dropdown elements fetched and it also shows relevant option to adjacent cells but while <HTML> <HEAD> <TITLE> Add/Remove dynamic rows in HTML table </TITLE> <script src="js/jquery.min.js"></script> <script src="js/add_table.js"></script> <script src="js/jquery.autocomplete.js"></script> <script src="js/jquery.min.js"></script> <SCRIPT language="javascript"> var xmlhttp; function ajaxFunction(url,myReadyStateFunc) { if (window.XMLHttpRequest) { // For IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new …

Member Avatar
+0 forum 0

I am trying to get the highest value in my rows. I have been at this awhile trying to figure it out. I assume it is suppose to return 3 values but honestly i really suck at this. Here is what I have public static int getHighestInRow(int[][] numbers, int row) { int highestRow = numbers[0][0]; for (int col = 0; col < numbers[row].length; col++) { if (numbers[row][col] >= highestRow) highestRow = numbers[row][col]; } return highestRow; } If you need to see the rest of my code let me know i will gladly show it.

Member Avatar
Member Avatar
+1 forum 6

I copied a list into Excel and some of the list formatted into the neihgboring columns instead of lining up in the list. I need to get the items floating out in the columns back into the proper place in the list. I assume I need to somehow run a Macro to insert a row below each cell in columns B-ZZ that contain text, and then somehow copy/past the floating values to Column A in the appropriate new row. Is there a Macro that can help? See below for example of issue. A B C D .... ZZ item 1 …

Member Avatar
Member Avatar
+0 forum 5

i need code for insert multiple rows into database please help me

Member Avatar
Member Avatar
+0 forum 5

I have a MSHFlexGird (fgdCompany) and a search command. When the user enters the search data into "txtSearch", the command should search for the data and show it to the user by : Highlighting the record in the MSHFlexGrid -OR- By bringing the row that contains the searched data to the top of the MSHFlexGrid. The code that I am using is given below. The search function works perfectly. Only thing is I can't make the record that contains the searched data be highlighted so that the user knows in which record the data that was search data is present. …

Member Avatar
Member Avatar
+0 forum 3

Wordpress - I want to use a title condition for displaying info on a page, from a MySQL table "country". The condition must compare the title with the names in the column "name" and when it match a value than display on the page the text from column "description" from the same row with the matching value. Example : title(USA)=column name (USA) get/fetch column (description) (the description from row USA). I had tryed a code <?php $page_name = $wp_query->post->post_name; query_posts('category_name='. $page_name); ?> <?php global $wpdb; $result = $wpdb->get_row ("SELECT name FROM country WHERE parent IN (SELECT parent FROM country WHERE …

Member Avatar
Member Avatar
+0 forum 2

I made a new MySQL table in Phpmyadmin in Wordpress in the same database from Wordpress but a new table. I want to make a new page and add a script in the body that allows: 1. when i insert the page title to the new page, the script should search the database table "workers" just in the column "name" and when it matches title(example "Jimbo") to the value in the column "name" (example "Jimbo") than display the "description" from name "Jimbo" (as in the table look down just "Jones"). It must search and display automatically. 2. or when i …

Member Avatar
Member Avatar
+0 forum 2

I have code that worked before so i copied and pasted into new PDO as I am upgrading my website. It displays all images in one row, even though i have told it after 4th image in row crete new row and sart putting images below the row above. <?php $query = 'SELECT * FROM tblgallery_images '; $stmt = $dbh->prepare($query); $stmt->execute(); $counter = 0; $numberperrow = 4; while($row = $stmt->fetch()) { $name = $row['imagename']; if($counter < $numberperrow) { echo 'image here'; $counter = $counter + 1; }else{ echo '<br>';//NEXT ROW INSERTED $counter = 0; echo 'image here'; } } ?> …

Member Avatar
Member Avatar
+0 forum 4

Hi there ! how to select row from datagridview when column have cells is empty I tried this but nothing worked Please help on this private void selectrow() { int i; for( i=0 ;i<dataGridView1 .Rows .Count -1;i++) { string row = dataGridView1.Rows[i].Cells["Name"].Value.ToString(); if (row =="") { sqlconn.Open(); string sqlquery = "select * from tbl... where id='" + dataGridView1.Rows[i].Cells["id"].Value.ToString() + "'"; SqlCommand sqlcmd = new SqlCommand(sqlquery, sqlconn); SqlDataAdapter sqlda = new SqlDataAdapter(sqlcmd); DataTable dt = new DataTable(); sqlda.Fill(dt); dataGridView1.DataSource = dt; sqlconn.Close(); } } }

Member Avatar
Member Avatar
+0 forum 3

Hello to everyone, my problem is, Im creating dynamacly rows in a table with a textfield and a checkbox, but to delete the rows the checkbox must be on the first column witch I dont get it, if I move the checkbox to the last column and press it, javascript associates that the checkbox is not checked! How can this be fixed? Do I need to loop through the elements of the row ? This is the code to add a row: <script> var intTextBox=0; $(function(){ var tbl = $("#Tablei"); $("#addRowBtn").click(function(){ intTextBox = intTextBox + 1; var contentID = document.getElementById('content'); …

Member Avatar
Member Avatar
+0 forum 2

The End.