lalnfl
-
Posts
136 -
Joined
-
Last visited
Never
Posts posted by lalnfl
-
-
Javascript Code:
$(document).ready(function(){ // selecting worker if (!document.getElementById("worker_id").value){ document.getElementById("worker_content").innerHTML="<div class='inner_right'>Select a worker to view.</div>"; } $("#worker_id").change(function(){ if (!document.getElementById("worker_id").value){ document.getElementById("worker_content").innerHTML="<div class='inner_right'>Select a worker to view.</div>"; } else { var worker_id = $("#worker_id").val(); $.post("get_worker.php", {worker_id : worker_id}, function(data){ $("#worker_content").html(data); }); } }); // mark down / mark up $("#mark_up").click(function(){ var wage = $("#wage").val(); $("#wage_display").html(wage); }); });
Ajax Callback HTML part:
<input type='hidden' name='contract_wage' id='wage' value='$wage' /> <span id='wage_display'>$$wage</span> <input class='form' type='button' name='mark_up' id='mark_up' value='Mark Up' />
What is causing it to not function?
-
You could have saved a lot of time if you had actually checked what we suggested you check, rather than taking the short cut and looking at one table of the 3.
What do you mean? Everyone was set at INT, except for one of them, that I accidentally skipped.
Exactly right. requinix pointed out that the data types were a concern. We have know way of knowing what the data types were, but we assumed that you checked all of them, not one of three. In the future don't cut corners. That is the lesson that hopefully you will learn. Consistency is an important aspect of successful development practices. It doesn't matter to requinix or myself. Neither of us would have made the mistake you made.
Well excuse me, didn't know you had to be perfect. lol
-
Which brings us back to the fact that you have three identical tables. What's up with that?
Each one have different fields.
-
You could have saved a lot of time if you had actually checked what we suggested you check, rather than taking the short cut and looking at one table of the 3.
What do you mean? Everyone was set at INT, except for one of them, that I accidentally skipped.
-
Probably one of the ordered columns is not actually an int.
Son of a bitch. 2 hours and that is the problem. Thanks for your help gizmola.
-
After posting a re-looking at the code and then redoing it in the phpmyadmin sql query thing, it doesn't display correctly. And the reason is if I declare more than 2 UNION statements, it messes up the results.
Do you know why it does that?
-
So I go back to my original response. The implication is that there is something you are doing wrong in the code that displays the results.
Could it be because I am using parenthesis around each SELECT part (SELECT id, card_id, ordered FROM Match_1 WHERE card_id='$card_id') UNION (...
-
Yes it does.
-
-
Has nothing to do with PHP, hes saying your orderedby columns in the database need to be tinyints.
How does that work then?
-
What's wrong is you're storing numbers as strings. "11" sorts before "2" because 1<2.
But the real question is why you have three Match_# tables.
So I would have to make the php string a number then?
-
So say I have a union sql statement like this:
(SELECT id, card_id, ordered FROM Match_1 WHERE card_id='$card_id') UNION (SELECT id, card_id, ordered FROM Match_2 WHERE card_id='$card_id') UNION (SELECT id, card_id, ordered FROM Match_3 WHERE card_id='$card_id') ORDER BY ordered ASC
ordered is an INT, but yet when I order the results its like this
1
11
2
11 should obviously be last but it isn't, what am I doing wrong?
-
You would have to set up like a file directory called Members.
When a user would sign up to your site you would create a new folder for that member in the Members directory.
Then it would come into work for the application you have here. You would simply pull up the image from the Members/username/profile_pic.jpg for example. Something like that.
-
Now I see it. Thanks!
-
$sql_get_worker = mysql_query("SELECT id FROM Worker WHERE mem_id='$id' AND retired='n'");
$get_worker = mysql_fetch_assoc($sql_get_worker);
foreach ($get_worker as $value){
$sql_get_worker = mysql_query("SELECT * FROM Worker WHERE id='$value'");
$get_worker = mysql_fetch_array($sql_get_worker);
$worker_firstname = $get_worker['firstname'];
$worker_lastname = $get_worker['lastname'];
$worker_options .= "<option value='$value'>$worker_firstname $worker_lastname</option>";
}
How about this then? There are two rows that return with this id, but yet only one is returning.
-
$array = array("1","2","3");
foreach ($array as $value){
echo $value;
}
Put its only echoing out 3, not the whole array.
-
Alrighty guys thanks! Wasn't too sure about this. Thanks for the help.
-
The id is INT, but should the posts be INT aswell? Right now it is VARCHAR.
-
I have tried it with more numbers, and it seems to be doing something like this:
84
803
77
707
51
505
It doesn't take into account the third number on some of these.
-
Lets say I have this query:
$sql = mysql_query("SELECT * FROM Member ORDER BY posts DESC LIMIT 10");
while ($get = mysql_fetch_array($sql)){
$row .= $get['id'];
$posts .= $get['posts'];
echo "$row - $posts<br />";
}
Lets say I have two of rows, with posts fields of 84 and 803. When it displays it, it grabs the 84 row first, when I want the bigger number 803 first. Is there a way to fix this?
-
Using ajax/jquery:
this is the form:
<form action="" method="post">
<input type="hidden" id="mem_id" value="<?php echo $id ?>" />
<textarea class="text4" name="chat_message" id="chat_message" style="width: 450px; height: 100px;"></textarea>
</div>
<div style="width: 120px; height: 100px; float: left;">
<input type="submit" class="submit" value="Submit" />
</form>
this is the javascript:
$(document).ready(function(){
var chat_message = $("textarea#chat_message").val();
var mem_id = $("input#mem_id").val();
var data = "chat_message=" + chat_message + "&mem_id" + mem_id;
$(".submit").click(function(){
$.ajax({url: "chats.php", data: data, type : "POST", dataType: "script"});
});
});
Its not sending it to chats.php, so what am I doing wrong here?
-
How would I keep a set time, without it changing in php? I have a ajax and a javascript interval running for 3 seconds. But everytime it intervals, the time changes in my php script. So how would I keep the time that the person came onto this page?
-
Seems as though I have fixed my own problem, as I am getting verifired from Paypal now. Awesome. Thanks guys.
-
OK, if that's what they say to do with it, I guess that's what they need . . .
Try this . . .
if( function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() ) { $_POST = array_map( 'stripslashes', $_POST ); } $_POST = array_map( 'urlencode', $_POST );
Okay I got it to work. Is my cURL stuff right, when I send it back to paypal?
Jquery won't work after Ajax call
in Javascript Help
Posted
I seemed to have fixed my problem by placing the javascript code that I want to run with the ajax callback in that.