mysql

MySQL equivalent of PHP's base_convert?

Hello, Does anyone know of an equivalent function in MySQL of PHP's base_convert? http://php.net/manual/en/function.base-convert.php Thanks, Mark ...

Tag Conventions

Currently, these are the preparations I'm making: Convert to lowercase. Strip HTML tags. Check if tag already exists Are there any other things that I consider? note: Tags may be in Arabic. here the method i use function sanitize_tag($tag){ //strip slashes if(get_magic_quotes_gpc()) { $tag = stripslashes(trim($tag)); } //Re...

How long should it take to build an index using ALTER TABLE in MySQL?

Hi All, This might be a bit like asking how long a length of string is, but the stats are: Intel dual core 4GB RAM Table with 8million rows, ~ 20 columns, mostly varchars with an auto_increment primary id Query is: ALTER TABLE my_table ADD INDEX my_index (my_column); my_column is varchar(200) Storage is MyISAM Order of magnitude, sh...

MySQL UNION query syntax

I have two tables that I want to query and merge based on a category_id. My events table has a column called event_category_id that creates a relationship between the event and it's category. The value is an int. In my categories table I have a column called category_id which is what I want to match on and replace the int value with ...

mysql composite indeces should i be using them

I got question on index strategies for mysql - mainly when to use a composite index I have a fairly common relational db scenario, heres my table set up: Maintable - table consisting of "products" including brandid, merchantid So I create a table to store the brands and merchants Brandtable - brandname, brandid Merchanttable - merc...

mysqli, loops, and prepared statements

Ok, I don't use php often enough to remember it when I wander back into it. I'm going a bit crazy with this one. I'll post the code below but a few quick explanations. con.php is a php file that creates the database connection $wkHook. There is no issue at all with the connection, so that is not my problem. Basically, I am selecting...

Help With The Syntax Of This SQL QUERY

Hi, I'm inexperienced with SQL and I'm not sure how to form this query correctly. Select comment.text, (COUNT(parent.id)-1) AS depth FROM comments AS comment, comments AS parent WHERE comment.lft BETWEEN parent.lft ...

Script to generate default values for not columns with no defaults specified in SQL Server

I have a MySQL database that I am migrating to SQL Server. The application that references the database breaks when I run it against SQL Server because SQL Server does not offer the implicit defaults that MySQL offers. I wanted to see if there is a way to generate script that would force defaults on all NOT Null columns that do not have...

Best mySql management tool?

I am looking for a complete integrated mySQL management / admin tool (hopefully that can run in Linux). I need the ability to graphically model my tables and relationships (reverse/forward engineering would be great). I also need a tool with good data management options (i.e. basic crud). I have tried MySql workbench and it is great f...

Create/Write Permissions in MySQL

I am experiencing some permission problems with my SELECT ... INTO OUTFILE statement. When I log into my database and do a simple export command, eg: mysql> select * from XYZ into outfile '/home/mropa/Photos/Desktop/TEST.txt'; I get the respond: ERROR 1 (HY000): Can't create/write to file '/home/mropa/Photos/Desktop/TEST.txt' (Err...

how to make mysql structure of up,down rating

Every programmer here knows about ratings like that: The problem is that I don't know how to make my SQL structure for that. I think I can add up and down field in article table in MySQL, but this does not allow multi voting. Could you please tell me how to make it? Do I have to create a new table? ...

Looking for a typecasting capability in mysql

I'm writing a query that returns whether a record is public or private. If the record is public, the user_id column for that record is zero. Otherwise, it is a positive integer. I'd like the query to return a one if the user_id is greater than zero and a zero if it is zero. In PHP, I would probably just cast it to a binary. This doe...

how to save a javascript rendered countdown timer to mysql using PHP ?

Hi, can someone please tell me how to save a javascript rendered countdown timer to mysql db using PHP ? e.g I have this button, that when someone clicks it, the countdown appears and starts counting. so yeah, that's my problem, what's the best way to do in order to ensure that - the exact date/time(in unix format) the button got click...

How can I search for any day in a month?

I'm doing a search through a database to find articles written within a certain month: between '1 '.$month.' '.$year and '31 '.$month.' '.$year Is this method ok even if some months (like February) only have 28 days? In other words, do I have to dynamically find the number of days in the month, or not? ...

What complications should I look out for when converting tables to InnoDB ?

I'm having trouble with a liferay installation that is suddenly (without any code modifications) failing with "dulplicate id" errors. We've identified that the issue may be solved by changing the mysql engine to InnoDB. I'm planning the change now, but i'm not sure what complications are likely in the process. I've checked for full te...

Help with foreign key mapping in Hibernate (Spring)?

I have the following two table (which are tied in with Spring security - but the issue I believe is with Hibernate): Table user Table authority The user table is tied (through Hibernate) to a domain object in my application: class User, which has the following attributes (and corresponding getters and setters), which correspond to col...

Connecting to a Online MySQL Database using VB.Net

I've searched around and haven't been able to find anything along the lines of doing this. ...

Website: What is the best way to store a large number of user variables?

Hi, I'm designing a website using PHP and MySQL currently and as the site proceeds I find myself adding more and more columns to the users table to store various variables. Which got me thinking, is there a better way to store this information? Just to clarify, the information is global, can be affected by other users so cookies won't ...

Can you locally store tweets from twitter API

Are you allowed to locally store tweets obtained using the twitter api? http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search ...

Retrieving specific tuples using Mysql

Hi, I have some problems retrieving specific tuples. I am actually a student trying to build a Room management system. I have two tables: Room(roomID,hotelname,rate) and Reservation(resID,arriveDate,departDate,roomID). I am not sure how to retrieve the rooms that are available between 2 specific dates. This was the query that i u...