mysql

Can you notice what's wrong with my PHP or MYSQL code?

I am trying to create a category menu with sub categories. I have the following MySQL table: -- -- Table structure for table `categories` -- CREATE TABLE IF NOT EXISTS `categories` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(1000) NOT NULL, `slug` varchar(1000) NOT NULL, `parent` int(11) NOT NULL, `type` varchar(25...

storing code snippets in a database

Hey everyone, I want to make a code snippet database web application. Would the best way to store it in the database be to html encode everything to prevent XSS when displaying the snippets on the web page? Thanks for the help! ...

loops and conditionals inside triggers

I have this piece of logic I would like to implement as a trigger, but I have no idea how to do it! I want to create a trigger that, when a row is deleted, it checks to see if the value of one of its columns exists in another table, and if it does, it should also perform a delete on another table based on another column. So say we had a...

vb.net program cannot connect to wampserver

I have a vb.net program that uses mysql as its database. And it works when the computer has wampservr installed. But the program gets an unhandled exception error when the computer where its running does not have a wampserver. The only thing that is installed in it is the mysql connector net. How do I make it work. I just want the two pr...

PHP: PDOStatement simple MySQL Select doesn't work.

Hi I have the following PHP code doing a very simple select into a table. $statement = $db->prepare("SELECT * FROM account WHERE fbid = :fbid"); $statement->bindParam(":fbid",$uid, PDO::PARAM_STR,45); $out = $statement->execute(); print_r($out) // 1; //$out = $statement->execute(array(':fbid' => $uid)); // also doesn't work $row = $sta...

How can we have check boxs inside a muti valued list/ combo box using php? and then how can we insert the values of checked boxes in database(mysql)?

i am using prototype.js ...

synchronization of postgres and mysql database server?

whats the best way to synchronize few tables of mysql server with postgreSQL server, currently people are executing scripts, which takes much time, is there any fast solution available from which we can map the tables and columns to synchronize the db server. ...

Using preg_replace in mysql

I have a CMS content in database. The content contains '<img src= .............../>' also. I want to retrieve this content using mysql query and show on frontend but with all '<img src='.........../>' removed from the content. How can it be done using query in mysql? ...

Does this schema sound better suited for a document-oriented data store or relational?

Disclaimer: let me know if this question is better suited for serverfault.com I want to store information on music, specifically: genres artists albums songs This information will be used in a web application, and I want people to be able to see all of the songs associated to an album, and albums associated to an artist, and artis...

mysql: check if interval between two dates is less than 1 second

Ok, I need something like this: datediff(second, date_one, date_two) < 1 dates are stored in a column 'datetime' type UPDATE I want to find dates which differ in less than several (say, 10) seconds ...

Using SQL to get the Last Reply on a Post

I am trying to replicate a forum function by getting the last reply of a post. For clarity, see PHPBB: there are four columns, and the last column is what I like to replicate. I have my tables created as such: discussion_id (primary key) user_id parent_id comment status pubdate I was thinking of creating a Link Table that would u...

Using function arguments to dynamically generate a query

I am working on an issue management system, developed in PHP/MySQL. It requires search functionality, where the user will mention the search parameters and based on these parameters the system will return the result set. To solve this I am trying to write a function and all the user selected parameters are passed as arguments. Based on ...

what is correct sql statement syntax in PHP?

Hi, when I write a sql statement in php, i usualy write it as below SELECT COUNT(*) FROM catalogsearch_query AS main_table but I found that some people write sql statement like SELECT COUNT(*) FROM `catalogsearch_query` AS `main_table` do I have to use ` ? ...

Is there any free tool for profiler of MYSQL database?

Is there any free tool for profiler of MYSQL database? I want to capture the SQL statement from application. and want to tune it for performenencae. Can any one suggest? Thanks, Paresh ...

Non-Access or -base QBE tool?

I'm currently looking for a QBE tool that can execute queries on PostgreSQL or MySQL. OS doesn't really matter. Reason is that we've got to do QBE at school but I don't want to use neither Microsoft Access nor OpenOffice.org Base (lack of features). Any help would be appreciated. ...

MySQL, if a value is in one of two columns, return the value from the other one

Hi, This might be an easy one, but I'm not really experienced with sql. I have a table with two user_id columns, user1 and user2. This table contains some compared values between the two users. I want to send in an user id, and return all the id's from the other user when the sent user is either user1 or user2. I guess some sort of i...

When should I use MySQL compressed protocol?

I've learned that MySQL can compress communication between servers and clients. Compression is used if both client and server support zlib compression, and the client requests compression. (from MySQL Forge Wiki) The most obvious pros and cons are pros: Reduced payload size cons: Increased computation time So, is compresse...

Group / User based security. Table / SQL question

Hi, I'm setting up a group / user based security system. I have 4 tables as follows: user groups group_user_mappings acl where acl is the mapping between an item_id and either a group or a user. The way I've done the acl table, I have 3 columns of note (actually 4th one as an auto-id, but that is irrelevant) col 1 item_id (item...

Visual Query Builder

If been using "dbForge Query Builder" lately and I'm gotten used to the ease of building and testing a query, specially for those complex ones with inner joins, aliases and multiple conditionals. The expiry date of the trial is about to come, and while wanting to remain on the legal side for this I'd rather not pay the 50USD it costs (a...

DB.Null equivalent in JDBC

Is there an equivalent of (ADO.NET) DB.Null in JDBC? Or do I simply pass null in the parameter? Particularly in the context of Mysql? ...