Jump to content

awjudd

Staff Alumni
  • Posts

    422
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by awjudd

  1. The WHERE clause below should capture what you are looking for.  Use it as the SELECT first to see if it hits everything that you want it to and nothing more, and then you can throw it onto a DELETE.

     

    SELECT * FROM `emailtest` WHERE emailaddress REGEXP '[a-z]\.[a-z]+[0-9]{6}@.*'

     

    ~awjudd

  2. You are missing brackets, so the order of operations isn't working as you wanted.

     

    $query="SELECT * FROM products WHERE live = 1 AND (title LIKE '%$term%' OR description LIKE '%$term%') ORDER BY id DESC";
    

     

    ~awjudd

  3. Given that the issue could be anywhere in your code, I am extremely doubtful that anyone is willing to go through (and jump through hoops while doing it) snippets of source code provide one at a time on a forum.  If there is anyone out there willing to do that ... well you have more patience that I do.

     

    So either learn PHP and figure it out yourself or hire someone to do it for you.

     

    ~awjudd

  4. You can't use AS in your VALUES clause for an INSERT statement.

     

    $sql ="
    INSERT INTO `confirmedorder` (customerid, Prodid, Prodname, pricelb,quantity,price, ordervalue)
    VALUES ($customerid,$prodid[$i], '$prodname[$i]','$pricelb[$i]', $quantity[$i],$price[$i], " . $quantity[$i] * $price[$i] . " )
    ";
    $this->db->query($sql); 
    

     

    ~awjudd

  5. From what I'm seeing is that I cannot load products or users, The code should be good, I am not seeing any problems in it but I might be wrong so I posted it here, The code used to work on php4 so I don't know, what other information do you need to have?

    Thanks,

     

    The actual code.

     

    ~awjudd

  6. That notice means that you have a variable 'sumordered' (in the code $sumordered) on line 640 of bestelkop.php which is being used without a value being assigned to it.  This is just an informational message.

     

    I just re-read your first post and you do have or die(mysql_error()) so you should actually be fine without that.  If you aren't getting any errors there, then you are connecting to the database correctly but something else in the code isn't working as planned.

     

    There were a lot of changes to PHP between PHP4 and PHP5 so I'm guessing you have the use of something that is deprecated.

     

    ~awjudd

  7. You build the query dynamically.

     

    $words=explode(' ', 'foo bar');
    
    $query='SELECT * FROM inventory ';
    $combine=' WHERE ';
    
    foreach($words as $word)
    {
        $query .= $combine . " ( title LIKE '%" . $word . "%' or description LIKE '%" . $word . "%' )";
        $combine=' AND ';
    }
    
    echo $query;
    

     

    ~awjudd

  8. I believe that technically you could use a variable and a case statement but that isn't what the database is made for ... so it is a bad idea!

     

    ~awjudd

  9. In order to do what you want, you would have to first get a list of all of the tables in your database and then with that list, build a bunch of queries and run those off separately.  That said, this is an absolutely horrible idea.  This is going to be slow and completely defies the purpose of storing things in tables.  If you need to search on something, then there should be a metadata table or something which all of these link to.

     

    ~awjudd

  10. You need to use the actual database commands to run the update.

     

    <?php
    
    $con = mysql_connect("localhost","nawacl_rich","Berrysweet83");
    if (!$con)
       {
       die('Could not connect: ' . mysql_error());
       }
    
    mysql_select_db("nawacl_singleparent", $con);
    
    $result = mysql_query("SELECT username, user_id FROM bx_users");
    
    while($row = mysql_fetch_array($result))
    {
    mysql_query("UPDATE Profiles SET ID=".$row['userid'].", NickName='".$row['username']."'") ;  // <--------------------  This is line #15
    }
    mysql_close($con);
    ?>

     

    ~awjudd

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