| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Oct 2003
Posts: 3,472
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Whats wrong with this? (searching database for specific id) This is the code which im having problems with (its not all the code, so i am not missing the <?php, or a }) Code: $sql_query = "SELECT * FROM links WHERE id='$id'";
//store the SQL query in the result variable
$result = mysql_query($sql_query);
if(mysql_num_rows($result))
{
//output as long as there are still available fields
while($row = mysql_fetch_array($result))
{
$title = $row["title"];
$url = $row["url"];
$id = $row["id"];
$status = $row["status"];
$email = $row["email"];
} Im trying to get it to let you edit the information in the 'links' part of the database. The page before has this code: Code: <a href=\"editlink.php?id=$id\">Edit</a> |
| |
| | #2 (permalink) |
| NamePros Regular Join Date: Mar 2006
Posts: 780
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Try this: <a href=\"editlink.php?id=<?= $id ?>\">Edit</a>
__________________ EKED.COM BDPU.COM FFHF.COM BXNN.COM SFUZ.COM OOHH.NET EOEI.COM NSTO.COM SPMQ.COM CODV.COM - Pm Offers "What doesn't kill you only makes you stronger..." |
| |
| | #3 (permalink) |
| NamePros Regular Join Date: Apr 2004 Location: NL
Posts: 808
![]() ![]() ![]() ![]() | aren't you forgetting to get the id from the link? try this query PHP Code: PHP Code: |
| |
| | THREAD STARTER #4 (permalink) | ||||
| Senior Member Join Date: Oct 2003
Posts: 3,472
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Haha, thanks slewey, i knew it was something to do with that line. Rep added. I see the rep also got you another green bar | ||||
| |
| | #6 (permalink) | ||||
| NamePros Regular Join Date: Apr 2004 Location: NL
Posts: 808
![]() ![]() ![]() ![]() |
| ||||
| |