Results 1 to 2 of 2

Thread: MySQL command?

  1. #1
    Join Date
    Aug 2001
    Location
    Toronto, Ontario
    Posts
    678

    Default MySQL command?

    Anyone know how to tell the mysql database to add 100 hits to each link? Cause I really dont' want to go in and edit each link one by one. Thanks

    Hart

  2. #2
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    211

    Default

    I guess it can't be done in a single command. You have to save the current hits in a variable and add it with 100. Also the records need to be fetched one by one, because the values could be different.
    This code can be an alternative, but not using Indexu's style - accessing the class file

    $query="SELECT * FROM idx_link";
    $result=mysql_query($query);
    $num_rows=mysql_num_rows($result);
    for ($i=0;$i<$num_rows;$i++) {
    $link_id=mysql_result($result,$i,"link_id");
    $hits=mysql_result($result,$i,"hits");
    $hits=$hits+100;
    $query2="UPDATE idx_link SET hits=$hits WHERE link_id=$link_id";
    $result2=mysql_query($query2);
    }

    I hope it can help.

    Sofiah

    Last edited by sofiah; 04-16-2002 at 09:39 AM.

Similar Threads

  1. Mysql import of e-mails ?
    By lewisw in forum v3.2
    Replies: 0
    Last Post: 08-20-2003, 08:10 PM
  2. Do you have to run MySQL 4x for IndexU 3.1?
    By Frisk151 in forum Pre-Sales Questions
    Replies: 3
    Last Post: 08-04-2003, 08:50 PM
  3. indexu 3.1 & mysql 3.22
    By Heiko in forum v5.x
    Replies: 26
    Last Post: 07-07-2003, 04:30 PM
  4. remotely hosted mySQL
    By miletic in forum Pre-Sales Questions
    Replies: 1
    Last Post: 10-21-2002, 12:07 PM
  5. Can not edit users in the mysql
    By xxl in forum v5.x
    Replies: 0
    Last Post: 01-27-2002, 07:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •