random bit of mysql/ php help needed. | Troubleshooting and Help | Forum

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
random bit of mysql/ php help needed.
August 14, 2013
1:08 pm
Riddick
Member
Forum Posts: 15
Member Since:
February 2, 2013
Offline

i need to merge 2 columns on the same table while adding a "_" in between them (and know thats not a smiley face)

any one got any knowledge that could help me?

regards Riddy

August 14, 2013
4:59 pm
Alexander
Member
Forum Posts: 12
Member Since:
March 10, 2013
Offline

I'm assuming u want a new column in the existing table,
with the merged data from the other 2 columns?

So first add the new column, check if the columntype is correct:
ALTER TABLE table1 ADD COLUMN merged_column varchar (20);

Then insert the merged data:
UPDATE table1 SET merged_column = CONCAT(column1, "_", column2);

So now Rid Dick becomes Rid_Dick
For Rid"_"Dick use:
UPDATE table1 SET merged_column = CONCAT(column1, "\"_\"", column2);

August 14, 2013
5:04 pm
Riddick
Member
Forum Posts: 15
Member Since:
February 2, 2013
Offline

cool thanks but being less of a twat that i am about it my friend told my newbish self to use % before and after $filename in my sql query works a lot easier lol but thats good for future refernce :)

August 15, 2013
4:07 pm
Riddick
Member
Forum Posts: 15
Member Since:
February 2, 2013
Offline

side note do you know anything about api's?? particularly the "TMDB api" ?? :)

August 15, 2013
5:28 pm
Alexander
Member
Forum Posts: 12
Member Since:
March 10, 2013
Offline

Lately I'm working with AngularJS on another website, which has it's own JSON api.
But I don't know what kinda mashup ur working on :P

August 15, 2013
5:36 pm
Riddick
Member
Forum Posts: 15
Member Since:
February 2, 2013
Offline

im just trying to make a small website for personal use that i can use for a movies database. just gonna use the api to update the database with the movie info… im just a complete novice when it comes to this stuff but only one way to learn :P

THE FUCKIN HARD WAY!!

August 16, 2013
8:21 am
brasshat
Shropshire, UK
Admin
Forum Posts: 47
Member Since:
February 9, 2013
Offline

What about writing a custom type for Wordpress to do this? You'll still need to learn the PHP but it at least encapsulates the MySQL and makes it one less thing for you to learn.

August 16, 2013
8:40 am
Riddick
Member
Forum Posts: 15
Member Since:
February 2, 2013
Offline

not as fun as the deep end lol… im slowly learning a little php and mysql but i wanna get this api sorted so then i can finnally finish off my database for my movies. i have a lot of them lol and yes i know there are programs to do this for me i used one to make the original database but they dont look how i want them too on the front end :)

Forum Timezone: UTC 0

Most Users Ever Online: 44

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

CooterTheAnimal: 38

Krissmaister: 31

Turtle: 25

widlebowski: 21

Tony: 19

Missy: 17

Riddick: 15

kick: 15

Bullseye: 14

Illdisposed: 12

Member Stats:

Guest Posters: 0

Members: 8075

Moderators: 3

Admins: 4

Forum Stats:

Groups: 4

Forums: 19

Topics: 129

Posts: 547

Newest Members: HarrietKen, dixiesg11, AdrianVed, Herthalierm, joshuaev4, Scannerbgw, Kevincough, Scoots, sonjaab16, brandongq16

Moderators: ken (57), weasel (11), MossY_DoG (2)

Administrators: admin (2), brasshat (47), Singular Perpous (34), swampyjim (64)