mysql

php authentication script

I need the following authentication script finished. I am weak at php/pdo so I do not know how to ask for the number of rows equalling one and then setting the session id's from the results of the query. I need to not only set the $_SESSION['userid'] but also the ['company'] and the ['security_id'] as well from the results. here is wha...

Points system like stackoverflow

Hello, I am trying to create a point system in my program similar to stack overflow i.e. when the user does some good deed (activity) his/her points are increased. I am wondering what is the best way to go about implementing this in terms of db schema + logic. I can think of three options: Add an extra field called points in the user...

$.post() in jQuery not working.

I'm making a rating system, and I have the following jQuery code on my index.php page: <script type="text/javascript"> $(document).ready(function() { $("[id^=rating_]").hover(function() { var rid = $(this).attr("id").split("_")[1]; $("#rating_"+rid).children("[class^=star_]").children('img').hover(function() { $(...

Why is my query so slow? Trying to find the null fields on a left join in mysql

EDIT: Updated with suggestions from Bill Karwin below. Still very slow. I'm trying to write a query that will find all items on an order that are entered to a warehouse that doesn't have a record for that item in that warehouse. As an example, if item XYZ is entered for warehouse A, but warehouse A doesn't actually carry item XYZ, I w...

How to export to excel from a winform vb.net 2008 without office installed?

Hello, I am building a windows form application using visual basic (visual studio 2008). The idea is to query a MySQL DB and export the results to an excel document. I managed to do this using this code (I will just show the export to excel part): Imports Excel = Microsoft.Office.Interop.Excel Imports System.IO Imports System.Da...

PHP PDO vs normal mysql_connect

Which one should be used php PDO or normal mysql_connect to execute database query through PHP. Which one is faster? One of the big benefits of PDO is that the interface is consistent across multiple databases. There are some cool functions for prepared statements too, which take some of the hassle out of escaping all your query strin...

How can I make a calendar with MYSQL data?

In my database, there are some days with data and some without; I have one column with data, and another column with the date and time submitted. So I want to create this calendar. So it will show all the days in the month, and then the days with data will be a hyperlink. When I click the link, it will show all the data submitted on that...

mysql result fetching comparison using php

Which one is better to fetch data from mysql database using PHP and why? mysql_fetch_row() mysql_fetch_assoc() mysql_fetch_array() ...

How to store user profile edits that must be approved before going live?

Hi, I'm trying to figure out how I should save an edit a user makes to their profile in a way that doesn't go live or affect the existing live data until it's approved by an admin. Have a second table for edited profiles then copy over the data on approval? Keep it all in one table and have a _tmp copy of all the fields that are editabl...

What is easiest way to retreive one column's values using SubSonic (Column isn't primary)

I'm using AcriveRecord in SubSonic 3.0.0.3 with MySql. Is there some easy way to perform something like "SELECT CustomerAddress FROM customers" rather than .All() which performs "SELECT * FROM customers"? And how to get distinct values? ...

Is there a free/open-source equivalent of mailing list managers such as MailChimp or ConstantContact, etc..?

Hi, MailChimp is a very nicely done service, where they tell you things like %clicked, and Google Analytics of recent email campaigns. They are similar to other sites like ConstantContact and CampaignMonitor, and many many others. Is there anything similar to MailChimp which is open-source or free? Or is there anything that could be ...

MySQL query sets field to 0 instead of blank string

This one's puzzling me. I have a MySQL query, being run though PDO: $stmt = $db->prepare( "UPDATE member SET acode='' AND status='active' WHERE username=:u" ); $stmt->bindValue( ':u', $member->username, PDO::PARAM_STR ); $stmt->execute(); The acode field gets set to 0 for some reason. It was created with `acode` varchar(8) NOT NULL ...

Jump to nested elements within ajax assembled structure

Hey so I'm not sure if this has any easy or good solution, but I figured I'd post here and find out if there's something I'm not thinking of. Basically we have a bunch of data that's nested in logical groups (not necessarily reflected in the database architecture), and it's being loaded and navigated by way of dynamic ajax loads. Thi...

Migrating MySQL to a table with different structure

Hi all, My company's currently moving our databases around, shifting one set of tables out from the old MySQL instance into the new. We've done some development prior to this migration, and some tables' structure has been altered from the original (eg. columns were dropped). So currently I've dumped the data from the old database and ...

MySQL Alias Question

i am wondering why this fails mysql> SELECT Continent C, Name, SurfaceArea -> FROM Country -> WHERE SurfaceArea = ( -> SELECT MAX(SurfaceArea) -> FROM Country -> WHERE Continent = C); ERROR 1054 (42S22): Unknown column 'C' in 'where clause' its a answer provided by the certification guide for some sample exercises....

How much conection to mySQL server at the same time?

Hi everybody, I didn't use mySQL before. Anybody can tell me how much is the max number of conection to mySQL server at the same time? ...

sql complex group query

I have a table with the following rows: id. type - link 1. image - http://1 2. image - http://2 3. text - none 4. video - http://.. 5. image - http://.. 6. text - http://.. I want to group the type (image) by date, so they show as single row. In this example, the first two images will merge together and output will be like...

NonUniqueObjectException error inserting multiple rows, LAST_INSERT_ID() returns 0

I am using NHibernate/Fluent NHibernate in an ASP.NET MVC app with a MySQL database. I am working on an operation that reads quite a bit of data (relative to how much is inserted), processes it, and ends up inserting (currently) about 50 records. I have one ISession per request which is created/destroyed in the begin/end request event ha...

Optimize right joins

The following query is working as expected. But I guess there is enough room for optimization. Any help? SELECT a.cond_providentid, b.flag1 FROM c_master a WHERE a.cond_status = 'OnService' ORDER BY a.cond_providentid, a.rto_number; ...

How can I write a trigger in mysql that after an insert to the table deletes the row?

I've got an after insert trigger that works good. However, I want it to delete the row after it's been inserted and after the main body of the trigger completes. How can I do that? I have a unique id in the table. ...