PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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 -
<?
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) {
?>
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?
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]
That will show you what is going to be sent, I am assuming that there is a problem with $M_Code as the query itself looks okay. What data type is the code field?