trying to add +1 to a database column
Posted: Tue Mar 06, 2007 2:31 am
feyd | Please use
the mysql query works fine when run in phpmyadmin. The error page itself works fine with the update query added, but it seems as if the update query is just being ignored. can anyone help?
many thanks
Karf
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello all. i have written a script that searches for entries in a database column, and then displays all the values from other columns. specifically, it is an error code search, which returns error code meanings and actions and so on.
what i'm trying to do is to make the search results add 1 into another column for the purpose of reporting to see how many times a code has been searched for.
the code i have is below -Code: Select all
<?
if (isset($_POST['sumbitted'])) {
if (!empty($_POST['code'])) {
$M_Code =escape_data($_POST['code']);
$query2 ="UPDATE error SET search_num = search_num +1 WHERE code LIKE '%$M_Code%'";
$result2 = @mysql_query ($query2);
$query = "SELECT * from error Where code LIKE '%$M_Code%'";
$result = @mysql_query ($query);
if ($result) {
$num_rows = mysql_num_rows($result);
if ($num_rows >0) {
?>many thanks
Karf
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]