nickbunyun Posted June 18, 2008 Author Share Posted June 18, 2008 ok.. no heres the thing I have to add/remove rows in the data base. and id is auto increment. This is how it looks now db Row 1 = viewfull.php?full=1 db Row 2 = viewfull.php?full=2 db Row 4 = viewfull.php?full=3 db Row 9 = viewfull.php?full=4 db Row 12 = viewfull.php?full=5 db Row 20 = viewfull.php?full=6 but when its viewing the php, it shows that when i click on "VIEW" (link viewfull.php?full=20), it shows it empty, but when i got to viewfull.php?full=6 than it shows the contents of my 20th db row. Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-568070 Share on other sites More sharing options...
nickbunyun Posted June 18, 2008 Author Share Posted June 18, 2008 a little bump help Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-568430 Share on other sites More sharing options...
kmark Posted June 18, 2008 Share Posted June 18, 2008 your link should read: print '<a href="viewfull.php?id='.$row['therowID'].'">View</a>'; its currently using the counter not the ID Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-568469 Share on other sites More sharing options...
nickbunyun Posted June 19, 2008 Author Share Posted June 19, 2008 ya it does.. echo "<tr><td>$r[date]</td> <td>$r[zipcode]</td> <td> <a href=viewfull.php?full=$r[id] target='_blank'>View</a> || Delete </td> </tr>"; on my View (where it shows only zipcode, id, and "view button) it all works perfectly i have ID ZIP TOOLS 1 45123 View (links to viewfull.php?full=1) 3 45123 View (links to viewfull.php?full=3) 5 45123 View (links to viewfull.php?full=5) 11 45123 View (links to viewfull.php?full=11) 21 45123 View (links to viewfull.php?full=21) But When I go to viewfull.php?full... viewfull.php?full=1 >> echoes from ROW ID 1 viewfull.php?full=2 >> echoes from ROW ID 3 viewfull.php?full=3 >> echoes from ROW ID 4 viewfull.php?full=4 >> echoes from ROW ID 11 viewfull.php?full=5 >> echoes from ROW ID 21 If i only have 5 rows, and the #s are , 1,3,4,11,21 .... it will have be shown as full=1,2,3,4,5 if i go to full=11, 21 (a number higher than the # of rows) it shows empty. Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-569072 Share on other sites More sharing options...
hansford Posted June 19, 2008 Share Posted June 19, 2008 Change the ID's in the database it will save you alot of headache down the road. And then when you have to delete a record make sure that all the other record ID's get updated, so the ID's will never be out of sync Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-569143 Share on other sites More sharing options...
nickbunyun Posted June 19, 2008 Author Share Posted June 19, 2008 yeah but how do i do that to change automatically ? if i have like 80 rows, and i delete row 20, i do not wanna go thru 59 rows of change Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-569172 Share on other sites More sharing options...
ag3nt42 Posted June 19, 2008 Share Posted June 19, 2008 maybe if you setup all the rows individually.. with their own queries.. then one will not effect the other.. that should let u be able to delete and add as you plz Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-569181 Share on other sites More sharing options...
hansford Posted June 20, 2008 Share Posted June 20, 2008 //make DB connection //delete row $query = "SELECT * FROM 'tablename'"; $result = mysql_query($query); $id_array = array(); while($row = mysql_fetch_array($result)){ $id_array[] = $row['id']; } $count = 1; foreach($id_array as $key){ $query = "UPDATE `xxmembersxx` SET `id` = '$count' WHERE `xxmembersxx`.`id` = '$key'"; mysql_query($query); $count++; } Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-569855 Share on other sites More sharing options...
nickbunyun Posted June 20, 2008 Author Share Posted June 20, 2008 thats when deleting right ?.. but quick question, this is gonna be a "feedback" a guestbook form. Ppl are gonna put their infos in, and im gonna have to echo them out. its not gonna be a dynamic cms or anything like that.. so wouldnt it be easier just to fix the thing that doesnt echo the right thing? btw, I'd like to thank both of u to actually dedicate time to help me, sry if i dont explain things as well. Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-570246 Share on other sites More sharing options...
ThunderAI Posted June 20, 2008 Share Posted June 20, 2008 I personaly dont understand why you would not use ajax for this type of setup. That or the simple $_GET['id'] to another target window. Or better yet, a hidden div layer that when unhidden will display the contents of that row. Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-570252 Share on other sites More sharing options...
nickbunyun Posted June 20, 2008 Author Share Posted June 20, 2008 can u explain a lil more the ajax function.. and i do use the get[id] and it shows.. but it shows by # of rows, not by the actual row#. Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-570274 Share on other sites More sharing options...
hansford Posted June 20, 2008 Share Posted June 20, 2008 I would get some more practice and get this working before you leap into ajax -which isn't difficult, but still requires some learning time. Before you echo out your links you should know what $r[] contains. If need be, you query your DB and get all the ID's and store them in an array and then echo out your links with the array. then the link is always what it says it is. If a row gets deleted you need the code in place to get a new array and echo out new links. <a href='viewfull.php?full=' . $r[] . ">view row" . $r[] . "</a>" Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-570332 Share on other sites More sharing options...
nickbunyun Posted June 23, 2008 Author Share Posted June 23, 2008 how do i go about getting each row as an array everytime i open the page is loaded? Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-572282 Share on other sites More sharing options...
nickbunyun Posted June 24, 2008 Author Share Posted June 24, 2008 Bumpy Bump.. Quote Link to comment https://forums.phpfreaks.com/topic/109749-display-more-on-click/page/2/#findComment-573542 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.