mysql

TCP server (php)

I have a gps simulator, which sends continuous location data (nmea strings) through tcpip to 192.168.0.178:2323. How do I get that data using tcp socket and write to DB (php & mysql)? Thanks! ...

How to manage Rails database.yml

What's the best way to handle the Rails database.yml if multiple people are working on the project and database locations are different (the socket in particular). ...

Has_Many, Belongs_To Relationship in a Database Driven Application

I am working on an an application that allows a user to search for a particular book on Amazon using a given search criterion (e.g. title, keyword, author.) I am currently attempting to store these search results to a MySQL database, but am struggling with the concept of relationships. It seems natural that I would structure the models ...

MySQL Connector/C++ Library Linking ERROR Problem

PROBLEM: Ok, I've been TRYING to follow the sample code on the MySQL Forge Wiki and some other websites that offer a tutorial on how to get a simple database connection, but for some reason, my project always fails at a linking error and I can't figure out why or how to fix it myself (I'm still learning). PLEASE HELP ME! I've included t...

Which one of these PHP and Mysql scripts is safer security wise?

Is script 1 safer? "; } else { queryMysql("CREATE TABLE $name($query)"); echo "Table '$name' created"; } } function tableExists($name) { $result = queryMysql("SHOW TABLES LIKE '$name'"); return mysql_num_rows($result); } function queryMysql($query) { $result = mysql_query($query) or die(mysql_error()); return $result; } ...

PHP - dynamic menu with submenus

Hello, I've got a menu, that is something like this: <ul id="menu_cat"> <li><a class="cat1" href="#">category 1</a> <ul> <li><a class="cat2" href="#">category 2</a> <ul> <li><a class="cat3" href="#">category 3</a></li> <li><a class="cat3" href="#">category 3</a></li> <li><a class="...

Mysql colation for all languages

Hi, I'm currently developing a website that is gonna show stuff for almost any language in the world. And im having problems choosing the best collation to define in the mysql. Wich one is the best to support all characters??? Or the most accurate??? Or is just best to convert all characters to unicode? thanks ...

How to implement a bidirectional unique index across multiple columns

Okay i know i can do this in the application layer, which is probably the easiest thing to do, but just to make sure that no errors water down to the DB, i have a serious question I have two columns X and Y, each to store two integers (either A or B in any of the columns). Is it possible to have a unique index constraint such that, in n...

How can i make MySQL Fulltext indexing ignore url strings, particulary the extension

Hi, i'm indexing strings containing URL's in MySQL Fulltext... but i dont want the urls included in the results. As an example i search for "PHP" or "HTML" and i get records like "Ibiza Angels Massage Company see funandfrolicks.php"... a hedonistic distraction at best. I can't see examples of adding regular expressions to the stop word...

No idea how to write complex SQL query

Hi I have following db structure: File, User, FileRevision (has foreign key to File, and many-2-many connection through intermediate table to User). I want to fetch all FileRevision-s that: are newest/freshest in their corresponding File-s, have many-2-many link to User that performs search (permission checking). I found out that...

Mysql ASCII vs Unicode

Just a quick one: Will SELECT ... WHERE name LIKE '...' query be faster if name column is ASCII rather then UTF-8? Thanks! ...

MySQL Error when dropping index (errno 150)

I've got problem with dropping foreign key index, I always get the same error ALTER TABLE `comments` DROP INDEX `id_user` which outputs 1025 - Error on rename of './postuj_cz1/#sql-d834_a0c704' to './postuj_cz1/comments' (errno: 150) The id_user on the other table is simple primary key index. I'm using MySQL version 5.0.85 ...

How does MySQL decide which id to return in group by clause?

Such as this one: SELECT id, count( * ) , company FROM jobs GROUP BY company Where id is the primary key of jobs ...

Continuous data handling through TCP

I need to handle continuous data through TCP and write it to database. I use the following code (suggested by ZZ Coder): <?php $fp = fsockopen ("192.168.0.179", 2323); if (!$fp) { die ("$errstr ($errno)"); } if ($fp) { $user="root"; $password="12345"; $database="db_name"; mysql_connect('localhost',$user,$password...

Custom library files and web application on shared hosting?

Let me put my issue defining a real scenario: I am using dedicated server where PHP and MySQL are available. My PHP include_path=/var/local/php I am developing a custom cms application, where I am writing my own library which is responsible for communicating with the database and retrieving data based on some key. My application is g...

Mysql /php - How to create 'empty' row object for caching

I'm using memcache to cache database objects, for example user rows. when a user row does not exist, I would like to create an 'empty' database object, similar to the one mysql would return for a user query, fill it with data and use it. I don't want to create a new database row for the new user at this point. (it will be created at lat...

Need help with a multiple table query in mysql

I'm working on building a forum with kohana. I know there is already good, free, forum software out there, but it's for a family site, so I thought I'd use it as a learning experience. I'm also not using the ORM that is built into Kohana, as I would like to learn more about SQL in the process of building the forum. For my forum I hav...

configure apache with sql

Hello, I am newly using Apache Tomcat6.0 I am unable to access sql database through my jsp and getting java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver Tried steps at http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html downloaded drivers mysql-connector-java-5.1.9 and mysql-5.0.85-w...

PHP tutorial that will show you how to display your first 5 new members?

Is there a tutorial that will show you how to code your own PHP script that will display your most recent registered members? ...

Ruby on Rails database migration not creating foreign keys in MySQL tables

I am trying to modify a database Migration in a Ruby on Rails application. I am using MySQL as my database and would like to add foreign keys to the table that is being created. I am using the following code and while the specifications for creating null values on appropriate columns is being followed no foreign key constraints are being...