I have a map from strings to integers. To store this map in a MySQL database I created the following table:
CREATE TABLE map(
Argument TEXT NOT NULL,
Image INTEGER NOT NULL
)
I chose the TEXT type for the argument because its length is unpredictable, currently the longest record has 2290 chars and the average length is 88 chars.
...
Basically I want to setup a tagging system like stack overflow has for entries and trying to plan out how a relevance based search would work. I want to have an option to pull up similar tagged entries for a related entries section. Right now I am using two tables for tags, a table for each unique tag and a join table. I am trying to thi...
After using form data to perform a MySQL update (via PHP), I'd like to direct the user to a page that displays that data as it will appear on the site.
How can I automatically redirect the user to a page (preview.php, for example) AFTER running the MySQL update?
I'd like to keep the solution to HTML or PHP if possible.
...
This is a follow up to this question I asked earlier:
http://stackoverflow.com/questions/2267034/why-cant-i-insert-into-mysql/2267076#2267076
That question solved it partly. Now I'm doing it in Python and it's not working :(
cursor.execute("INSERT INTO life(user_id, utm) values(%s,PointFromWKB(point(%s,%s)))",the_user_id, utm_easting,...
Here is a snapshot of my code:
$fetchPictures = $PDO->prepare("SELECT * FROM pictures WHERE album = :albumId ORDER BY id ASC LIMIT :skip, :max");
$fetchPictures->bindValue(':albumId', $_GET['albumid'], PDO::PARAM_INT);
if(isset($_GET['skip'])){
$fetchPictures->bindValue(':skip', trim($_GET['skip']), PDO::PARAM_INT);
}
else{
...
A user on SO recently gave me this Query to put into MYSQL, but I don't know what to do with the @ sign.
SELECT user_id, GLength(LineString(utm, @mypoint))
FROM users
WHERE MBRWithin(utm, LineString(Point(X(@mypoint) - 20, Y(@mypoint - 20)), Point(X(@mypoint) + 20, Y(@mypoint + 20))
AND GLength(LineString(utm, @mypoint)) <...
I have four tables.
posts
| id | title |
+---------+-----------+
| 1 | hello |
| 2 | goodbye |
+---------+-----------+
posts_tags
| tag_id | post_id |
+---------+-----------+
| 1 | 1 |
| 2 | 1 |
| 2 | 2 |
+---------+-----------+
comments
| id | post_id | c...
Suppose I have a 2 column table like this:
| user_id | int(11) | NO | UNI | NULL | |
| utm | point | NO | MUL | NULL | |
As you can see, it's very simple. utm is a Point data-type. I insert it like this:
INSERT INTO mytable(user_id, utm) VALUES(1, PointFromWKB(point(50, 50)));
...
if you got 100 000 users, is mysql executing one sql query at the time?
cause in my php code i check if a certain row exists. if it doesn't it creates one. if it does, it just update the row counter.
it crossed my mind that perhaps 100 users are checking if the row exists at the same time, and when it doesn't they all create one row ea...
PHP learner. The pagination script below seems to generally work, but the problem is that on each page of 20 records, when I select some rows (via checkboxes) and click the SUBMIT button, the display of 20 records jumps back to page 1. The rows are selected without a problem, but I can't grasp why it returns to page 1.
Is the problem ...
I've been learning PHP and MySQL and have been thinking about exercises to help me learn the language better. I've used ffmpeg for a few years now to process video files and thought I could probably work out a way to manage this from the web. I've read up on using ffmpeg from php but I'm wondering how to manage the files on the backend. ...
i have following code:
SELECT *
FROM table
WHERE thread = $thread
AND (user != $user1 OR user != $user2)
i want the code to pick all rows that contains $thread BUT the user isn't $user1 or $user2.
is my code correct? or should it be like:
SELECT *
FROM table
WHERE thread = $thread
(AND user != $user1 OR user != $user2)
thanks in a...
i need help with one more sql query.
if i've got 2 columns in a table:
tag1 tag2
and want to select rows that got either $tag1 OR $tag2 but never $tag1 AND $tag2, how could i write the sql query?
i've tried with:
SELECT id
FROM tagPairs
WHERE (tag1 IN ($tag1, $tag2))
OR (tag2 IN ($tag1, $tag2))
AND ((tag1 != $ta...
Hi all
I've two tables one about Customers and the second one is about their Accounts as 'Customer_Account_Information'. we know that one customer can have only one account, so I'm trying to enforce one to one relationship, but i don't know the procedure/syntax in mySql or mySqlyog.
is there any one who can help me?
...
Let's say I have tree tables:
[ news ]
id
title
text
date
[ posts ]
id
title
text
date
[ gallery ]
id
title
text
date
How can I perform a FULLTEXT search in these tree tables with one query?
I just want to run the search on the title and text fields and get the id, title, date and the...
I have a table
CREATE TABLE `sob_tags_articles` (
`tag_id` int(11) NOT NULL,
`article_id` int(11) NOT NULL,
`id` int(11) NOT NULL auto_increment,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=112
And triing to save an object with Doctrine:
$sbTagsArticles = new SobTagsArticles();
$sbTagsArticles->article_id = $pubId;
$sb...
$sql =
'INSERT INTO customer
(first_name,
last_name,
email,
password,
date_created,
dob,
gender,
customer_type)
VALUES(:first_name,
:last_name,
:email,
:password,
:date_created,
:dob,
:gender,
:customer_type)' . ' SELECT LAST_INSERT_ID()' ;
Can anyone tell me if the syntax is right? I am having problems usin...
I have a database which holds URL's in a table (along with other many details about the URL). I have another table which stores strings that I'm going to use to perform searches on each and every link. My database will be big, I'm expecting at least 5 million entries in the links table.
The application which communicates with the user ...
Can I prevent using filesort in mysql when field on which condition in one table and field on which order in another. Can use index in this situation? Both tables are large - more than 1 million records
...
I'm refactoring a horribly interwoven db schema, it's not that it's overly normalised; just grown ugly over time and not terribly well laid out.
There are several tables (forum boards, forum posts, idea posts, blog entries) that share virtually identical data structures and composition, but are seperated simply because they represent di...