English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi,

I need to run this query when a text link is clicked, then reload the current page, how can I do it:

$query= mysql_query("UPDATE tags SET approved_tag_flag = '1' WHERE tag_id = '$page'");

I NEED TO DO IT BY POST METHOD THO

Thanks

2007-08-13 09:00:31 · 3 answers · asked by jeff lemon 1 in Computers & Internet Programming & Design

3 answers

You want to POST to the server in response to response to a clicking on a hyperlink?

That's going to require XmlHttpRequest, or remote scripting with iframes, or somesuch.

Does it really have to be a POST? Is the action non-idempotent?

And I sincerely hope you'll be using mysqli_real_escape_string() or similar on $page ....

And how is this thing going to degrade gracefully?

2007-08-13 09:11:54 · answer #1 · answered by John Dee 5 · 0 1

You still at it? Seems to me that we are developing the project for you...
This time, your question is very unclear, but you already have some faults:
1. An "UPDATE" command does not return any data, so the
"$query=" is not required.
2. Use the proper way:
$query = "UPDATE `tags` SET `approved_tag_flag` = '1' WHERE `tag_id` = '$page'"; // define your query
// now pass your query and make sure you return a fault if there is one:
mysql_query($query) or die("Query failed : " . mysql_error());
// the "or die()" returns a fault if fail.

As to make the query...
You said "onclick()", so you probably use javascript.
You said "on a text link". A text link needs Anchors, so I guess you have
link