mysql

A powerful management tool for MySQL with similar features to SQL Server Management studio

I am currently working with a developer who is experinced at MsSQL, but not much at MySQL. He has been cursing MySQL for having Bugs, and also being far harder to use. Is is becuase his experince has been so good with Managment studio. It seems to me that his problems are with using phpMyAdmin. For example, he cites not being able to c...

How to insert/embede images in dynamically generated MS Excel file using PHP?

I need to export a report to Excel file using PHP i.e. on the fly. I am acutally getting data from mysql and presenting it in HTML tables. I am able to export all this data into Excel file format, except images. I can't point the image source to absolute url, because this file also needs to work offline. Is there any way, I can embede/in...

MySQL strip non-numeric characters to compare

I'm looking to find records in a table that match a specific number that the user enters. So, the user may enter 12345, but this could be 123zz4-5 in the database. I imagine something like this would work, if PHP functions worked in MySQL. SELECT * FROM foo WHERE preg_replace("/[^0-9]/","",bar) = '12345' What's the equivalent functi...

SQL: Select "until"

I'm looking for a way to select until a sum is reached. My "documents" table has "tag_id" and "size" fields. I want to select all of the documents with tag_id = 26 but I know I can only handle 600 units of size. So, there's no point in selecting 100 documents and discarding 90 of them when I could have known that the first 10 already ...

MySQL optional stored proc parameters

In MSSQL, when I want to ignore an empty filter parameter, I do the following SELECT * FROM Table WHERE EmployeeName = ISNULL(@EmployeeName, EmployeeName); How would I achieve this in MySQL? ...

What is the optimal amount of data for a table?

Hello, my question is : How much data should be in a table so that reading is optimal? Assuming that I have 3 fields varchar(25). This is in MySQL. ...

How to Pass MySQL null parameter on DbCommand in Enterprise Library.

I'm trying to pass a null value for the first parameter in the code below, but MySQL complains that Incorrect number of arguments for PROCEDURE myProc; expected 2, got 1 When I manually call the procedure with the first argument as null, it works, but when EmptyAsNullStartsWith(employeeNumberText.Text) returns null, it complains. ...

query join question

I have a right outer join, that almost does what I want... SELECT users_usr.firstname_usr, users_usr.lastname_usr, credit_acc.given_credit_acc, users_usr.created_usr, users_usr.sitenum_usr, users_usr.original_aff_usr, users_usr.id_usr FROM credit_acc right Outer Join users_usr ON credit_acc.uid_usr = users_usr.id_usr The problem is, I...

Using mySql data in ASP.NET application

I am a newcomer to ASP, and would like to experiment with it by writing a website for a club at my school using .net 2008 and the mySql database available from the school's apache server. What is the best way to set this up, since I see a lot of options to connect the web app to SQL Server or Oracle databases, but I'm nervous that it wo...

CodeIgniter - Uploading an Image through a form, store the location of the image in database

Hey folks - I'm trying to upload an image to my site through a form, however it's much more efficient to (rather than bog down the database) just store the location of the image in the database. I'm having trouble with my form and really don't know where to go: <?=form_open('bro/submit_new');?> //other form data Image: <input type="...

Is there a site which simply outputs the latest stable version numbers of php and mysql?

I want to write a little app for myself which notifies me if there is a new version of php or mysql but I would need a feed or an xml file to read it from. ...

Why isn't MySQL using the index for this subquery?

I used to do this: SELECT layerID FROM layers WHERE ownerID = ? AND collectionID = ? Which would give me an array of layerID's, and then I'd loop and do this for each one: SELECT DATA FROM drawings WHERE layerID = ? And it all worked fine. So now I'm trying to do it in one step, so I try this: SELECT DATA , layerID FROM drawings W...

How to turn off mysql errors from being displayed to screen in CodeIgniter

Even though error_reporting is set to 0, database errors are still being printed to screen. Is there a setting somewhere I can change to disable database error reporting? This is for CodeIgniter v1.6.x EDIT: Re: Fixing errors - Um, yes. I want to fix the errors. I get error notices from my error log, not from what my visitors see printe...

Mysql throwing query error yet finishing query just fine-why?

I am getting Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in *filename* on line 81 While running a query to build a chart. The query gets data from the mysql db and uses it to build the chart. Usually, I get this error and go to the code and find where I've screwed up, fix it, and move on. ...

SQL: Get all posts with any comments

I need to construct some rather simple SQL, I suppose, but as it's a rare event that I work with DBs these days I can't figure out the details. I have a table 'posts' with the following columns: id, caption, text and a table 'comments' with the following columns: id, name, text, post_id What would the (single) SQL statement ...

The difference in months between dates in MySQL

I'm looking to calculate the number of months between 2 date time fields. Is there a better way than getting the unix timestamp and the dividing by 2 592 000 (seconds) and rounding up whithin MySQL? ...

Does mysql index null values?

I have a mysql table where an indexed INT column is going to be 0 for 90% of the rows. If I change those rows to use NULL instead of 0, will they be left out of the index, making the index about 90% smaller? ...

When is it time to create a 2nd database?

I have a mysql database which has grown to over 200 tables in it. I know this isn't a performance problem, but most admin tools I have aren't organized well enough to manage this number of tables easily, and I am thinking of putting some (new) tables into a 2nd database just for my own sanity. Has anyone else gone down this path, and wa...

Updating an associative table in MySQL

Below is my (simplified) schema (in MySQL ver. 5.0.51b) and my strategy for updating it. There has got to be a better way. Inserting a new item requires 4 trips to the database and editing/updating an item takes up to 7! items: itemId, itemName categories: catId, catName map: mapId*, itemId, catId * mapId (varchar) is concat of itemId +...

How to make a field NULL using MySQL GUI Tools?

I'm using the MySQL Query Browser (part of the MySQL GUI Tools) and need to change a field to NULL, but I can't figure out how to do it - if I delete the value it tries to update it to ''. Typing "NULL" makes it try to update to 'NULL' (a string). I know I could just write a query to do it, but that defeats the entire purpose of the too...