I am trying to write a query that will check if a specific table in MySQL has a specific column, and if not — create it. Otherwise do nothing. This is really an easy procedure in any enterprise-class database, yet MySQL seems to be an exception.
I thought somethig like
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHE...
Hi,
I am currently working on a php/flash/mysql based high score system for a games website. The main obejctive of this system is to submit the scores in the database using flash game. Whenever the user makes the score it will be reflected in the database. While in testing evironment when i submit the scores from flash file the scores a...
How can I get all students names that were taught by the teacher with name John?
student
id
name
student_has_teacher
teacher_id
student_id
teacher
id
name
...
#include <my_global.h>
#include <mysql.h>
int main(int argc, char **argv)
{
printf("MySQL client version: %s\n", mysql_get_client_info());
}
~$ gcc -o mysql-test MySQL-Test.c
im trying to execute this test program from terminal but get the following error message:
/tmp/cceEmI0I.o: In function main': MySQL-Test.c:(.text+0xa): ...
We're currently questioning our company's data model (database schemes), which has grown wildly and distributedly over the years and now suffers from redundancy and lacks clarity. Different databanks (Oracle and MySQL) are queried by different tools, developed by separate teams for different purposes (billing, reporting, business, etc).
...
Possible Duplicate:
Best redirect methods?
Hello
I am working with some legacy code that includes a module for user registration / login. There is a block that queries the DB to see if the user is logged in, then re-directs to the login page.
The re-direct is handled by <meta http-equiv='refresh' content='=2;index.php' /> ...
Hi,
I am having issue with mysql and tomcat 4.0. If i start tomcat server,change the system date and try to access my webapplication, getting this error.Similarly,if i start server today and perform operations on my webapplication,then next day i try to access the application getting same error.
At the same time if i refresh the page,t...
I would like to perform a dictionary attack, or, if it is easier an attack directly in the database with my hashed passwords in order to find out what users of my site are using simple passwords.
I will be implementing some complexity rules when creating passwords but I would love to be able to contact the users who have simple dictiona...
can anyone please guide me on How to insert a DATETIME filed from iphone through PHP script into MySQL database.
$dates = date('Y-m-d H:i:s','2010-10-12 15:09:00');
$query = "INSERT INTO timeTable(time) VALUES ('$dates')";
Thank you..
...
I have a dataset of rows each with an 'odds' number between 1 and 100. I am looking to do it in the most efficient way possible. The odds do not necessarily add up to 100.
I have had a few ideas.
a)
select the whole dataset and then add all the odds up and generate a random number between 1 and that number. Then loop through the datase...
I want syntax for try catch in MySql stroed procedure
...
I'm using R to read in some data from a MySQL database using the RODBC package. The data is then processed and some results are sent back to the database. The problem is that the server closes the connection after about a minute due to inactivity, which is the time needed to process the data locally. Its a shared server, so the host wo...
One of the things that always worries me in MySQL is that my string fields will not be large enough for the data that need to be stored. The PHP project I'm currently working on will need to store strings, the lengths of which may vary wildly.
Not being familiar with how MySQL stores string data, I'm wondering if it would be overkill to...
The following query is not working the way I expect:
SELECT DISTINCT *
FROM mytable
WHERE MATCH (StrNum, StrName, StrType, TownName, Zip) AGAINST ('elm')
AND Color = 'RED' OR Color = 'WHITE' OR Color = 'BLUE'
This is returning more results than I expect - it's not limiting my results to those on 'elm'.
If I remove the last line (A...
In my application users can be one of three types: teens, individuals, or members of an organization. In my users table, I have a boolean field teen (not null) and a foreign key organization_id (null).
If teen is true and organization_id is null, the user is a teen. Teens can't belong to an organization.
If teen is false and organizat...
I have a site where a user can have multiple permissions (view, edit, delete, create). Each of these is stored as a tinyint(1) field in the database.
I'm looking for the best (quickest?) way to query MySQL to see if the user has the ability to see this page. Here is a snippet:
$user = mysql_real_escape_string($user);
$resultset = mysql...
I am extracting text from a MySQL database table, collation is set to utf8_general_ci. In PHPMyAdmin, I can see the characters correctly:
"La consiglio fermamente anche perchè ho già acquistato iWrap per il mio:"
But when I extract it myself it prints out this way:
"La consiglio fermamente anche perch� ho gi� acquistato iWrap per il ...
My question is very similar to this question but a bit more specific.
My application has multiple companies and multiple users per company. It makes the most sense to me (at this point) for each company to have a "private" set of tables. This makes security extremely simple as I don't have to worry about JOIN-ing up my structure tree to...
Title says it all :)
Thanks ;)
...
I have a query i've written for a private message system but i would like to add an extar field in the query but not sure how to do it.
At the moment it gets the username of the sender but not the recipient but it does however get both ids of sender/recipient.
How do i add an extra field in my query to get the username of the recpient?...