mysql

PHP: How can I turn a mysql TEXT or BLOB type into a string?

I have a frustrating experience in PHP because I keep getting my MEDIUMTEXT field returned as a non-string string. When I check the variable's type it says it's a string, but it's actually an array, basically a character array so I do: while ($row = mysql_fetch_assoc($records)) { print_r($row["myText"]); } Which instead of printing ...

Use PHP to format an input SQL query as HTML?

What I am looking for is a php function that takes an unformatted query like this: $sql = "select name, size from things where color = 'green' order by price asc"; so that it would appear in an HTML page something like this: SELECT name, size FROM things WHERE color = 'green' ORDER BY price ASC'; There's some co...

MySQL data provider for .net

Do we have any Open Source MySql Data Provider for .net? If Any, Let me know. ...

What's a Robust but Simple Apache / PHP / MySQL Installer for Windows Vista

Hi, I tried easyphp but i think it's not enough, I want an Apache / PHP / MySQL installer which has the latest PHP and MySQL version, and with curl and htaccess support. Opensource solutions are preferred, should be windows vista compatible. ...

Most common value for multiple fields

I have a table which contains ratings. Included with the rating is data the user provided such as the language that the linked series belongs to. id series_id language quality type rating 1 18 1 2 1 20 2 18 2 3 2 13 3 18 1 1 2 25 4 18 1...

MySqlImport - Import a date field not in the proper format

I have a csv file that has a date field in a format like (among other fields): 17DEC2009 When I do a mysqlimport, the other fields are imported properly, but this field remains 0000-00-00 00:00:00 How can I import this date properly? Do I have to run a sed/awk command on the file first to put it into a proper format? If so, what ...

MySql find all rows where data contains less than four characters

How would I properly write this sql-english query: "SELECT zip FROM tblContacts WHERE [the number of characters in zips is less or equal than 4]". Thanks. ...

Returning column names from a mySQL table using PHP

Can't figure this out for the life of me. Trying to return the column names from the clients securities table, then return the result as an array. Can anybody point out where I'm getting off track? mysql_select_db("HandlerProject", $con); //Selects database $selectcols = "SELECT * FROM ".$clientname."securitiestable"; //sel...

Rows between two index entries?

Hello stackoverflow! First time poster here. I'm having problems re-importing a database dump made by mysqldump. I ran mysqldump with the order-by-primary option, and I had it run on a table with a unique key (and no explicit primary key, so it sorted by that unique key). My objective in this case was to re-create the table, making the u...

LEFT JOIN fails when sub-query returns null

I have this query intended for reporting off of a MySQL database. The query works fine if the sub-query returns some result. However if the sub-query returns no results with the error 'column lessonId cannot be null'. I guess this is logical, but I really never want the report to fail (the date is input by the user)...I want it to just o...

Select a two-word field name in mySQL, called from PHP

trying to get information from a field and it's not recognizing the field name. $selectsecurityname = mysql_query("SELECT security name FROM securityinfo") or die(mysql_error()); Have a feeling it's because the fields name "security name" is two words. Is there a way to pass a two-word field name, or do I have to change everything to...

To normalize the values.

import java.io.*; import java.sql.*; public class Sum2{ public static void main(String[] args) { System.out.println("Sum of the specific column!"); Connection con = null; try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/prathi","root","mysql"); t...

How to use mySQL WHERE clause in PHP?

Can't seem to pass anything from the "securityinfo" field. for ($k = 1; $k < $fieldscnt; $k++) { $selectsecurityname = mysql_query("SELECT `security name` FROM securityinfo WHERE symbol = '$symbol[$k]'") or die(mysql_error()); $securityname = mysql_fetch_array($selectsecurityname); $sym = $symbol[$k] echo "<td>$sec...

@ is not an in parameter in my mysql query

I'm running this query: LOAD DATA INFILE 'SomePath' INTO TABLE SomeTable FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (column1,column2,@Column3Value) SET column3 = CAST(@Column3Value AS UNSIGNED); I'm using the @Column3Value param because this field is a bit type field and this is the only way to do a loading...

SQL WHEREing on a different table's COUNT

So, I want to apply a WHERE condition to a field assigned by a COUNT() AS clause. My query currently looks like this: SELECT new_tags.tag_id , new_tags.tag_name , new_tags.tag_description , COUNT(DISTINCT new_tags_entries.entry_id) AS entry_count FROM (new_tags) JOIN new_tags_entries ON new_tags_entries.tag_id = n...

MySQL SQL getting most recent records in a table?

I have an sql statement as below attempting to retrieve the most recent entries in a table. So I have two questions: is it better to order by id or by date? how do I rewrite this sql statement to re-order by date? SELECT id, comment, DATE_FORMAT(entry_date, '%W %H:%i') FROM comments ORDER BY id DESC LIMIT 10 ...

Using MCPKit framework in Cocoa app.

I'm trying to integrate the MCPKit MySQL framework available at http://mysql-cocoa.sourceforge.net/ into my cocoa application. I've added the framework and included the header file but when I try to define my first MCPConnection variable it says "MCPConnection undeclared". Is anyone successfully using MCPKit on leopard ? Or is there anot...

MySQL/SQL retrieve first 40 characters of a text field?

How can I retrieve a text field from mysql db table, but not the entire text, just the few 40 or so characters. Can this be done in sql or do I need to do it using php? basically what I am trying to do is show the first x characters and then let the user click on that to view the full content. ...

Intelligent Database - Capable of identifying out of the ordinary values

I am looking for a tool or system to take a look at the database and identify values that are out of the ordinary. I don't need anything to do real time checks, just a system which does processing overnight or at scheduled points. I am looking for a system at two levels: Database wide: Eg: Compare salaries of all employees and identify...

Vanilla MySQL access from Ruby 1.9 on Snow Leopard

Hi Folks, I am running Ruby 1.9 (ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10]) on Slow Leopard (installed via MacPorts). I then installed the Ruby MySQL client library via MacPorts: install rb19-mysql Trying to use it I get the following error: db.rb:4:in `initialize': wrong number of arguments(4 for 0) (ArgumentError...