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