Skip to content

Tag: database

Automatically insert Line break?

I’m making a news posting system and I was wondering if it is possible to automatically insert a <br /> tag where ever there is a new line? For example, if posted a news article with the following text in the text area: it would add this to the news database: Is there a way to do this? Answer

Purpose of Secondary Key

What is the purpose of the Secondary key? Say I have a table that logs down all the check-ins (similar to Foursquare), with columns id, user_id, location_id, post, time, and there can be millions of rows, many people have stated to use secondary keys to speed up the process. Why does this work? And should both user_id and location_id be

Doctrine 2: Update query with query builder

Hi I’ve got the following query but it doesn’t seem to work. This returns the following error message: Fatal error: Uncaught exception ‘DoctrineORMQueryQueryException’ with message ‘[Semantical Error] line 0, col 38 near ‘testusername WHERE’: Error: ‘testusername’ is not defined.’ in … I would be glad of any help Answer I think you need to use ->set() It’s much safer to

PDO looping through and printing fetchAll

I’m having trouble getting my data from fetchAll to print selectively. In normal mysql I do it this way: In PDO, I’m having trouble. I bound the params, then I’m saving the fetched data into $rs like above, with the purpose of looping through it the same way.. Now comes the trouble part. What do I do PDO-wise to get

Object-oriented-like structures in relational databases [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year. Improve this question Folks, For the n-th time in a row, i’m hitting the same old problem again. It’s about “how do I map OOP