mikosiko
-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Posts posted by mikosiko
-
-
-
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
-
In that code you have 2 issues:
1.- You can not mix mysql_ and mysqli_ APIs
2.- mysqli_query() (and in general all the "mysqli_" procedural methods/functions) need to have the database link as a parameter.... read http://php.net/manual/en/mysqli.query.php
here are some usage's examples http://php.net/manual/en/mysqli-result.fetch-array.php
-
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)?
-
In case you are willing to explore the alternative Mysql also provide the FEDERATE storage engine to solve your scenario
https://dev.mysql.com/doc/refman/5.5/en/federated-storage-engine.html
-
In your code you are using the variable $conn as your database connection for both your SELECT and for the INSERT. as mac_gyver mentioned before you should be using 2 different variable names for your database connections and use them in the right place
-
If you go directly to that directory look for the laravel.bat or similar an try to execute it there... The error message is clear enough... Did you try restarting your computer and try?
- 1
-
And you did this?
"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal."
- 1
-
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
-
$POST is not the same as $_POST
-
you are generating a <tbody>...</tbody> tags inside of your foreach loop... take those out of the loop and test
-
Are you sure that you are including the bootstrap CSS in your code, are you?
-
Obvious queations:
- are you sure that your sql query is executing correctly
- it is producing any results?
- what is the contain of $data after the loop?
- what is the contain after json_encode?
And last but not least
- where are you defining $outp?
-
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");
-
Do you have a table named post and other named posts ?
-
Read the error message that you are getting very...very..very carefully again... Reason is there in plain sight
-
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?..
-
Did you check if your $sql contain a valid INSERT sentence?
And in your query() function... What are you trying to do in this line
If ($this->_query = $this->_pdo->prepare($sql))
a comparison or an assignment?
-
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
-
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?...
-
......
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.
-
@Texan78 .... Try testing that code with $magnitude = 0 and see what do you get
Edit: Psycho gave you the reasoning behind
-
There's a way to avoid this loop?
Yes and No..Well, it is way to eliminate the extra prepare/execute/query inside the loop.. use a JOIN between the 2 tables, get the resultset of that JOIN and traverse (with a loop) it to produce your JSON in the format that you want/need
-
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
Welcome Back!
in Announcements
Posted
Finally!!... good to have it back