AE117 Posted September 28, 2009 Share Posted September 28, 2009 So as everyone knows when you make a Query Select From Where etc.. the results pull in a list as such 0 - result 1 1 - result 2 ect... Is there a way to make the results start at 1?? And no this is not a problem with Auto Increament in a Table. I need the actually query to start at 1. Thank You Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/ Share on other sites More sharing options...
Zane Posted September 28, 2009 Share Posted September 28, 2009 can you elaborate a little more.. do you mean you want $row[0] to be $row[1]? Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926190 Share on other sites More sharing options...
AE117 Posted September 28, 2009 Author Share Posted September 28, 2009 Yes so instead of the results show as 0 = result 1 1 = result 2 i want it to show 1 = result 1 2 = result 2 I really dont even know if this is possible the more I look into it Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926213 Share on other sites More sharing options...
Zane Posted September 28, 2009 Share Posted September 28, 2009 why would you want to do that in the first place Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926215 Share on other sites More sharing options...
AE117 Posted September 28, 2009 Author Share Posted September 28, 2009 because there is a code I wrote that starts only at 1 because it can not see 0 as a real integer so it will ignore it. Hence everything that it sees starts at one and any code that interacts with this particular set also needs to start at 1. Yes I know, but the other code only works if it starts at 1. I cant even think of a work around for it if starting at 1 isnt a possibility.... Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926225 Share on other sites More sharing options...
Zane Posted September 28, 2009 Share Posted September 28, 2009 $yourFilledArray[] = "blank entry"; for($i=0;$i $yourFilledArray[$i] = $i++; array_shift($yourFilledArray); could work. EDIT: scratch that. EDIT2:Ok..I've done my good deed for the day $someArray = range(1, 100); function PushDownArray(&$row) { $row[] = null; for($i=0;$i} PushDownArray($someArray); echo "",print_r($someArray),""; ?> Executes in 0.0037 seconds Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926229 Share on other sites More sharing options...
AE117 Posted September 28, 2009 Author Share Posted September 28, 2009 O yes make it flow into an Array now why didnt I think of that must be staring at the code for to long. I do appreciate the help Thanks Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926513 Share on other sites More sharing options...
Alex Posted September 28, 2009 Share Posted September 28, 2009 Why not just use array_unshift()? Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926517 Share on other sites More sharing options...
Zane Posted September 29, 2009 Share Posted September 29, 2009 Why not just use array_unshift()? well I'll be damned... Quote Link to comment https://forums.phpfreaks.com/topic/175752-make-query-start-at-1-and-not-0/#findComment-926792 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.