mysql

Approve/Deny in PHP, with some minor javascript

Hi again. Another lame question So, I have a site that displays several students' requests to change advisors, with an Approve and Deny button for each student. Then I have a Javascript pop-up that confirms the decision when clicked on either button, and it will also e-mail the student about this decision. This should all be on one page...

table lock while creating table using select

Using mysql version 5.0.18 I am creating a table TT, Client 1 set autocommit = false; start transaction Create table TT select * from PT; PT has tow columns pk bigint not null,name varchar(20) Client 2 set autocommit = false start transaction insert into PT values(123,'text'); While inserting a row in PT , it is waiting for the table ...

Accessing remote MySQL data using c#

Hello, I work on a Joomla web site, installed on a MySQL database and running on IIS7. It's all working fine. I now need to add functionality that lets (Joomla-)registered users change some configuration data. Though I haven't done this yet, it looks straightforward enough to do with Joomla. The data is private so all external access ...

PHP: Join two separate mysql queries into the same json data object

I'm trying to mesh the below mysql query results into a single json object, but not quite sure how to do it properly. $id = $_POST['id']; $sql = "SELECT contracts.po_number, contracts.start_date, contracts.end_date, contracts.description, contracts.taa_required, contracts.account_overdue, jobs.id AS jobs_id, jobs.job_number, companies....

MySQL date query only returns one year, when multiple exist

I'm a part-time designer/developer with a part-time photography business. I've got a database of photos with various bits of metadata attached. I want to query the database and return a list of the years that photos were taken, and the quantity of photos that were taken in that year. In short, I want a list that looks like this: 2010 (...

Displaying zero valued months with SQL

The following query returns values for months with sales but not for months where sales are zero: SELECT DATE_FORMAT(O.OrderDate, "%b, %Y") AS MonthYear, SUM(O.Total * C.Rate) AS Sales FROM (Orders O INNER JOIN OrdersStates OS ON O.OrderID = OS.OrderID) INNER JOIN Users U ON U.UserID = O.UserID INNER JOIN UsersDescription UD ON U.UserI...

Whats the best way to design this database scenario?

I want to setup 2 MySQL databases which differ in schema in that, one is normalized and the other is flat for quicker reads. The information being stored in both DBs is the same, but the representation is obviously different owing to the different design approaches. I need to find a robust solution to sync information in real time from ...

MySQL - Using an alias in a subquery with WHERE clause

I have a feeling I am completely borking this MySQL query but I'll ask anyway. I am wondering why I get the warning Unknown column 'FOO', and how I can get this query to work properly, in 'where clause' when I run the following: SELECT sample_id as FOO FROM tbl_test WHERE sample_id = 521 AND sample_id IN ( Select sample_id FROM tbl_test...

Why is this MySQL INSERT INTO running twice?

I'm attempting to use the mysql insert statement below to add information to a database table. When I execute the script, however, the insert statement is run twice. Here's the URL mysite.com/save.php?Body=p220,c180 Thanks in advance. <?php //tipping fees application require('base.inc.php'); require('functions.inc.php'); // conne...

Insertion failed error in MySQL.

while($row=mysql_fetch_array($result2)){ //return $row['ProjectID']; $sql="INSERT INTO `tycodashboard` (ProjectID,DesignationID,ReqcompID,IntOrgID,FinishedTimeID,ProjectStatusID,PhaseID ) VALUES('{$row['ProjectID']}','$pm,'$req','$initiating,'$initiating','$ftime,'$ProjectStatus,'$Phase)"; $res...

Advanced Form Validation in JavaScript

I'm already familiar with how to use onSubmit to evaluate form content against RegEx to ensure it meets static parameters for acceptable content. What I'm wondering is if there is a way to further provide validation against a MySQL database, such as if you want to make sure an e-mail address hasn't been used yet before submitting a form...

Unknown Column 'template' in where clause, while using a stored procedure.

Hello, I have a stored procedure, which has got executed without any errors, but gives me an error "#1054: Unknown column 'templateName' in where clause" when I run it. The stored procedure is: delimiter // DROP PROCEDURE `getData`// CREATE DEFINER=`root`@`localhost` PROCEDURE `getData`(IN templateName VARCHAR(45),IN templateVersion VA...

Big problem with fluent nhibernate, c# and MySQL need to search in BLOB

I've done a big mistake, now I have to find a solution. It was my first project working with fluent nhibernate, I mapped an object this way : public PosteCandidateMap() { Id(x => x.Id); Map(x => x.Candidate); Map(x => x.Status); Map(x => x.Poste); Map(x => x.MatchPossibility); Map(x =>...

MySQL Group Results by day using timestamp

I need to take the following query and pull the total order counts and sum of the orders grouped by day. I'm storing everything using timestamps. SELECT COUNT(id) as order_count, SUM(price + shipping_price) as order_sum, DAY(FROM_UNIXTIME(created)) as day FROM `order` WHERE '.implode(' AND ', $where).' I need to group by ...

Is there a Veil-like plug-in for MySQL?

We have a MySQL database and would like to have row-level security implemented at the database level. I have been playing with the Veil plug-in for PostgreSQL and like what it does. Is there something similar for MySQL so we do not have to convert over to PostgreSQL? Update It isn't so much that we would be using veil, or its MySQL e...

Will MySQL full-text-search return the results I need?

I have a keyword field with a list of 5 keywords for each item. example below: 2008, Honda, Accord, Used, Car Will MySQL full text return the item above for the following search requests? 2008 Honda Accord Honda Accord Used Car If so, how well will this hold up when searching through fifty thousand plus records? ...

Codeigniter/mySQL question. Checking if several inserts are possible before actual insertion.

Hey SO, So I'm trying to perform a couple inserts at once that are kind of co-dependent on each other. Let's say I'm doing a dog rating website. Anyone can add a dog to my database, but in doing so they also need to add a preliminary rating of the dog. Other people can then rate the dog afterwards. The dogs to ratings is a many to o...

iterate through fb:random

does anyone know how i would fill data from mysql database in fb:random and iterate through it, to pick a random quote? fb:random $facebook->api_client->fbml_setRefHandle('quotes', '<fb:random> <fb:random-option>Quote 1</fb:random-option> <fb:random-option>Quote 2</fb:random-option> </fb:random>'); mysql data: $rowcount = mysql_resu...

mysql_real_escape_string on all mySQL queries?

Is mysql_real_escape_string supposed to replace both addslashes() and stripslashes()?? ie.. do I use it to encode form input variables on MySQL inserts as well as use it in place of stripslashes on MySQL select statements? Sincerely, Confused PHP noob ...

I have a tab delimeted file that I want to convert into a mysql table

I have a tab delimeted file that I want to convert into a mysql table. there are 25 tab delimeted fields in the text file. I can get the values in when I construct the SQL statement word by word and get each value individually stated in the VALUES part but when I try to get the list as a whole it does not work. Here is the code. I could...