PDA

View Full Version : Create an ID?



adamFTW
12-12-2007, 09:41 PM
I have the following code, the only problem with it: I can't get the ID of the entry.


<?php
// The database connetcion
include "config.php";

//Variables for mySQL
$comment = ($_POST[comment]);
$name = ($_POST[name]);
$grade = ($_POST[grade]);
$id = $get_id[id];
$get_current = mysql_fetch_array(mysql_query("select comment, grade, name, id from petition where id = '$id'"));

// mySQL
mysql_query("update petition set name = '$name' where id = '$id', update petition set grade = '$grade' where id = '$id', update petition set comment = '$comment' where id = '$id'");
$get_id = mysql_fetch_array(mysql_query("select id from petition"));
$sql = "SELECT * FROM petition";
$check = mysql_query("SELECT name, grade, comment FROM petition") or die("Sorry, the data couldn't be displayed. Please check back later.");

//Other crap

while ($display = mysql_fetch_array($check)) {

$name = $display['name'];
$grade = $display['grade'];
$comment = $display['comment'];

// Above are variables defined for our Name, Gradeand Comment.

echo "
<strong>Name:</strong> $name
<br>
<strong>Edit:</strong> <a href=\"editcomment.php?id={$get_current["id"]}\">edit this comment</a>
<br>
<strong>Grade / Other:</strong> $grade
<br>
<strong>Comment:</strong><br>$comment
<br>
__________________________________________________ __________<br /><br />
";

}
?>Could someone maybe make it so it gets the ID of the entry? As right now, it just links to: /comment.php?id=

Florx
12-12-2007, 09:48 PM
Why create a new thread for something that you already have a thread for?

adamFTW
12-12-2007, 09:58 PM
The other thread is somehting differne,t I am asking for someone to edit the code for an ID.

Florx
12-12-2007, 10:05 PM
You also asked in that thread about the ID thing.

adamFTW
12-12-2007, 10:11 PM
Ok, cool?

Is there anybody who has a clue what i'm talking about, and if you do is it possible to add to that code?

Want to hide these adverts? Register an account for free!