Mancent Posted November 9, 2012 Share Posted November 9, 2012 I can not delete from where id = id. becasue that would delete all of them, I want to delete from table where id and name and fid == the same how would i do that can i do this with the delete DELETE FROM tablename WHERE id = ('$id') AND name =('$name') AND fid =('$fid') Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/ Share on other sites More sharing options...
MDCode Posted November 9, 2012 Share Posted November 9, 2012 DELETE FROM tablename WHERE id = ('$id') AND name =('$name') AND fid =('$fid') Yes you can, the parentheses serve no purpose though Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391374 Share on other sites More sharing options...
Mancent Posted November 9, 2012 Author Share Posted November 9, 2012 so would that only delete where the id = 1029384 and the name = some name and the fid = 2938575? and not delete all the id = 1029384 kinda like a select system inside the delete. Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391376 Share on other sites More sharing options...
MDCode Posted November 9, 2012 Share Posted November 9, 2012 Yes Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391377 Share on other sites More sharing options...
Mancent Posted November 9, 2012 Author Share Posted November 9, 2012 awesome cool. thank you. never tested it yet not that far i just wondered. Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391378 Share on other sites More sharing options...
Mancent Posted November 10, 2012 Author Share Posted November 10, 2012 For some reason its not deleting the data, been tracing it all out and the post being send is all correct. is my syntax wrong $Delete = mysql_query("DELETE FROM WiiS_Shared_Music WHERE UserId='$MyUserId' AND UserFId='$FbUserId' AND SongName='$SongName' AND SongUrl='$SongUrl'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391414 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 If there are no errors then there are no results that match your query Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391415 Share on other sites More sharing options...
Mancent Posted November 10, 2012 Author Share Posted November 10, 2012 mysql table WiiS_Shared_Music 100002957030150 Three Days Grace - Home http://wiistream.com/users/100001957015772/sounds/028d18dfa174315ef5dca7c006b815fd.wss 100001957015772 1 1 Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391417 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 Remove or die(mysql_error()); as well as the mysql_query() to leave only your query: $Delete = "DELETE FROM WiiS_Shared_Music WHERE UserId='$MyUserId' AND UserFId='$FbUserId' AND SongName='$SongName' AND SongUrl='$SongUrl'" Under that add echo $Delete; to show what you're looking for in the query Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391419 Share on other sites More sharing options...
Mancent Posted November 10, 2012 Author Share Posted November 10, 2012 UserId='$FbUserId' I had it backwards UserFId='$MyUserId' it works now Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391420 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 So it's solved? Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391421 Share on other sites More sharing options...
Mancent Posted November 10, 2012 Author Share Posted November 10, 2012 yes. Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391423 Share on other sites More sharing options...
Mancent Posted November 10, 2012 Author Share Posted November 10, 2012 yes for now, but the bad thing about this is its so unsecure if anyone knew the userid and the friend id and the song name song url they could delete any song from any user with out adding a join table that had a accesstoken, so it still needs more work, but the basic there. Link to comment https://forums.phpfreaks.com/topic/270518-delete-from-mysql-database-help/#findComment-1391426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.