Skip to main content

Posts

Showing posts from January 17, 2012

jquery/js gliding/sliding navigation item effect

I'm trying to decipher effects like the one seen on http://www.htmldrive.net/items/demo/71/Dynamic-navigation-menu-with-scrolling-color-glide-followed-with-jQuery but I'm not very familiar with jquery/js (unless the code is all spelled out for me) I haven't been able to find many other examples of this menu effect (I'm probably using the wrong keywords). Can anyone help me figure out how these are generally created? I'd like to do so on my site (though with a thick underline instead of highlight). Thanks! edit- I realize I can just use one of these plugins, but I'd really like to understand what's going on/do my own

Bug with jquery-mobile: listview("refresh") and buttons, on Opera Mobile

I'm testing jquery-mobile with Opera Mobile browser. There are bugs, which are visible on both Opera Mobile Emulator and Opera Mobile on mobile device. On both they are occuring randomly (often, but not always). The most visible is with refreshing list with listview('refresh'); call. Sometimes the changes are not visible, and the pure HTML before the modifications is displayed. But after tapping the device the changes became visible. And also, some clicks on buttons does not work. Most of the time it works, but sometimes the button need to be pressed a few times. JQuery version is 1.6.4, jquery-mobile version is 1.0. Did you find similar bugs, or know what is causing them and how to prevent them? I think that jQuery-mobile is using some unstandard behaviour, which is working on other browsers, but is causing bug under Opera, because most of the apps works fine, but some are causing problems only under Opera/Opera Mobile.

JQuery - Output the class name of checked checkboxes

I am wondering whether or not it is possible to output the class name of checked checkboxes each time a checkbox is checked/unchecked? For example, I have 3 checkboxes. If I check one, it'll output its class name, if I then check a 2nd one it'll output the first checkbox class name + the 2nd class name. If I then uncheck the first checkbox, it'll only output the class name of the 2nd checkbox.. and so forth? I made a JSFiddle to get started... http://jsfiddle.net/LUtJF/ Thanks

why is that object declaration works in node.js and how to declare static variable?

i have seen this code : var myNet = require ("net"); and in some function: function foo (x,y) { var myNewNet = new myNet(); myNewNet.createServer(x,y); } why does the code above create a new object? what is the mechanism stands behind that? one more question, how do i create a static var in node.js, for example a id number that has to be unique. i came with this option for static variable: var id =0; and put it on the global scope, is it ok?

Jquery ajax functions stopped working

