Jump to content

really need some help...


lilwing

Recommended Posts

well i have this search query, it returns results by title and a little bit of the article. each article has a number id.

 

i want the links to take you to a page where you can edit the article. i have the edit page, but i don't know how to link to it so that you're editing the query you selected from the search.

 

i am stumped.

 

please help!

Link to comment
https://forums.phpfreaks.com/topic/67109-really-need-some-help/
Share on other sites

I think you have got a page that could be used to edit the content of the retrieved info. Let's assume that the page is named as edit.php. Then on the link (that will take u to this page), specify the path as <a href="edit.php?id=4">Link</a>. Then in the edit.php page use $id=$_GET['id'] method to access the id no. Then, write a query that will retrieve the info identified by the id. It could look like. $SQL="SELECT * FROM tblSample WHERE id=".$id;

 

Hope this will help

Link to comment
https://forums.phpfreaks.com/topic/67109-really-need-some-help/#findComment-336586
Share on other sites

that made it a little more clear, but i don't think i described my situation well:

 

so there is a database with 4 fields; id, updated_by, date, pagecontent. the id is autoincremented, updated_by is the person who updated it, date is the date it was last modified, and pagecontent is what is displayed on the website.

 

the search query searches by date, with the 'LIKE' clause. it returns results, the date is the heading and it displays a little of the pagecontent.

 

i'd like to make the heading into a link, programmed similar with the edit.php?id=4, but i would like that to be this:

 

edit.php?id=[dependent variable that changes according to the id assigned to the row of the result that is selected]

 

but i am not sure how to make it a dependent variable.

Link to comment
https://forums.phpfreaks.com/topic/67109-really-need-some-help/#findComment-336600
Share on other sites

ran into another problem.

 

on the edit page, i have this:

 

$id = $_GET['id'];
$table2 = $_GET['$table'];

$sql = "SELECT pagecontent FROM $table2 WHERE id = $id";
$query = mysql_query($sql);

while($row = mysql_fetch_array($query))
{
$current = $row['pagecontent'];
echo $current;
}

 

i keep getting the error that mysql_fetch_array(); is not a valid mysql resource. i think that the problem is my WHERE argument..

Link to comment
https://forums.phpfreaks.com/topic/67109-really-need-some-help/#findComment-337872
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.