Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by mikosiko

  1. I have two tables that I'm trying to compare. I need to find items that are in tmp_BF and not in ps_product_supplier.

     

    I'm using:

     

    SELECT * FROM ps_product_supplier WHERE ps_product_supplier.product_supplier_reference NOT IN (SELECT supplier_reference FROM tmp_BF);
    

     

    Read carefully what you wrote (in red) and compare it with what you are doing in your select... you should be able to figure it out

  2. food for the thought: (meaning for you to read and investigate the causes of the error and do not create a worst bandaid)

     

    http://dev.mysql.com/doc/refman/5.6/en/gone-away.html

    http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout

    http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_max_allowed_packet

     

    and a question: What type/size are your columns called SName (in both tables)?

  3. Are you using this code just as a learning exercise and for one time execution? (hope so) or are you planning using it to create a database and associated table(s) for Each project?

    If the lastest is the case then IMHO you are using an incorrect approach, you should have only one database and define your tables to manage multiples projects/rfis

  4. After modifying the php.ini did you restarted the Web server? (Apache or whatever)

     

    You don't notice anything missing in this line?

    $my_db = "notes_db"

     

    And in this one.. Is that exactly what you wrote using string literals or your were trying to use the previously defined variables? (like $my_host or $my_user, etc.)

    $con = mysqli_connect("localhost","my_user","my_password","my_db");

  5. In addition to what boompa pointed out your whole code logic doesn't make to much sense... You need to rethink it.

    Your sales-authorisation table is going to have only one record or many?

    Is there any relation between the sales-authorisation and the order, each order item or it is applied globally?

    Do you realize that you could be updating your order over and over in the inner loop?, and for each order item?..

  6.  

    Yeah, I had thought about using count. Seems like an awkward method since I assume the number of Types would be variable.

     

    But, is the sub-query required in that statement. Would this work

    SELECT s.shoe_id, s.shoe_name
    FROM shoe s
    JOIN shoe_type st
      ON s.shoe_id = st.shoe_id
      AND st.type_id IN (1,3)
    GROUP BY shoe_id
    WHERE COUNT(s.shoe_id) = 2

    you mean HAVING COUNT(s.shoe_id) = 2 right?.... sure was a typo

  7. could you post a REAL example of the content of modsToBeChecked ?

     

    An Internal Server error normally is logged... are you sure that you are looking the right logs files?

     

    The last code that you posted works fine on testing, therefore seems that the POSTED code is not the issue here. Are you psoting the WHOLE code that you are using?...

  8.  

    ......

     

    PHP Code:

    	// Define an insert query
    	$sql = "INSERT INTO `users` ('Workout','first_name','last_name','gender','Email_Address','Password','User_Age')
    	VALUES
    	($YesOrNo,$fname,$lname,$Gender,$email,$Password,$UserAge)";
    
    

     

    Sure that you don't see anything wrong in your INSERT sentence?....

     

    You are enclosing all the field names using single quotes which make the sentence invalid ... you would have noticed that with the proper error_reporting and display_error setup either in your php.ini (prefered) or directly in your code adding this 2 lines after your opening <?php tag:

       // Define how to display/report errors
       ini_set("display_errors", "1");
       error_reporting(-1);

    maybe you tried to enclose your fieldname on backticks (`) but that is absolutely unneccesary if you are not using reservated mysql words or other special identifiers.

     

    An additional note: Using the values of your $_POST variables directly in your query make your code fully open to SQL Injections, you should be using Prepared sentences and be sure that PDO is using real ones and not emulating preparated sentences which leave you in the same spot that your code is now.... for real Prepared sentences be sure to include

     PDO::ATTR_EMULATE_PREPARES => false in the options of your PDO definition.

  9. Read what we have said before your post

    NO... your code have changed several times before your first and subsequent posts... we are not seeing your screen, and we can't assume that you are getting the same errors or new ones... so either your provide ALL the current errors or people around here will not have means to "see" what is happening, and will still just guessing.

     

    read my post again and review what is there for you.

     

    good luck

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