I have a table in mysql with a row called 'newrelease'. If the item is a new release my form posts it as 'yes' if no 'no'.
How would i display all items that contain the data 'yes'?
$query = "SELECT * FROM movielist ORDER BY newrelease DESC LIMIT 4";
...
I want to delete a row in my database and found an example on how to do this with jQuery's $.post()
Now I am wondering about security though..
Can someone send a POST request to my delete-row.php script from another website?
JS
function deleterow(id) {
// alert(typeof(id)); // number
if (confirm('Are you sure want to delete?'))...
I'm getting the following error when I try to run a simple Java JDBC program at the command line:
Exception in thread "main" java.lang.NoClassDefFoundError: LoadDriver/java
Caused by: java.lang.ClassNotFoundException: LoadDriver.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged...
I have a mysql query:
$query = "SELECT * FROM movielist WHERE genre = 'comedy' ORDER BY dateadded DESC";
I need to change it so that it selects from movielist where genre contains 'comedy'.
(Note: that my genre field will often contain more than one genre example "comedy, action, drama".
...
I am using -- http://sphinxsearch.com/ . Its working fine for me except one problem. I need to exclude some entries where a specific field doesn't contain a word.
Something that would look like this in mysql:
Select * from table where yescolumn = 'query' and othercolumn not like '%keyword%'
Please help. Thanks.
...
My MySQL database has date of birth stored in the format yyyy-mm-dd, how do I query the database - without using php code - to show me results of people born within x years of now, and/or, who are y years of age?
The table is called users, the colum is called dob. I've spent a while viewing the MySQL manual but I can't work out precisel...
I have a 'Title' column with abbreviations (Ceo, Cio,..) which I have to capitalize. What is the most efficient way of finding 3 lettered words and capitalizing them?
Sample data :
Title
-----------------------
Vp - business, Cio, Ceo
E Vp, Cfo
Ceo
Cio
Vp
Thank you so much!
...
I was just reading an update from a friend's project, mentioning the use of memtables to store data temporatily and then flush to a table on disk. Up to now, I have never faced a situation where I would use a memtable, or a situation where I would think the use of a mem table would be beneficial; so I wonder, when would someone use mem t...
Say I have "user". It's the key. And I need to keep "user count".
I am planning to have record with key "user" and value "0" to "9999+ ;-)" (as many as I'll have).
What problems I will drive in if I use Cassandra, HBase or MySQL for that?
Say, I have thousand of new updates to this "user" key, where I need to increment the value.
Am I i...
I have mysql table that has a column that stores xml as a string. I need to find all tuples where the xml column contains a given string of 6 characters. Nothing else matters--all I need to know is if this 6 character string is there or not.
So it probably doesn't matter that the text is formatted as xml.
Question: how can I search wi...
What's going on here? BTW, MySQL Server version: 5.0.45-log Source distribution.
mysql> select count(*)
from notes
where date(updated_at) > date('2010-03-25');
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.59 sec)
mysql> select count(*)
from notes
where message like'...
I will try to be as clear as possible because I can't get anybody to help me around,
I am trying to associate some data from a 'videos' table with their respective ID.
Lets say, I have column ID, title, serie, season, episode.
I am getting my data :
<?
$result = mysql_query("SELECT * FROM videos WHERE serie = '".$row['serie']."' ...
I have two tables.
table_x:
id INT(11)
tag INT(11)
table_tags:
id INT(11)
name VARCHAR(255)
Then I use PHP to perform the following query:
SELECT * FROM table_x LEFT JOIN table_tags ON table_x.tag = table_tags.id
The only problem is: how do I access table_x.id and table_tags.id in the results?
Here is the PHP code:
$...
We are creating a rails application for an already existing database. We need to map some database tables together.
Suppose we have three tables: event, event_groups and event_to_groups.
There are some events, there are some groups, and each event can be assigned to one or more groups.
How do I model this relation in rails?
eg:
Ex...
I was tasked with writing a smallish program for data input and manipulation. My language of choice happens to be PHP. I have written out the program/site it all works fine is easily portable and everything but have one question. Is there anyway to wrap up apache/mysql/php into a bundle of one exe? I know of MoWes Portable and other opti...
Hi i've wrote a query that works:
SELECT `comments`.* FROM `comments`
RIGHT JOIN (SELECT MAX( id ) AS id, core_id, topic_id
FROM comments GROUP BY core_id, topic_id order by id desc) comm
ON comm.id = comments.id LIMIT 10
I want know if it is possible (and how) to rewrite it to get better performance.
Thanks
...
I am building a navigation menu which lists all my categories and subcategories. The problem is it returns only one of these and not all. I have the categories echoed inside the while loop so I'm not sure why it's only showing one result and not all:
<?php
$query = mysql_query("SELECT * FROM categories_parent");
while ($row = mysql_fe...
hi,
I have a table of about 800 000 records. Its basically a log which I query often.
I gave condition to query only queries that were entered last month in attempt to reduce the load on a database.
My thinking is
a) if the database goes only through the first month and then returns entries, its good.
b) if the database goes through ...
I was contracted to build an on-line knowledge base that searches and cross-references many thousands of replacement parts for a niche industry. My client furnishes this app to his customers on a subscription basis.
It uses MySQL and PHP and it works great. I want to deploy it in "demo mode" to sell my skills. I want the user to se...
I'd like to use placeholders as seen in this example:
cursor.execute ("""
UPDATE animal SET name = %s
WHERE name = %s
""", ("snake", "turtle"))
Except I'd like to have the query be its own variable as I need to insert a query into multiple databases, as in:
query = """UPDATE animal SET name = %s
WHERE name = %s...