benanamen Posted July 21, 2022 Share Posted July 21, 2022 (edited) 9 minutes ago, cyberRobot said: First, I should mention I'm with requinix about NOT needing to pull in every customer ID. Surprised you are saying that. It makes no sense to select the ENTIRE database table when all you want is to edit one SPECIFIC Id record. Edited July 21, 2022 by benanamen Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted July 21, 2022 Share Posted July 21, 2022 6 minutes ago, benanamen said: Surprised you are saying that. It makes no sense to select the ENTIRE database when all you want is to edit a SPECIFIC Id. No we're saying the same thing. The OP doesn't need all the entries. EDIT: I modified my post to hopefully make that clearer. 1 Quote Link to comment Share on other sites More sharing options...
benanamen Posted July 21, 2022 Share Posted July 21, 2022 Just now, cyberRobot said: No we're saying the same thing. The OP doesn't need all the entries. Ok, I agree. @requinix was saying the same thing. 1 hour ago, requinix said: If you have an ID and want to make sure it exists then what you do is execute a query to see if there are rows matching that ID. You do not retrieve every single one. That's terribly, terribly inefficient. Quote Link to comment Share on other sites More sharing options...
phppup Posted July 21, 2022 Share Posted July 21, 2022 (edited) I said $sql = "SELECT id FROM yourTable"; instead of $sql = "SELECT * FROM yourTable"; But I guess what I REALLY should post is $sql = "SELECT id FROM yourTable WHERE id = $yourValue "; I think it would have been more helpful (especially to the initial poster) if @benanamen would have shown the correction as a way to advance progress to a solution Edited July 21, 2022 by phppup Quote Link to comment Share on other sites More sharing options...
benanamen Posted July 21, 2022 Share Posted July 21, 2022 (edited) 9 minutes ago, phppup said: I think it would have been more helpful (especially to the initial poster) if @benanamen would have shown the correction as a way to advance progress to a solution You obviously haven't read the whole thread. I showed EXACTLY that.https://forums.phpfreaks.com/topic/315071-sending-visitors-to-an-error-page/?do=findComment&comment=1598471 And at no point in this thread was there ever any mention of SELECT * so there is no "instead of", but now it is just pointless arguing. OP has been given the solution. Â Edited July 21, 2022 by benanamen Quote Link to comment Share on other sites More sharing options...
webdeveloper123 Posted July 22, 2022 Author Share Posted July 22, 2022 ok the consensus seems to be go down the WHERE route, If ID exits take them to the edit form, if not display error or error page thank you Quote Link to comment Share on other sites More sharing options...
webdeveloper123 Posted July 22, 2022 Author Share Posted July 22, 2022 Hey thanks guys, I did it! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.