Hallo allemaal
ik was bezig met top40 systeem waar mensen kunen stemmen maar ik moet ook nummers in hebben natuurlijk.
mijn vraag is hoe kan je in 1 x de hele muziek lijst in je query zetten.
hieronder zie je de code naar mijn doen (doet het niet).
bij id moet niks ingevult worden.


<?php
mysql_query("INSERT INTO muziek (id,auteur,singel) VALUES('','The Opposites','Dom, lomp & famous ')");
?>  
The Opposites - Dom, lomp & famous 
Abba - Mama mia 
David Guetta - Baby when the light 
Gebroeders ko - Duiken in de zee 
IOS - Hoofd Onder Water  
Linda,Roos & Jessica - Ademnood 
Stevie Wonder - I just called to say 
U2 - With Or Without You 
Nelly Furtado - Do it 
The Opposites - Me nikes 
U2 - Pride (In The Name Of Love) 
September - Cry for you 
Thomas berge - Jij bent mijn leven 
High school musical 2 - I gotta go my own way 
Bruce Springsteen - I'm On Fire 
Tess - Stupid 
Ilse de lange - I love you 
Lara - That's it baby 
Leona Lewis - Bleeding Love  
Appa - Ik heb schijt 
The Cranberries - Zombie (Techno Remix) 
Bruce Springsteen - Working On The Highway 
Kate Ryan - Voyage Voyage 
DJ Tiƫsto - Sweet things 
Fragma - Toca's miracle (Richard Durand Mix) 
Lucie Silvas - What you're made of 
Fergie - Big girls don't cry 
Madonna - La isla bonita 
Queen - Thank God It's Christmas 
Justin Timberlake & beyonce - Until the end of time 
Charlie Lownoise & Mental Theo - Wonderful Days  
Junkie XL - Fuck more 
Cascada - Lonley 
50cent - Window shopper 
The KLF - Justified & ancient 
Ernesto vs. Bastian - Thrill (Official trance energy anthem 2008) 
Simple Minds - Don't You Forget About Me 
Lupe Fiasco - Superstar  
Colbie Caillat - The Little Things 
The CrystallionZ - Sexy Mama  
Pat Benatar - Love Is A Battlefield 
Appa - Kijk door mijn ogen 
Armand van Helden - You dont know me 
David Guetta - Tomorrow can wait 
Led Zeppelin - Stairway To Heaven 
Leona Lewis - Bleeding love 
Sandy Rivera & Haze - Freak 
Seal - Amazing 
Crazy Cats - Sloop John B  
Will.I.Am - I got it from my mama 
Gary Moore - Still Got The Blues 
Bruce Springsteen - Born To Run 
Simpley Red - Holding back the years 
Scooter - Jumping All Over The World  
Timbaland ft. Keri Hilson & Nicole Scherzinger - Scream 
Deep Dish - Flashdance 
Sugababes - Change 
Snoop Dogg - Drop it like it's hot 
Ali B - Groupie love 
Red Hot Chili Peppers - Under The Bridge 
Scooter - The question is what is the question 
Faithless - Insomnia 
Colbie Caillat - Bubbly 
Roxette - Joyride 
Gio - Ik denk aan jou 
Alex C Ft. Y-Ass - Du hast den sch'nsten Arsch der Welt 
50cent - Candy shop 
Sugababes - About you now 
BZN - The banjo man 
Seal - Love's Divine 
Bob Marley - No woman no cry 
Mika - Happy ending 
Uniting Nations - Out of touch 
Mega Mindy - Toby Toby 
Cascada - Ready for love 
Ilse de lange - Great escape 
Jan Smit - Dan volg je haar benen 
Dire Straits - Sultans Of Swing  
Amy Winehouse - Back To Black International Deluxe Edition 
CRW - I Feel Love  
Vanvelzen - When summer ends 
Jumping Jacks - Your Smile  
30 Seconds To Mars - A Beautiful Lie  
Accu - In The City  
Yanou feat. Mark Daviz - A girl like you  
John Farnham - You're The Voice  
Priscilla - It's Christmas Time  
Carlos - Alanda 
Pet shop boys - Go west 
Prince - Money dont matter 2 night 
Cascada - Bad Boy 
Jannes - Ga maar weg 
Toto - Stop loving you 
Cascada - Endless Summer 
Celine dion - Titanic 
Timbaland feat. One Republic - Apologize 
Nicole Scherzinger - Baby love 
I'd Lie For You (And That's The Truth) - Meat Loaf  
Gebroeders ko - Boten anna 

INSERT INTO 
  muziek (
    auteur,
    singel
  ) 
VALUES(
  'The Opposites',
  'Dom, lomp & famous'
)

Dan laat je hem toch weg?



bij id moet niks ingevult worden.

Niks is in sql iets anders dan ''.
'' is een lege string
NULL is niks

Maar zoals Frank al zei, je laat 'm beter weg.

Hoe bedoel je met die lijst, je wil die met 1 query in de database invoeren?
doet het niet :(

INSERT INTO muziek (id,auteur,singel) VALUES('','".$_POST['auteur']."','".$_POST['singel']."')


Doet het wel weet iemand oplossing ?
zoweiszo beter niet de $_POST in de query gebruiken.
stel je voor dat een artiest "karel's janens's" heet :)



$vote_auteur = $_POST['auteur'];
$vote_singel = $_POST['singel'];
INSERT INTO muziek (id,auteur,singel) VALUES('$vote_auteur','$vote_singel') 


Ook nog eens overzichtelijk =D
Nogmaals, wanneer je geen id wilt opgeven, laat de kolomnaam id dan weg en de lege/waardeloze waarde ook weg.

@Jouke: Doe wel iets aan beveiliging, jouw query loopt stuk op de eerste de beste quote ' in de tekst. mysql_real_escape_string() kan je hierbij helpen.

Reageren