Ive been working on some jquery within a a page. Now all of a sudden the post functions seem to have stopped working? function deleteRow(OrderNo, LineNo) { alert(OrderNo + ";" + LineNo); $.ajax({ type: "POST", url: "Ajax.aspx/DeleteRow", data: '{' + 'OrderNo:"' + OrderNo + '",' + 'LineNo:"' + LineNo + '"' + '}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { //$("#item").val(msg); var data = jQuery.parseJSON(msg); if (!data.error) { $('#' + LineNo).remove(); } else { alert("Error" + " " + data.error); } }, error: function (msg) { alert('Failure: ' + msg); } }); }

Mocking a JSP"s post method versus creation an API

I have an requirement as per which I have to call an existing java function which is called from the UI through jsp. Data is provided from a form. I want to call that function from the java code. Should I create an API which should be called from the java code, and pass all the parameters required for the java function OR create a mock of the form(if its possible) and pass it to jsp. What is the recommended way?

I can call a no longer existing JS function but I can"t call new JS functions from my view

I have a problem regarding to a JavaScript function. I used to have a JS function located in a .js file which is also located in my project's NetBeans directory. I used to invoke that function from a view but later on I decided to change that function and add some new features to that function and call that new function from my view but it worked as in its past version and later on I changed that function's name which officialy means a function with the previous name was totally destroyed and this time I invoke my JS function from its new name and nothing worked. The funny thing is that, I again called that function with its previous name (again, it doesn't exists actually), it works as its past version although I have totally changed that function's name and officially a function with that name no longer exists in my file. What do you fellows think I should do? Yours ideas and helps are greatly appreciated...

Ext JS 4.0 providing "unconventional” data to charts

I have a store which always contains a single record. Lets say the record looks like this: {'good': 5, 'bad': 2, 'neutral': 3} How would I render that as a Pie chart ? Ext.js normally uses each record in a store as one point of the series. In my case, I have only one record and want it to be used as three points in the series.

jquery whole page/window slider

I'm interested in making a whole page slider like in http://littlemonsters.com/ for example. I've looked around at their code and am trying to figure out -how they did this whole page slide (which I guess is just a very big slider), and also -how although the individual 'pages' are stacked on top of each other (like a normal page), when they slide, they are sliding left and right (part of the whole slider problem I guess) It seems that for many slider plugins, they somehow horizontalize list items (whereas when I do sliders by hand I make a really really long wide list with like width 9999px and have an overflow hidden viewing window--this is probably not the best way). here's some js I found on the above site that I think holds the key but I can't understand too well/incomplete. step = (id) -> width = $(window).width() dir = 1 dir = -1 if id < curId curId = id $(".boxDisplay").animate left: -1 * dir * width , 500, "

How do I resend a failed ajax request?

I have multiple ajax requests some request data every minute others are initiated by the user through a ui. $.get('/myurl', data).done(function( data ){ // do stuff.. }); The request might fail due to an authentication failure. I've setup a global .ajaxError() method for catching any failed requests. $(document).ajaxError(function( e, jqxhr ){ // Correct error.. }); After I catch the error I reset authorization. Resetting the authorization works but the user has to manually re initiate the ajax call (through the ui). How do I resend the failed request using the jqxhr originally sent? (I'm using jQuery for the ajax)

jQuery Sortable UI Syntax Issue

Im not quite sure what to search for to sort out this problem. I am getting syntax error with the following code because i have 2 (no idea what to call them) in the .sortable options. Would you be able to tell me what i have done wrong with this code? Im using a placeholder and also a connectWith from this page http://jqueryui.com/demos/sortable/#portlets and there doesnt seem to be any examples showing how to write both of them at the same time. The syntax error is not there when i comment out placeholder: "placeholder-highlighting" or connectWith: ".sortable-content" My code is below: $(function() { $( ".sortable-content" ).sortable({ placeholder: "placeholder-highlighting" connectWith: ".sortable-content" }); $( ".sortable" ).disableSelection(); }); Bonus points for telling me what they are called!

How to retain a selected value in dynamically generated dropdown box to the next jsp page?

I have a drop down box where the options are coming from the configured properties file.The options are generated on load of the page.I have used the following code. In JSP <select name="IDNo" id="IDNo"> </select> function loading() { var d = document.getElementById("system"); var df=document.getElementById("IDNo"); var i = 0; var disp = document.getElementById("Range"); var numberOfOptions = df.options.length; for (i = 0; i < numberOfOptions; i++) { df.remove(0); } if (d.value == "Apple") { df.options[df.options.length] = new Option("ALL",""); for(i=1;i<=disp.value;i++) { var option = document.createElement("option"); option.text=i; option.value=

How to check every checkboxes in a jquery datatable?

I have a table with checkboxes in the first column. I use the jQuery DataTable plugin display my table. I made 2 links to select/unselect every checkboxes. Here's the one to select all : <a href="" name="CheckAll" onClick="checkAll(document.email_list_form_inviter.getElementsByClassName(\'email_checkbox\'), event)" >Select all</a> And the javascript : function checkAll(field, event) { event.preventDefault(); for (i = 0; i < field.length; i++) field[i].checked = true ; return false; } But the datatable enables pagination and my function select only the visible checkboxes, not those of the other pages. How can do to select every checkboxes in my data table? Thanks :) Solution : Ok I did this with fnGetNodes, thank you amccausl! $("a[name='CheckAll']").click(function(event) { event.preventDefault(); var nodes = datatable.fnGetNodes( ); $('.email_checkbox&#

I want to show the lightbox on only homepage of my blog.but somethings wrong

I have this code: <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js'/> <script src='https://gj37765.googlecode.com/svn/trunk/html/[www.gj37765.blogspot.com]jquery.colorbox-min.js'/> <link href='https://gj37765.googlecode.com/svn/trunk/html/%5Bwww.gj37765.blogspot.com%5Dfbpopup.css' rel='stylesheet' type='text/css'/> <script type='text/javascript'> jQuery(document).ready(function(){ if (document.cookie.indexOf(&#39;visited=flase&#39;) == -1) { var fifteenDays = 1000*60*60*24*30; var expires = new Date((new Date()).valueOf() + fifteenDays); document.cookie = &quot;visited=false;expires=&quot; + expires.toUTCString(); $.colorbox({width:&quot;400px&quot;, inline:true, href:&quot;#mdfb&quot;}); } }); </script> The code is for a Facebook-like box which appears when a use

Trouble with displaying JSON array

could you please help me figure out why I'm getting "undefined" instead of the value. As it is plain to see I'm having trouble getting the data from the array, in firebug I get this as a response.... {"status":"success", "response":[ {"email": {"email":"xxxxx@iing.mxl.uabc.mx", "valid":"1", "reason":null, "confirmed_at":"0000-00-00 00:00:00", "contact_email":"1", "login_email":"1", "users_id":"6375"}, "history":[ {"contactRole":"Non Classified Lead with History", "contactProject":"2082", "contactBrand":"B"}, {"contactRole":"co Author", "contactProject":"32", "con

How can I navigate to a url programmatically with a correct referer header?

I have a flex application that uses the actionscript navigateToURL function to go to another system. However, a third party app that needs to be integrated checks for valid links by looking at the HTTP referer header, and it seems like that header is blank when using a navigateToURL call. Is there a way in actionscript or javascript to programatically generate a url and go to it with a correct referer header?

PHP Securely transform $_GET / $_POST array

I was checking my script for vulnerabilities and was shocked the way i used to do in the past which is extremely insecure: foreach ($_GET as $key => $value){ $$key = $value; } or shorter extract( $_GET ); I altered with firebug some POST/GET variables to match a name i used in my script. they can be overwritten if the name would be guessed correctly. So i thought i had to do it individually naming like this: $allowed_vars = $allowed_vars = array("time","hotfile","netload","megaupload","user","pfda","xyz","sara","amount_needed"); foreach ($_GET as $key => $value) { if (in_array($key,$allowed_vars)) { $$key = $value; } } This way saves some time than naming them individually. What kind of automation have to be used for this?

How can I check if an array contains a specific value in php?

I have an array of data created by a form that and I would like find out if it contains a specific value and let the user know that it is there. This is my array: Array ( [0] => kitchen [1] => bedroom [2] => living_room [3] => dining_room) and I would like do something like: if(Array contains 'kitchen') {echo 'this array contains kitchen';} What is the best way to do the above???

Why does this code make my screen go blank in admin when I put it in functions.php?

When publishing content or changing any settings in the admin, the screen goes blank, I found that it's due to this code in my functions.php file. Is there something wrong with it? <?php if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name'=> 'Footer', 'id' => 'footer', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<div class="title">', 'after_title' => '</div>' )); register_sidebar(array( 'name'=> 'Right-Sidebar', 'id' => 'rightsidebar', 'before_widget' => '<div class="white-bar">', 'after_widget' => '</div>', 'before_title' => '<div class="title">', 'after_title' => '</div>' )); register_sid

IE8 - button background Image not showing?

I have a submit button which has the following CSS: .button{ border:1px solid #015691; background-image:url('http://boundsblazer.com/pkg/pics/ buttons/small-button.png'); color:#ffffff; height:18px; font-size:8pt; font-family:sans-serif, verdana; cursor:pointer; line-height:14px; margin-bottom:-5px; border-bottom-color:#222222; -webkit-border-radius: 3px 3px 3px 3px; -moz-border-radius: 3px 3px 3px 3px; border-radius: 3px 3px 3px 3px; behavior: url("http://boundsblazer.com/pkg/plugins/PIE.htc"); } and my JQuery... $(".button").mousedown(function(){ $(this).css('border-bottom-width', '0px'); $(this).css('background-image', 'url(\'http://boundsblazer.com/pkg/pics/buttons/small-button-pressed.png\')'); $(this).mouseout(function(){ $(this).css('border-bottom-width', '1px'); $(this).css('background-imag

Javascript zoom library isn"t working

i am using this library zoomooz.js and i implemented it on my website but it isn't working, i followed the examples which came with the library but it only seems to work on the background. When i click on an article to zoom to i get an error in the google chrome console saying: "Uncaught TypeError: Object # has no method 'initialize'" in the "jquery.zoomooz.js:294" but i dont think it is a good idea to change the library so it must be an other problem sinds it works fine in the examples. many thanks in advance!

How to send a Javascript variable to server side?

I must add items to an existing code, but I do not know all the patterns established. I need to retrieve a value from a numeric field in javascript, store it in a JSP tag variable and submit it to a Java method. I know javascript is client side and the server-side Java. This is a numeric field "ZONE" whose value must be recovered for a loop The added code is input "ZONE", the Action buton "ADD_ELEMENT_LISTE_OUVERTE_1" and the variable and loop "zone". thanks ! JSP-side code: <popo:form> <div class="left"> nombre de colonnes <input type="number" id="zone" name="zone" class="text" maxlength="25" valeur="" /> </div> <div class="right"> <%controller.getContext().getInteger(ListeOuverteContributionDetailController.ZONE) =%> <script type="text/javascript"> function get

Find a url in content a site by url it?

I want search into content a site by url it site, if existence my url (for example: http://www.mydomain.com/ ) return it is TRUE else it is FALSE. If existence url as following list, Return it is FALSE: - http://www.mydomain.com/blog?12 - www.mydomain.com/news/maste.php - http://www.mydomain.com/mkds/skas/aksa.html - www.mydomain.com/ - www.mydomain.com I want just accsept(find) as(only): http://www.mydomain.com/ OR http://www.mydomain.com I tried as: $url = 'http://www.usersite.com'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec($ch); curl_close($ch); $link="/http:\/\/mydomain.com/"; if(preg_match("/". preg_quote($link,"/"). "/m", $contents) && strstr($contents,"http://www.mydomain.com")){ echo 'TRUE'; } else{ echo 'FALSE'; } But it doesn't worked, for it w

PHP from quotation mark output

I use a similar form on a regular basis and have just become aware that whenever a single OR double quotation mark is inputted into the form the output to myself (through email) displays the quotation mark as the ASCII code so \' with a backslash ive looked around and dipped into unique character encodings specialentities but cant seem to find anything that will help output it as a normal quotation mark.

facebook type lightbox with comments system

After trying few available lightbox plugins and trying to put or intergrate a comment system into it like facebook has, I can't seem to find a way to find out how to do it. All the lightbox plugin have all the code in js file and using php inside any js file is like inviting sql injections. Can any one really help me telling a way to do it? I know we can take a div as popup and then show comments and photo both, but then how to bring the next pic or the previous pic functionality. I wasted about 15 days on this but no success, also read some stackoverflow post, they all refer to lightbox such as color box, etc, but have tried em. Any help?

php Project with java

Our Web Project first was written in PHP, but after that time we have sub projects which were written in Java. now we have some data to exchange. $url = 'http://hr.sankuai.com/mtorg/org/api/mischange?start='. $stime. '&end='. $t. '&token='. $token; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); $content = curl_exec($ch); Now we always do like this. Such as java have a service, then PHP wants to visit the service, then we will call curl function. We always do like this. I think it's very ugly. Do you have some experience where a project mix with java and php. How can you do when you php want to visit you java service. Or you java project want to visit the php service. Does thrift can solve This problem? Thank you~

JQuery Ajax - Code did work now it does not?

I built a basic form with ajax validation and page redirection with PHP and jQuery. This was working fine a few days back. I have come back to it and the ajax seems to have stopped working. At the moment the ajax is just checking a test var and echoing back data. It is really bugging me as it working fine initially! Seems strange as I cannot spot anything obvious, hoping some fresh eyes can help. The ajax has stopped sending data across so I click submit and the ajax sends nothing so my if() does not do anything! I get the form values fine. Tried with basic ajax and alerts, something strange seems to be happening. Hope you can help <form id="registerform"> <ul id="form"> <li> <label for="email">Email:</label><span class="fieldbox"><input type="text" id="email"/></span> </li> <li> <label for="confirmemail&qu

JQuery issue with no response from server (localhost) with different browsers

I have what is a simple script to retrieve a simple message (string) from server and it appears there is no response from server, so I am wondering if JQuery is even firing off a request at all? The server side script (PHP) is so simple, basically it is just a plain echo. One moment the script is working in FF and the next moment it ain't, as for the other mainstream browsers, you can forget about it! Here is the JQuery script below, do you see anything I'm missing (considering I am new to JQuery / AJAX / Still learning)? Thanks. $(document).ready( function() { $( '.enlarge' ).click(function( e ) { e.preventDefault(); var img = $( this ).children( 'img' ).attr( 'alt' ); var url = '/pages/message/' + img + '/'; $.ajax({ url: url, data: '', cache: false, dataType: 'text

How to implement a &ldquo;save&rdquo; feature with dynamic content using cookies

I would like to implement a "save" feature, which allows my users to save a particular entry that I have presented to them from my database. For example, if they see something they like, they can press the "save" button and it will save to a "bookmarks" page. Here is my code: <?php // Get all the data from the example table $result = mysql_query("SELECT * FROM table WHERE item <> 0 ORDER BY id") or die(mysql_error()); // keeps getting the next row until there are no more to get $i = 10; while ($i > 0) { $i--; $row = mysql_fetch_array( $result ); if ($row['id'] != "" ) { ?> <!-- Some content in this div--> <div class="content"> <img src="<?php echo $row['logo']; ?>"/> <?php echo $row['id']; ?> </div> <!-- This div will have the save icon that users can press --> <div class="save"> <img src="imag

HTTP PUT Parameter

I create a rest-webservice with the php framework "tonic". I have a User Class and handle it with the library. According to CRUD i use HTTP_PUT to UPDATE the User: function put($request) { $response = new Response($request); $split = explode ('&',$request); $para = array(); foreach($split as $i) { $names = explode('=',$i); $para[$names[0]] = $names[1]; } $response->body = var_dump($para); return $response; } My Question is how do I access the calling parameters? At the moment I parse it manually into an array.

PHP-CURL curl_multi_exec is it really multithreaded internally?

My question is very simple as stated in title. However I rephrase it again. I want to download multiple sites using php-curl. I'll run it from console. I am going to use curl_multi_exec to download all the sites. Now the question, will curl create different threads for each of the request? I know I can achieve it by forking multiple processes. But thats not threading. I dont want threading. I want to know if its multi-threaded?

Check link in phpbb post

Function I have (in includes/functions_posting.php): function url_exists($url) { $handle = @fopen($url, "r"); if ($handle === false){ return false; fclose($handle); } else{ return true; fclose($handle); } } Usage (In posting.php): $your_url = "http://www.somewhere.com/index.php"; $your_url = preg_replace(array('#&\#46;#','#&\#58;#','/\[(.*?)\]/'), array('.',':',''), $your_url); if (url_exists($your_url)) { echo 'yeah, its reachable'; } else { echo 'what da hell..'; } I think it works just fine. I get the text echoed on header with an error saying headers already sent. Instead of echo I now use trigger_error('error message); Now I get the error the way I want it to be,except that no matter what the url I have in $your_url I keep getting the same error that the URL exists even when it's not! Also,I'd like to make the function

PHP/MySQL - store default text in database or in a file?

OK so I am creating a system where whenever a shop signs up, they get 10 default slides that they can then customize later. The default slide data is just a starting point for them. But I have to assume a lot of shops will not log in and update the information, they just want something up ASAP. So say for the Dashboard slide, every shop starts out with the same heading and text until they go in and update it themselves. Do I insert it in the database, like so: id | slide_id | user_id | headline | text 1 | 1 | 1000 | ... | .... 2 | 1 | 1001 | ... | .... So the database will contain many duplicates of that headline and text since it is the default. Is that a good idea? Or do I do something like this: define("DEFAULT_TEXT", "The text goes here and just used once in a file."); $text = ($stmt->num_rows < 1 ? DEFAULT_TEXT : $text); so I have a query that searches through my slide_data table to see if anything exists for tha

Custom session handler in php using db

I am having problem with implementing custom session handler in php. The code: http://pastebin.com/9QV9f22Q I initialize this once in my frameworks bootstrap, after I have connection with db: require_once 'DbSession.php'; $session = new DbSession(); session_start(); But then I can't view my page. Firefox gets 302 Status with "Server not found" error. Firebug says that content is 5k long, but I can't view the page. Log after one reload: http://pastebin.com/JYe14nGR I wonder why it still "loses" that created DbSession instance. Do yo have any ideas? TIA

Reading Unicode characters from MySQL with PHP

I've inherited a MySQL database which contains a field named Description of type text and collation of latin1_swedish_ci . The problem with this field is it contains utf-8 data with some Unicode characters, e.g. character 733, etc. Sometimes this character also exists in the field represented as HTML encoded "&#733" as well. I'm trying to read the table and export the data to a CSV file and I need to represent this character as a double quote. Reading the HTML encoded character is easy enough. However, it appears that the actual Unicode character is converted to utf-8 before I can do anything with it resulting in a "?". How do I read in the Unicode character 733 (U+02DD), recognize it and convert it? Here's a simplified (not tested) version of the code. <? $testconn=odbc_connect ("TESTLIB", "......", "......"); $query="SELECT Description FROM TestTable"; $rsWeb=mysql_query($query)); $WebRow=mysq

UTF-8 problems while reading CSV file with fgetcsv

I try to read a CSV and echo the content. But the content displays the characters wrong. Mäx Müstermänn -> Mäx Müstermänn Encoding of the CSV file is UTF-8 without BOM (checked with Notepad++). This is the content of the CSV file: "Mäx";"Müstermänn" My PHP script <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <?php $handle = fopen ("specialchars.csv","r"); echo '<table border="1"><tr><td>First name</td><td>Last name</td></tr><tr>'; while ($data = fgetcsv ($handle, 1000, ";")) { $num = count ($data); for ($c=0; $c < $num; $c++) {

Multiple Dropdown Boxes that will fill in a table

I'm going to have 3 drop down menus. that has garment. has the color. number of colors. When the person selects these it will generate a table that shows what the cost for the amount of pieces like 1 column 48pc then 72pc then 96pc and so on. I dont expect anyone to write the code but I was trying to figure out the best language to use. I was thinking javascript but i'm not sure where to start if anyone knows some tutorials or something to help. I would appreciate it.

Getting content of partial html in DomDocument

I have a string: $string = 'some text <img src="www">'; I want to get the image source and the text. Here is what I have: $doc= new DOMDocument(); $doc->loadHTML($string); $nodes=$doc->getElementsByTagName ('img'); From $nodes->item(0) I get the image source. How can I get the the "some text"?

nice ssh2 in php

I have a php script that transfers a bunch of files between servers with the pecl ssh2 extension ( ssh2_sftp_* for the most part). These files add up to about a gig or so each time. The bandwidth is throttled, so that's not a problem. The problem is the ssh2 process eats up a ton of CPU and actually slows down the server during the upload. Is there any way to start the ssh process at a certain nice level? If php's ssh2 functions create a new process (I'm not sure that they do), is it possible to find and renice this process once it's been started from within the php script? Since the ssh2 functions are not threaded, there probably isn't. Basically, I'd like PHP's ssh2 functions not to use so much CPU. It seems like proc_nice will do this, but it looks like I may have to use ionice instead. How can I do that?

How to disable output buffering in PHP

I wrote a simple relay script that connects to a web camera and reads from the socket, and outputs this data using the print function. The data is MJPG data with boundaries already setup. I just output the data that is read. The problem is PHP seems to be buffering this data. When I set the camera to 1 FPS, the feed will freeze for 7-8 seconds, then quickly display 8 frames. If I set the resolution to a huge size, the camera move at more or less 1 frame per second. I assume then some buffering is happening (since huge sizes fill the buffer quickly, and low sizes don't), and I can't figure out how to disable this buffering. Does anyone know how to? Code: ignore_user_abort(false); $boundary = "myboundary"; //Set this so PHP doesn't timeout during a long stream set_time_limit(0); $socketConn = @fsockopen ("192.168.1.6", 1989, $errno, $errstr, 2); if (!$socketConn) exit(); stream_set_timeout($socketConn, 10); fputs ($socketConn, "GET /mjpeg HTTP/1

How to add dynamic rows in html table in php from mysql

This is my first post and i am new in PHP, i am trying to build a POS system using PHP, but i stuck in sales module. Problem is when I scan barcode of an item, it display in textbox where i have set focus, and when i click add item button but when i repeat this step for another item(s), it remove first item and replace it with latest item, i have put my 100% but can't figure out why this is happening, thatswhy please help me in this regards as i know there are so many good developers in php in this forum. Here is my code for you: <script type="text/javascript"> function setFocus(){ document.getElementById("searchitem").focus(); } function change() { var searchitem = document.getElementById('searchitem'); if(searchitem.value == '') { searchitem.style.background = 'orange'; } else { searchitem.style.background = ''; } } </script> <?php $name = "Mehroz"; ?&

drop-down navigation menu with HTML PHP MySQL

EDIT FIXED by user @jeroen You have to move the li and a tags inside the while loop. Thank you for this, F4LLCON So the final code (not so clean, but works now): <?php $query = mysql_query("SELECT * FROM `apps` "); while ($query_row = mysql_fetch_assoc($query)) { ?> <li><a href=""> <?php echo $query_row['TITLE']; ?> </a> </li> <br /> <?php } ?> I want a drop-down menu that will show the TITLES out of my MySQL database. I know how to do everything concerning the ID etc. The only problem is that the PHP version of the drop-down menu will SELECT all the TITLES in my database and parse it as ONE link. So instead of Home >About >Contact >Another it will look like Home >About Contact Another With other words Home >About Contact Another It will not make multiple drop-down links but only one drop-down link If you for example do: <div> <?php echo $query_row['TITLE'

Trouble using PEAR"s Mail_Queue

I'm trying to implement PEAR's Mail_Queue package to queue some emails for a web application. I've used the documentation at http://pear.php.net/manual/en/package.mail.mail-queue.mail-queue.tutorial.php to write a small test script. My problem is that the database is not being updated, and it's not producing errors. EDIT // mail_queue db options $db_options['type'] = 'mdb2'; $db_options['dsn'] = DSN; $db_options['mail_table'] = 'mail_queue'; // mail_queue sending options $mail_options['driver'] = 'smtp'; $mail_options['host'] = 'smtp.gmail.com'; $mail_options['port'] = 25; $mail_options['localhost'] = $host; $mail_options['auth'] = true; $mail_options['user'] = MAILUSER; $mail_options['pass'] = MAILPASS; require "Queue.php"; $mail_queue =& new Mail_Queue($db_options,$mail_options); $from = 'someone@domain.ca'; $to = 'martin@sta