The primary key.
cursor.execute("INSERT INTO mytable(height) VALUES(%s)",(height))
My table has 2 columns:
id << primary, auto increment
height << this is the other column.
How do I get the "id", after I just inserted this?
...
When I export a database on my development PC, for import on my webhost, it contains the following line:
--
-- Table structure for table `vi_sr_videntity_0`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `starrise`.`vi_sr_videntity_0` AS select `starrise`.`t_sr_u_identityfingerprint`.`c_r_Identity` A...
Hey guys I have an admin page that checks if you are admin before submitting any queries, and contains a header to the index page if you are not admin, but I am worried about protecting the page. I am concerned someone may be able to destroy my database with it. Does anyone have any recommendation into protecting a page like this, if not...
I have a table that describes a variety of objects in my system (ie. umbrella, boots, satchel, whatever). Each one of these objects needs to have a distinct prevalence or incidence. For example, the umbrella is rarer than the boots. Based on those factors, I need to randomly select a single object (including a blank or 'no object found')...
Attempting to pull my database from Heroku gives an error partway through the process (below).
Using: Snow Leopard; heroku-1.8.2; taps-0.2.26; rails-2.3.5; mysql-5.1.42. Database is smallish, as you can see from the error message.
Heroku tech support says it's a problem on my system, but offers nothing in the way of how to solve it.
I...
I am doing geolocation, and Django does not have a PointField. So, I am forced to writing in RAW SQL. GeoDjango, the Django library, does not support the following query for MYSQL databases (can someone verify that for me?)
cursor.execute("SELECT id FROM l_tag WHERE\
(GLength(LineStringFromWKB(LineString(asbinary(utm),a...
Is there ever a circumstance where the .MYI files should be bigger than my .MYD file?
I've got some pretty huge .MYI files and joins are running slowly. I'm pretty new to MySQL.
Database engine is MyISAM.
...
Hi. I am using in C# MYsql .I have query that works if I run on MySql Workbench ,but in C# it does not return any value also does not give ant error too.There is only one different using on Mysql I use before table name databaseName.tableName , but in C# I think it doesn`t necessary.
This is part of query which does not return anything....
I've just developed a large database, and am trying to put it online. I want to make sure that all the foreign keys, defaults, constraints, views etc, are preserved. When I try to export from my development PC using phpMyAdmin and then import on my hosted server, it errors out on all the views. Is there any other way to clone a databa...
Hey.
I need some help to insert comma separates strings into multiple columns into db.
My $_POST['search'] value output. [search] => schools,books,mobile
How do i make an foreach or for to insert those data into db? :S
...
Hi guys, I'm having trouble with this PHP function. It keeps returning zero, but I know the SQL statement works because I've queried it myself. Any ideas what I'm doing wrong? The last line makes no sense to me...I'm editing this code that someone else wrote. This function should return a number in the hundreds, assuming the date is ...
I have a query that is returning in vastly different amounts of time between 2 datasets. For one set (database A) it returns in a few seconds, for the other (database B)....well I haven't waited long enough yet, but over 10 minutes. I have dumped both of these databases to my local machine where I can reproduce the issue running MySQL 5....
OK, so I have two tables I'm working with - project and service, simplified thus:
project
-------
id PK
name str
service
-------
project_id FK for project
time_start int (timestamp)
time_stop int (timestamp)
One-to-Many relationship.
Now, I want to return (preferably with one query) a list of an arbitrary number of projects, sorted ...
I have a survey application, where users can create surveys and give choices for every survey. Other users can choose their answers for the aurvey and then polls are taken to get the results of the survey.
I already have the database schema for this
Questions
id, user_id, category_id, question_text, date_started
Answers
id, user_id, q...
Hi,
I need to insert data from table1 into table2. However, I would like to set the myYear column in table2 to 2010. But, there isn't a myYear Column in table1.
So, my basic insert looks like:
INSERT INTO `table2` ( place, event )
SELECT place, event
FROM table1
Roughly, I'd like to do something like the following:
INSERT INTO `t...
Django currently does not support the "Point" datatype in MySQL. That's why I created my own.
class PointField(models.Field):
def db_type(self):
return 'Point'
class Tag(models.Model):
user = models.ForeignKey(User)
utm = PointField()
As you can see, this works, and syncdb creates the model fine.
However, my curr...
I'm creating a web app (locally, so security doesn't matter) in PHP where the user uploads a set of information and a small .jpeg, which is then inserted into a mySQL table. I can do this no problem with all the text data, but I'm not sure how to cause the image to upload alongside it. I assume I will have to use the blob data type and...
I'm trying to find rows which are within __meters from the given point.
THis can be done via distance or overlap.
WHat is faster?
...
I've got an IIS site running with a MySQL db. Is there a way to get logparser to export into a MySQL database?
...
Hi all,
I keep receiving an error with the following code. I am trying to make a function that will format a field (content=0.0032) into a varchar/percent (content=0.32%). At the moment i'm just trying to get format to work, and it throws up an error
"Error Code : 1064
You have an error in your SQL syntax; check the manual that corres...