Jump to content

toplay

Staff Alumni
  • Posts

    973
  • Joined

  • Last visited

    Never

Posts posted by toplay

  1. Post the $updatequery value here.

     

    How are you determining that it's not updating?

     

    Do:

    $result = mysql_query($updatequery);

    echo ($result) ? 'Update successful. Rows affected (if any): ' . mysql_affected_rows() : 'Did not update. Error: ' . mysql_error();

     

    Tell us the result.

     

     

    Note: MySQL will not update the row if it determines the values are the same (it's intelligent enough to know there's nothing different and no point in updating). So, if the values you're trying to update is already in the table for that tutid, then it won't update.

     

     

  2. ...I've made sure the variable names correspond with the HTML form names...

    That will only work if you have register_globals on. Keep it off and use $_GET or $_POST instead.

     

    You're already using $_GET['id'], so why aren't you doing it for the other fields? Or are you already usign $_GET and assigning it to those variables and you're just not showing us that?

     

    To help debug, display the $updatequery value before or after the mysql_query(). The SQL syntax shown in post looks correct.

     

     

    Note: Look into using mysql_real_escape_string() - always use especially with string values.

     

     

     

  3. You should state the bottom line of what you're trying to do. For instance, you can use fsockopen() or perhaps cURL instead (if available) of trying to install sockets.so.

     

    I doubt you can do what you want through godaddy (they're very limiting with their PHP). They're a great registrar, but I would never use them to host a web site.

     

    FYI: I highly recommend to host with these guys (starting at $4.95 USD):

    http://www.ixwebhosting.com/index.php/v2/pages.planBusinessPlus

     

  4. Try a query similar to this:

     

    select

              menu_name

            , link_name

            , link_href

            , link_target

     

    from  scm_menus

    join    scm_menu_links

    on      link_parent = menu_id

     

    order by  link_order ASC

     

     

    Just read each row from the result to build the array however you want it to be.

     

    Note: The link_parent should be the same size as the menu_id. One should not be int(10) and the other int(11) (and whether negative allowed or not).

     

     

     

  5. It would have been easier if you just listed your join query so we can help with the syntax issue.

     

    I'm not sure what you mean exactly, but here is something to try:

     

    select

              pq.poll_id

            , sum(if(pa.answer = pq.answer1, 1, 0)) as total_for_answer_1

            , sum(if(pa.answer = pq.answer2, 1, 0)) as total_for_answer_2

            , sum(if(pa.answer = pq.answer3, 1, 0)) as total_for_answer_3

            , sum(if(pa.answer = pq.answer4, 1, 0)) as total_for_answer_4

            , sum(if(pa.answer = pq.answer5, 1, 0)) as total_for_answer_5

     

    from  pollquestions pq

    join    pollanswers pa

    using  (poll_id)

     

  6. You need to have a column name and not enclosed is single quotes where you have '$SearchCat'.

     

    So, remove the single quotes or use backtick marks like so:

     

    $query2 = "SELECT * FROM clients WHERE `$SearchCat` LIKE '$search2'";

     

    You already have the percent signs in $search2 so you should be good to go.

     

     

    FYI: Look into the use of mysql_real_escape_string():

     

    http://us3.php.net/manual/en/function.mysql-real-escape-string.php

  7.  

     

    By default, when no column list is provided at the end of the LOAD DATA INFILE statement, input lines are expected to contain a field for each table column. If you want to load only some of a table's columns, specify a column list:

     

    LOAD DATA INFILE 'persondata.txt' INTO TABLE persondata (col1,col2,...);

     

    You must also specify a column list if the order of the fields in the input file differs from the order of the columns in the table. Otherwise, MySQL cannot tell how to match input fields with table columns.

  8. Don't use a union and just join the tables. The way to do it depends on what data you want back. This is an example where it only displays info only on the customers that have ordered (it goes through the item_order table as the primary source).

     

    select

            c.cust_id, c.fname, c.lname, i.order_id, i.color, i.size, i.price, io.date

    from item_order io

    join item i using (order_id)

    join customer c using (cust_id)

    order by io.cust_id, io.order_id, i.item_id

    ;

     

     

     

  9. Specifying a date/time in the "WHERE" clause will be faster than MySQL executing a function (DATE_SUB) every time.

     

    FYI - extra info: Even if a column like SignupDate had a key/index MySQL may or likely would not use the index if used in a function (i.e. DATE_SUB(SignupDate...)).

     

  10. Don't forget the percent signs. Try something like this:

     

    $sql="SELECT m.login, m.email, p.distributornr FROM `amember_members` m LEFT JOIN `profile` p USING (member_id) WHERE m.login LIKE '%$search%' OR p.distributornr LIKE '%$search%' OR m.email LIKE '%$search%'";

     

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