Hi People, I'm trying to update my database records with the following code but am having no luck what so ever. Anybody care to help? Thanks
<?php include "base.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
...
like the next 15 values in the ITEMS table sorted by date added? enter code here
...
I'm working with a database set up like this:
entity field value
1 start_date June 1, 2010
1 end_date August 30, 2010
1 artist some name
And I want to query all the entities with artist name "some name" that have started but not ended.
I came up with something like this:
SELECT start.entity
F...
I am trying to get the all records which are 2 hours or more old using this query
$minutes = 60 * 2
SELECT COUNT(id) AS TOTAL, job_id
from tlb_stats
WHERE log_time >= DATE_SUB(CURRENT_DATE, INTERVAL $minutes MINUTE)
GROUP BY job_id
It only selects the recent records and skips the old. When I change log_time <= it only selects o...
Hi,
Why am I getting this error:
1054 - Unknown column 't.type' in 'field list'
I have a column called type in my table. And I've got the table 'tester' using an alias t.
SELECT y.*,
(SELECT COUNT(*)
FROM (SELECT *,
CASE t.type
WHEN 'Advanced' THEN t.t...
Is there a way to find the radial distance using the zipcode?
My task is to search the all the users residing with in a specified distance. I know the zipcodes of the users.
Eg, users between 25 miles from the current location.
I have other search categories, for which i am using mysql queries. I am unable to figure anything out fo...
I have set up Solr and am trying to index a simple 2 column, 2 row table (MySQL 'test_tb' tabe within database 'test_db') with (first column) unique id (in the mysql of type int) and (second column) some text. I keep getting the error:
WARNING: Error creating document : SolrInputDocument[{ID_F=ID_F(1.0)={1}}]
org.apache.solr.common.Solr...
I am new to using procedures and cannot seem to get mine working. I am using MySQL v5.1.36 and inputing my code using MySQL Console on a WAMPP server. If I go to (re)create the procedure. I get error #1304 (42000).
mysql> DELIMITER //
mysql>
mysql> CREATE PROCEDURE modx.getCRID (IN x VARCHAR(255),OUT y INT)
-> BEGIN
-> ...
Hi,
I have 35 functions that update 1 to 3 tables, in a transaction. However, they don't just execute updates, but they do queries as well.
Table 1 does row update only actions, and some queries.
Table 2 does queries and row level updates to existing rows, and sometimes deletes and adds rows. Table 2 may have queries within the trans...
Hi,
I've got a mySQL statement that selects some data and also ranks.
I want to have the record for 'Bob', for example, selected but NOT included in the ranking. So, I need Bob's row returned in the main select statement, but I need Bob excluded from the sub-SELECT which handles the ranking. I needs Bob's data but, he should not be co...
Hi there,
ALTER TABLE `tada_prod`.`action_6_weekly` ADD COLUMN `id` INT NULL AUTO_INCREMENT UNIQUE AFTER `member_id`;
works,
so i thought, to add the column as the first column i could do
ALTER TABLE `tada_prod`.`action_6_weekly` ADD COLUMN `id` INT NULL AUTO_INCREMENT UNIQUE BEFORE `code`;
but i get a syntax error,
what ...
Hi, I have 2 columns in an "entries" table: a non-unique id, and a date stamp (YYYY-MM-DD). I want to select "all of the entry id's that were inserted today that have never been entered before."
I've been trying to use a subquery, but I don't think I'm using it right since they're both performed on the same table. Could someone help me ...
Hi there,
I can use
select * from sent_txts s
LEFT JOIN received_txts r ON s.msg_link_id = r.id
WHERE r.action_id = 6;
top select matching rows,
how can i write a query to delete the matching rows on both sides?
something like
delete sent_txts s
LEFT JOIN received_txts r ON s.msg_link_id = r.id
WHERE r.action_id = 6;
cheers....
I have a csv file that has 3.5 million codes in it.
I should point out that this is only EVER going to be this once.
The csv looks like
age9tlg,
rigfh34,
...
Here is my code:
ini_set('max_execution_time', 600);
ini_set("memory_limit", "512M");
$file_handle = fopen("Weekly.csv", "r");
while (!feof($file_handle)) {
$line_of_te...
To do text search for wordA, wordB and wordC right now I'm doing it this way:
SELECT * FROM
mytable
WHERE
MATCH (field1) AGAINTS ('wordA' IN BOOLEAN MODE) OR
MATCH (field1) AGAINTS ('wordB' IN BOOLEAN MODE) OR
MATCH (field1) AGAINTS ('wordC' IN BOOLEAN MODE)
Is there a more compact way of writing this?
...
If(variable1='table name1')
BEGIN TRY
...........
...........
.....
END TRY
BEGIN CATCH
RAISERROR ('FAILED TO GET DATA FROM hh_usr_card_dtls',16,-1)
RETURN -1
END CATCH
The above code is in SQL (MS SQL),
I want implement same thing in MySQL. Can you please help me?
...
Im writing a login script. My db.php doesnt echo/print anything so why doesnt header("Location: index.php"); redirect upon successful login? the login info is correct. I know i need to sanitize the input but that is not a problem at the moment.
<?php
require('db.php');
$username = $_POST['un'];
$password = $_POS...
Hi, im developing a job board site, where i have the following tables:
Cv (Curriculum)
Jobs
Users
I want to produce the follow information:
How many users visit this Job
How many users visit my CV
How many cv i visited
How many jobs i visited
My obviously thinking is to created a table for example: log_jobs (id, job_id,user_id) ...
Shall i use MYSQL replication to synchronize local database and remote database.
if so, how to setup master/slave ? or any other methods available to do this
...
Taken from one of my previous questions.
Table is telling on which item (post , photo or reply) the comment is taking place on.
commentid ---- postid ----- photoid-----replyid
-----------------------------------------------
1 22 NULL NULL
2 NULL 56 NULL
3 23...