QMultiple action in one php functionPHP

Need to update cc_cart table if sessionid and productid already exists else insert to cc_cart table. Is it possible in function addtoCart (mentioned below). public function addtoCart($sessionId,$productId,$quantity,$price) { $sql=”INSERT INTO cc_cart (SessionId, ProductId, Quantity, Price, CreatedOn) VALUES (‘{$sessionId}’,'{$productId}’,'{$quantity}’,'{$price}’, NOW());”; $this->db->query($sql); return mysql_insert_id(); }

QCheck if data entered by user in html form already exists in database in phpPHP

After entering data in html form while clicking on button to add the data in the database, I want to check whether the user already exists in the database. I am using php v5.3.5 and mysql v5.5.8. Data is stored in 2 tables simultaneously named person and other and there is no primary key(in both [...]

QWordPress keeps giving me following error : Warning: preg_match()PHP

There is already one question almost related to my question but that answer did not help me as that answer includes lots of command line code. I am not so good into that. I also asked godaddy if it was related to the PHP or Mysql version, but they could not help me. I have [...]

QEnter Checkbox values using JQuery codeHTML

I use this JQUERY code to ender data to a HTML table.First time show checkbox values .Next time not showing the valuees that get first time.This is the JQUERY code. $(document).ready(function(){ $(‘#details’).on(‘click’, ‘.remove’, function() { $(this).closest(‘tr’).remove(); }) $(‘#submit’).on(‘click’,function(){ var st = ”; $(‘#trtform input[type=text],select,input[type=checkbox]:checked’).each(function(){ st = st+ ‘<td width=”150″ align=”center”>’+$(this).val()+’</td>’; $(this).val(”); }); var remove = [...]

QCakephp: how to access data from database with 3 model and 1 controllerPHP

I’m trying to access the data from my db as my title describes my structure I have 3 model and 1 controller, my problem is I’m not sure in which function i should put the ff: FruitsController: $this->set(‘apples’, $this->Apple->find(‘all’)); $this->set(‘oranges’, $this->Orange->find(‘all’)); $this->set(‘bananas’, $this->Banana->find(‘all’)); so that I can access them in the view/see their data(what’s inside [...]

QHow to disable PrettyPhoto media plugin on small screenPHP

i want to know how to disable the PrettyPhoto on small screen layouts, I am doing a project and client have that requirement, he does not want to display pop up gallery for small screen so kindly help me.

QHTML table exceeds browser's widthHTML

I’ve created a table containing 180 columns of number of days in 6 months and I want the table to be fitted in the browser’s width. I’ve tried CSS max-width=”100%” and style=”width: 100%;”, but none of them works. Are there any other ways I should try? Thanks in advance.

QUnfortunately app has stopped working but runs after few secondsAndroid Solutions

I am developing an application for different medical tests. However when I start running the app on the emulator it shows “Unfortunately the app has stopped working-> OK” But after a few seconds it runs . Whenever I go to the main screen it shows the above message. However after I press ok the app [...]

QHow to use both jQuery styles and css style sheet?HTML

Is it possible to use both jQuery styles and CSS style sheet? Currently I have this: <link rel=”stylesheet” href=”http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css”> I also need to use my cssstylesheet.css as well for custom styling as per the business. How can I achieve this? Does it make sense to add two <link rel> tags? One for jQuery styles and [...]

QHow do I get the image that I took and submit it to my serverAndroid Solutions

Currently I am able to upload an existed image in the sdcard to my server. I’m a total newbie in Android programming world and I was wondering how do I dynamically grab the newly taken image and submit it to the server? This is what I have so far for my onClick event public void [...]

Qhow to set a session variable persisted that can also be used after requesting other pages in laravel 4PHP

I set a session variable when requesting the login page by with->(‘data’, $data); and use Session::reflash(); in login view to extend the life of this session variable to next request. In the login page I have a link to another page which only admin user can see it, so I write a filter for that [...]

QHow to insert upload table primary key(ID) to info table (ID) at the same time?PHP

Info table query: CREATE TABLE `info` ( `id_info` int(10) NOT NULL auto_increment, `judul_info` varchar(50) collate latin1_general_ci NOT NULL, `konten` varchar(255) collate latin1_general_ci NOT NULL, `diubah_oleh` varchar(20) collate latin1_general_ci NOT NULL, `id_kategori` int(10) NOT NULL, `tgl_buat` timestamp NOT NULL default ’0000-00-00 00:00:00′, `tgl_ubah` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `dibuat_oleh` varchar(20) collate latin1_general_ci NOT [...]

QHow do i calculate the sum of all inputs with the same ID in JQueryHTML

They are dynamically created inputs using “append” method and have an id=”subtotal1″, id=”subtotal2″ and so on. How do i calculate the sum of all the inputs and display it within a div in JQuery?

QWorking with simpleDateFormat in other country in AndroidAndroid Solutions

I was working with SimpleDateFormat in android to parse Date ,below is my code. the problem that i’m facing is that my code was working properly from last 3 month when the user was of India but now a guy from Poland has started using this and he is getting null pointer exception on last [...]

QCan I draw a simple paint pie chart like this?Android Solutions

I’m not looking for anything fancy. I have tried to follow tutorials about pie and bar graphs, but a lot of the tutorials don’t follow the guidelines of my app. In my app, in one of my fragment layouts, I would like to simply draw a pie chart of two values. as simple as – [...]

QHow can I create a layout like this where both sides are always the same height?HTML

How can I create a layout like the following using HTML and CSS? I’d prefer not to use a table because the info that will go in each of the three cells is not tabular at all. Also, the design needs to be flexible in that if the content on one side is vertically longer [...]

Qcss formatting does not return to previous formatting after an <a href…>text</a> tag pairHTML

I have a page which is not formatting properly, or at least not formatting as I expect it to. Below is a simplified version of the code. <div …> <div class=”db_notes”> <pre> Some Text. <span class=”blue”>Lots more text that may be one line or multiple lines and is retrieved from a database in preformatted form [...]

QHow to access PHP variable from other file?PHP

So I want to access a variable ($username) from file quickprotect.login.php and print it in file index.php. File login.ini.php contains username configuration and quickprotect.login.php contains: <?php $root = dirname(__FILE__); class quickprotect { private $ini_file_location = “login.ini.php”; private static $tries; public static $errormsg; public $settings; public function __construct() { session_start(); $this->ini_file_location = $GLOBALS[root] . “/” . [...]

QSherlock Action bar color changeAndroid Solutions

Just want to change Action bar color right now I am using Theme.Sherlock.Light.Dark_Action Bar need to change color should support api 10 and above

QHTML/CSS on making a website menuHTML

First attempt on doing a website after a online course on HTML and CSS. I’m struggling with the horizontal menu. I have three elements in the “header”: img1; img2; ul/li elements I want to make them stick together so i have a logo on the left, a triangule in the middle and the menu on [...]

QHow do I password protect WordPress user posts?PHP

I’m developing a site that allows signed-in users to create blogs posts. There needs to be an option to make it either public or password protected. It’s being designed to allow users to stay on the front end of the site, which is absolutely necessary. I’m currently using DJD Site Post, which gives other options [...]

QHow to detect the url of an image in a div and append it to another div HTMLHTML

I was wondering how to use jQuery to find the url of a divs background-image and append it to another div. How can I do this?

QTo get a field from sqlite database using its corresponding column fieldAndroid Solutions

I have created a database in sqlite for android with variables like Acc No, name, date etc etc. i have many edit text in my activity. when the acc no is entered in Acc No edit text, the corresponding name should appear in below Name edit text. how to do that. my DB code is [...]

QPhp retrieving number from databasePHP

i’m a newbie to php still. I’m using phpmyadmin as my database. I have a table called ‘lessonno’ and a name called ‘lesson’ in it. I tried using this code to retrieve out the number inside ‘lesson’. But it’s not printing out anything. Can someone help? <?php $server = ‘localhost’; $username = ”; $password = [...]

QUL LI is not aligned to leftHTML

I am learning html/css and have the following issue when aligning the “navigation menu” to the left. There’s a small gap (see the pic below with a question mark) can someone tell me how to remove the gap on the left side? Here is my html/css code <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> [...]

QUsing HTML page as a GUI for executing shell scriptsHTML

I have come here many times for answers but this is the first time I am asking a question. I hope you can help and I greatly appreciate your efforts! I am using OSX mavericks and firefox version 31. I am trying to make a HTML GUI, run in firefox, for existing code. Basically what [...]

Qarray_map 2d array to 1d associative arrayPHP

I have a 2d Array (returned from PDO MySQL DB) that is of the form { [0] => { “ID” => 1, “Name” => “Name1″ }, [1] => { “ID” => 2, “Name” => “Name2″ }, [2] => { “ID” => 3, “Name” => “Name3″ } } Is there an elegant/efficient solution to transform it [...]

Qchange div with with php or jqueryHTML

I want to change div with either php or jquery the important is to change div width. scenario: I have div what i want if i click <a> tag click me to inlarge the div div must increase the width and when click the click me to default width div go back to the default [...]

QCalling an Array As a ValuePHP

I do not know if this is possible, but what I am trying to do is create a value for a key within an object that is an array, and then loop through that array in a for loop. My object is coded like this: <?php $shoots[01] = array( “name” => “Rustic Farm Shoot”, “id” [...]

QUnable to add grid lines to bar chartJavascript Questions

I am new to D3 and I have constructed this bar chart. I would like to add grid lines parallel to x-axis only. I saw this tutorial and added the code at line # 76. function make_x_axis() { return d3.svg.axis() .scale(x) .orient(“bottom”) .ticks(5) } svg.append(“g”) .attr(“class”, “grid”) .attr(“transform”, “translate(0,” + height + “)”) .call(make_x_axis() .tickSize(-height, [...]