LLLLLLL
-
Posts
306 -
Joined
-
Last visited
Posts posted by LLLLLLL
-
-
Because this is how the application works. It's quite common to build queries out this way, even in MS-SQL.
-
Right... but my question is how to disable it? Something in php.ini? (This is a customer's server and a Windows box.)
-
It is as you would expect...
insert into some_table
( col_a, col_b, col_c )
values
( '1', 'this might be a string column', '123.00' )
And the error is clear:
Incorrect decimal value: '' for column col_a
-
On one customer website, the customer cannot insert any rows if a field is left blank and the column is a number. In short...
''
... is not being accepted for numeric or decimal columns.
I've never had this on any other customer site, and it's pretty standard to use '' for column values in by MySQL (and even MS-SQL).
What would be preventing this? I assume it's a MySQL setting somehow? For what it's worth, this customer is on a Windows server, much to my chagrin.
-
As mentioned above, not all servers have HTTP_ORIGIN enabled.
-
One response had the syntax as an example. One did not.
-
That's what I needed! Thanks. I didn't realize there was a second parameter option.
-
The function I've shown is on the client side. This is a sample generic function with param1 and param2 as the keys and specific values.
I want to create a generic JS function to handle all my AJAX calls, and I want to pass that function a list of key/values in an array. But how does that make the $.get syntax look?
-
Sorry, that's not really an answer that helps me. What does a function look like that creates this $.get call without hard-coded "param1" and "param2" key names?
$.get( "someurl.php", { param1: someVariableValue, param2: 'someHardCodedString' }, function( data ) {
-
This is a fairly typical piece of AJAX code...
$.get( "someurl.php", { param1: someVariableValue, param2: 'someHardCodedString' }, function( data ) {
On the back-end, PHP will receive $_GET with "param1" and "param2" keys, and the values as displayed above.
My question is if it's possible to set the name of the keys param1 and param2 dynamically. I'm looking for a way to have a single function make the ajax calls, and to do that I won't have hard-coded "param1" keys, but the keys will be generated from whatever code I'm using to make the call. (Does that make sense?)
Anyway, I am just looking for a way to set the keys of the GET (or POST) without hard-coding them on the page. Is this possible?
-
Not a CGI server, and it's hard to know what all customers may have. I guess * is the only way to go.
-
I don't have HTTP_ORIGIN in the requests. I've tested on my server and a couple customers. This won't work as a solution.
So two questions:
1) What is the expected format to list domains? Comma-separated? Space-separated? Some server setting that determines the separation? It should work.
2) Can I put multiple headers like this? Is it expected and/or good practice?
<?php
header("Access-Control-Allow-Origin: http://website.com");
header("Access-Control-Allow-Origin: http://www.website.com");
-
But how do I know the HTTP Origin? From what I undestand, $_SERVER[ 'HTTP_ORIGIN' ] isn't documented.
-
What is the correct syntax for listing multiple domains to be allowed for cross-domain AJAX calls? My code does this:
<?php header("Access-Control-Allow-Origin: http://website.com");
This works when website.com is the caller, but not when www.website.com is the caller. So I tried:
<?php header("Access-Control-Allow-Origin: http://website.com http://www.website.com");
... and...
<?php header("Access-Control-Allow-Origin: http://website.com, http://www.website.com");
But these things don't work. When I say they don't work, I mean that neither website.com nor www.website.com will be able to make the call with those configurations. So right now the only option is to put * and allow everything. I don't want to do that.
Is there another header directive or something that I need? I saw something about Access-Control-Allow-Headers: X-Requested-With but that didn't work either.
-
Search is not working at all for me. No error.
-
No, it was not aimed at you. It was aimed at the idiot who told me there was no passing by reference who made me start the thread. He sent me to a couple sites that made things unclear. I shouldn't have posted.
Also, I disagree with your premise, however. Every language offers this feature and it's there for a reason. There are times when you need to modify a variable in a function.
-
OK. I think maybe some server administrator just doesn't know what he's talking about, then.
I don't have any call-time references (I assume this only means where & is in front of the calling function parameter, rather than only in the function declaration). I think this server admin doesn't know much about PHP.
-
But what if I can't have that function return a variable?
-
If this was covered elsewhere on the forums, I apologize but search isn't working at all. So I'll ask potentially again...
function some_func( &$var ) { $var++; } $var = 1; some_func( $var ); // var is now 2
Now I see that 5.4 has removed passing by reference? This is a little crazy, frankly, since all other languages have this feature and developers need it. Regardless, what is considered the standard way of writing this type of function now that it's no longer possible to use my example code here?
-
I ALREADY PROVIDED THE SOLUTION.
If you want to show me up, that's fine. I'm not following this post. Congrats on your arrogance. Please calm down.
-
I already provided the answer. Don't be surprised that I don't need help when I've already provided the solution.
Please calm down.
-
1064. Anyway, the solution is:
update status as ds join orders_products op on ds.order_prod_id = op.id join orders o on op.order_id = o.id and o.guid = 'someGUID' set ds.status = 99
-
Getting error 1064 on this. I don't really understand why:
update ds set ds.status = 99 from status ds join orders_products op on ds.order_prod_id = op.id join orders o on op.order_id = o.id and o.guid = 'someGUID'
Trying to update fields in the "status" table when I know the GUID of an order.
Relationship:
ORDERS table
ORDERS_PRODUCTS table (fk to ORDERS)
STATUS table (fk to ORDERS_PRODUCTS)
What am I missing?
-
I don't understand. Can you clarify why it works on one site but not mine?
This is all the relevant code:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" type="text/css" media="screen and (max-width: 740px)" href="assets/css/style_m.css" />
<link rel="stylesheet" type="text/css" media="screen and (min-width: 741px) and (max-width: 900px)" href="assets/css/style.css" />
Normal Query Syntax Not Working, '' For Numeric
in MySQL Help
Posted
It is quite common to do this, and not wrong at all. If the application is building queries and doesn't know the column types, this is how to do it.