mysql

how to create table which has a column from another table in mySQL

i want to create a table : products which looks like (these are columns name) Id Name Category-id Description now Category-id column gets the values from another table category which looks like Id Name Description now category.Id is used in products.Category-id how to do this in mySQL ...

How can I prevent a double submit with jQuery or Javascript?

Hi guys, I keep getting duplicate entries in my database because of impatient users clicking the submit button multiple times. I googled and googled and found a few scripts, but none of them seem to be sufficient. How can I prevent these duplicate entries from occurring using javascript or preferably jQuery? Thanx in advance! ...

PHP mySQL database check

Hi guys, I am having endless troubles with duplicate entries, so I need to check the database, and if a user has already entered that day, their entry will not be submitted and they will be redirected to a landing page that tells them they have already entered that day, and that they may only enter again tomorrow. The field I would like...

How to structure data... Sequential or Hierarchical?

I'm going through the exercise of building a CMS that will organize a lot of the common documents that my employer generates each time we get a new sales order. Each new sales order gets a 5 digit number (12222,12223,122224, etc...) but internally we have applied a hierarchy to these numbers: + 121XX |--01 |--02 + 122XX |--22 |--23 |--...

Replacing keywords in text with php & mysql

Hello, I have a news site containing an archive with more than 1 million news. I created a word definitions database with about 3000 entries, consisting of word-definition pairs. What I want to do is adding a definition next to every occurence of these words in the news. I cant make a static change as I can add a new keyword everyday, ...

Checking if records exist in DB: in single step or two steps?

Suppose you want to get a record from database which returns a large amount of data and requires multiple joins. So my question would be, is it better to use a single query to check if data exists and get the result if it exists? Or do a more simple query to check if data exists then id record exists, query once again to get the result...

How to make Django work with unsupported MySQL drivers such as gevent-mysql or Concurrence's MySQL driver?

I'm interested in running Django on an async framework like Concurrence or gevent. Both frameworks come with its own async MySQL driver. Problem is Django only officially supports MySQLdb. What do I need to do to make Django work with the MySQL drivers that come with gevent or Concurrence? Is there a step-by-step guide somewhere that ...

Mysql server update cause error in php myadmin.

Hi I have updated my mysql server from 5.0 to 5.1.x. before it works fine, but after upgrading its displaying error in my phpmyadmin. Error is as below: "Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.45. This may cause unpredictable behavior." I am not getting what to do with this. Hope i am clear...

privmsg system db schema

I'm making a PM-system on my site. And I want to know ultimate db schema. I have always just used only 1 table. But my users have started complained that the messages in their outbox suddently dissapers =D Thats because if the other users deletes it, the one who sent it wont see it to. So im thinking of making another table with the sa...

MySQL Select statement Where table1.id != table2.id

I have a table of data which has posts, then I have a separate table of data which has deleted posts. What happens when a post is deleted is that it's ID get's added to the deleted table rather than removing the post entry. What is a clean efficient way of selecting all the posts from the posts table without selecting the ones that have...

What is wrong with this mysql stored procedure?

I use the following mysql procedure, DROP PROCEDURE IF EXISTS `allied`.`GetRegistrationData`$$ CREATE DEFINER=`allied`@`%` PROCEDURE `GetRegistrationData`() BEGIN select aboutUsId,name from aboutus where isDeleted=0 select ageId,name from age where isDeleted=0 select desiredsetId,name from desiredsetting where isDeleted=0 select di...

PHP is not called properly in IE using set interval function in Javascript

Hi all, I am trying to show the message updated in DB using the following code var showtime = setInterval('redirect()',5000); ////Redirecting to DB Status ///// function redirect() { xmlhttp = GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="isResult...

mysql second ordering

my table has the following fields videos |id| |average| |views| now i select some field from database, and order them by average SELECT `id` from `videos` order by `average` nut i need the second ordering by "views", i.e. if there are two rows vith equal "average", i want to order them by "views". How can i do that? thanks ...

Preview result of update/insert query without comitting changes to database in MySQL?

I am writing a script to import CSV files into existing tables within my database. I decided to do the insert/update operations myself using PHP and INSERT/UPDATE statements, and not use MySQL's LOAD INFILE command, I have good reasons for this. What I would like to do is emulate the insert/update operations and display the results to t...

CFile + WriteHuge not working

HI, I am using CFIle in my application and when i compiled my code i am getting error 'WriteHuge' : is not a member of 'CFile' 'ReadHuge' : is not a member of 'CFile' I included #include "afx.h" CFile file; file.WriteHuge(m_pDib,bmpFileHeader.bfSize-nBmpFileHeaderSize); file.ReadHuge(m_pDib,bmpFileHeader.bfSize-nBmpF...

Is it possible to execute the two update queries in phpmyadmin together?

Is it possible to execute the two update queries in phpmyadmin together? Like wise UPDATE jos_menu SET home = 0 WHERE 1; UPDATE jos_menu SET home = 1 WHERE id = 9; Now can we copy both these queries together and Run it on phpmyadmin sql query panel? will it be executed? ...

php mysql query strings array

i am building a string that i check in mysql db. eg: formFields[] is an array - input1 is: string1 array_push(strings, formFields) 1st string and mysql query looks like this: "select * from my table where id in (strings)" formFields[] is an array - input2 is: string1, string2 array_push(strings, formFields) 2nd string and mysql query l...

Can I use ALTER DATABASE to rename a mysql database?

I am using PDO with PHP to create a new database and then a new user with privileges on that database. In case one of them fails, I want to rename the database and user so that they can be deleted later and the names are available. Is it possible to rename a mysql database using the ALTER DATABASE? ...

Form submit capture into database not working

Hi guys, I have a form that has two buttons on it, one yes, one no, and at the moment I capture the clicked button into a database, but for some reason, it doesn't always capture the clicked button, I have gone through all my code and everything seems fine, here is the form <div id="mid_prompt"> <form action="re...

SQL Table Setup Advice

Hi all. Basically I have an xml feed from an offsite server. The xml feed has one parameter ?value=n now N can only be between 1 and 30 What ever value i pick, there will always be 4000 rows returned from the XML file. My script will call this xml file 30 times for each value once a day. So thats 120000 rows. I will be doing quite comp...