select

Select latest entry from MySQL database error

<?php mysql_connect("localhost", "user", "password") or die(mysql_error()); mysql_select_db("jmvarela_jacket") or die(mysql_error()); $query = 'SELECT * FROM `quote` ORDER BY `id` DESC LIMIT 1'; $row = mysql_fetch_array( $query ); echo $row['frase']; ?> I cant get this to work. I get this error: Warning: mysql_fetch_array(): s...

change select element?

I want to see if this is possible, i need to change a select element content to be displayed as divs using images just like a color picker. when the user selects clicks on a colored div i want an image to be displayed on the page. Also would i still be able to capture the selected item in a form hidden field? It's a shirt building page,...

prevent insert while select query, hibernate

Hi, new to hibernate. I have a problem that when i am trying to run select query say "from Foo where Foo.some_id=2" (with hibernate template) then hibernate is also tries to insert the records in a table 'Foo2' that has a one-2-one association with the Foo table Bean Foo class Foo{ int id; .... Foo2 foo2; } Foo.hbm.xml ... <one...

Remembering CodeIgniter form_dropdown fields

This works... form_dropdown('location', $location_options, $this->input->post('location')); But when I try and use an array to add extra attributes, it stops working... Why is this? $attributes = array( 'name' => 'location', 'id' => 'location' ); form_dropdown($attributes, $location_options, $this->input->post('location')); ...

how to highlight user selected text within a piece of text which has already been highlighted?

I have a page where I am displaying some text in a div and I need to highlight this text in certain parts. I have done this by surrounding the text I need to highlight with a tag and appropriate css styling. E.g. <div> My text will look like this with <span class="highlight">highlighted bits</span> in it. </div> This works fine. Howe...

JQuery clone <select> element

Hello, I want to clone a <select> input in HTML using JQuery. I'm not sure how to go about it, so thought I'd ask here. Particularly interested in the best way to write it back into the document as well. My select element looks like this: <select id="options"> <option value="1">Opt 1</option> <option value="2">Opt 2</option> ...

Is there a better way of this MySQL CASE SELECT ?

The last two parameters are PHP WHERE and ORDER clauses, they (probably) don't matter here. fornecedores.nome_emp AS nome_fornecedor, exchange_rates1.rate AS rateEUR_USD, exchange_rates2.rate AS rateEUR_AOA, CASE produtos.moeda WHEN 'AOA' THEN produtos.preco_custo / exchange_rates2.rate WHEN 'EUR' THEN produtos.preco_custo WHEN 'USD'...

Iterate over the options in a HTML select with jQuery

Hi, I got this example from a blog, but every time I do this: $(':input[name=' + inputName + ']').each(function(i, selected) { alert($(selected).text()); }); I got all an alert with all the options together :( I have to search by the input name always, the inputs have no id. Which is the right way to do it? Kind regards. ...

[PostgreSQL] How to select distinct from multiple columns

Hi I'm sure there's query for this kind of operation, but I just can't seem to get it. I have a table like this: product_id | saved_by | deleted_by | accepted_by | published_by -----------+----------+------------+-------------+------------- 1 | user1 | | user1 | -----------+----------+------------+---------...

Jquery: Get the width of the H2 that contains the most characters/is longest

I'm trying to select the H2 that contains the most characters, or is the widest in width, whichever one is simpler, or if you know how to do it could you put both? I'm not sure of the syntax. ...

Android Tab Layout tutorial?

I want to be able to assign different images to my tabs in the TabLayout control depending on whether the item is selected or not. I followed the tutorial on the Android site but they made the example with just one image and for it it works. But it doesn't work for the rest of the tabs. How can I make it work? This is my code: The main ...

How Do I programatically select text in a webBrowser Control? c#

Here's the Problem: I want to enable the user of my program to search a webBrowser control for a given keyword (standard Ctrl+ F). I am having no problem finding the keyword in the document and highlighting all the instances using a span and the replace() function. I am having trouble getting the "find next" functionlity that I want to w...

JQuery validation : How to check items in multiple select

I have a form using JQuery validation plugin. <label> <input name="Distribution[]" type="checkbox" id="dist_europe" class="required minlength:1" value="Europe" /> Europe </label> <select name="Europe[]" size="5" multiple id="Europe"> <option value='Albania'>Albania</option> <option value='Andorra'>Andorra</option> <optio...

What is the difference between using a cross join and putting a comma between the two tables?

What is the difference between select * from A, B and select * from A cross join B ? They seem to return the same results. Is the second version preferred over the first? Is the first version completely syntactically wrong? ...

Boolean Table in VB.Net - Select Case, If-Else, or Something else?

Hey all, I'm looking to simplify the handling of a three-item Boolean expression. "Select Case" doesn't seem offer a solution for triple values, and the If statement seems a bit much. It'll work the way I coded it, but if you have any ideas on how to simplify this, I'd appreciate your insights. If not, I hope this snippet can save someon...

Is there a way to have a SQL statement return a string value from a map that has an integer as the key?

For example: In the database we have number representations of fields that correspond to strings in the app. We store the data as an integer for size and speed reasons. During testing we compare what's in the app with SQL statement results. The problem is that we see the numbers in the results but there are strings in the app. There is ...

My .net Datatable returns incorrect results when I select by a float

I have a datatable where one column is a float (a system.single). I'm trying to select the rows where that column ("Radius") is less than or equal to 2.5, but getting silly results. (I get 22 rows returned out of 192, but the Radius column of all those rows are greater than 2.5. I tried all kinds of silly things like putting the value...

jquery select box will not move!

This plugin has been giving me hell! :/ I finally got it to work, but now when I try and position the select box it won't move! Well... I got the box to move but the dropdown menu stays there. It is really annoying! 1000 internetz to someone who can help me:/ elektrikhost.com is the site, look where the domain search is. When I place t...

MySQL Error? Where the syntax mistake?

Tried thus query with "SELECT *" instead of "DELETE FROM" and it worked perfectly. DELETE FROM `80dage_garmin_track` t1 WHERE EXISTS ( SELECT 1 FROM `80dage_garmin_track` t2 WHERE t1.Length = t2.Length AND t1.Time = t2.Time AND t1.idgarmin_track > t2.idgarmin_track ) MySQL Error: .#1064 - You have an error in your SQL syntax; chec...

AddRange/concat functionality inside a lambda Select expression

class Foo { int PrimaryItem; bool HasOtherItems; IEnumerable<int> OtherItems; } List<Foo> fooList; How do I get a list of all item ids referenced inside fooList? var items = fooList .Select( /* f => f.PrimaryItem; if (f.HasOtherItems) AddRange(...