Jump to content

Display more on click


nickbunyun

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

//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++;

}

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.