« first day (145 days earlier)      last day (4818 days later) » 

12:00 AM
even though I put the code inside of a for loop, looping through each element
 
You could array_map it
 
could you give me an example of what that would look like, I'm having trouble understanding the documentation as it applies to my case
 
$callback = function ($value) { return implode("\t", $value); };
$data = array_map($array, $callback);
$data = implode("\n", $data);
 
do you even need the function? can you just call it like so:
$callback = implode("\t", $value)
?
 
you need the function
otherwise what's $value?
 
12:09 AM
so all the lines go in my for loop? or just the call to the function containing the array element?
 
not in a loop at all
 
well then what is $value?
 
just pass your big array into those 3 lines, and that should do it
$value is passed in by array_map
it's just a regular function argument
 
oh my god, this doesn't make any sense to me
 
12:11 AM
how do I get $value?!?
 
You don;t
Oh, small bug:
$callback = function ($value) { return implode("\t", $value); };
$data = array_map($callback, $array);
$data = implode("\n", $data);
 
you didnt change anything
 
yes I did, I reversed the order of arguments to array_map
 
nvm, i see it
 
Tek
12:27 AM
@ircmaxell Is there a better way of writing this? localhostr.com/files/V1ruKKj/capture.png
I'm not sure how to write it, but I'm thinking something along the lines of:

$fields = array();

function push_arr($var)
{
if ( !empty( $var ) )
{
$fieldname = $var
$fields[$var] = $fieldname;
}

}

push_arr( $_POST['streetname'] );
push_arr( $_POST['city'] );
push_arr( $_POST['state'] );
It just seems like a lot of work just to check for each $_POST field that's submitted
 
you can start by writing that in pastebin
 
isn't there a function called array_push
 
Tek
Yes, but I don't think it can format the data the way I want it to
 
uhhh
why $fieldname = $var? Why not just $fields[$var] = $var;
 
12:34 AM
ok you're processing your post args
couple of ways to go about it
easiest is to use a framework
secondly
use php's own functions for getting args
 
Tek
Ok so that I explain better:
Example:

Lets say a user submits the street "Roadview Street"
push_arr( $_POST['streetname'] );

When I run the function I want the array to look like this:

streetname => 'Roadview Street'
That's why I can't do $fields[$var]
Since the array will say var => 'Roadview Street' Won't it?
 
filter_input_array()
use those filter functions
it will do a few things 1) clean it 2) verify the type 3) save you time as this is a common task
 
Tek
I don't need to clean it, I'm using parameterized queries
Plus it won't be available on the internet, it'll run on a local machine
I just need to check if a certain field is empty, if it's not then I just want it to transfer that information to an array
 
1:38 AM
hey folks
can anyone take a look at stackoverflow.com/questions/5254338 please
Is there anybody out there?
 
hey aateeque, i just responded to your question
take a look at it
 
thanks
just did
 
so by using that you can just run the tar -xvf command as parameter in the shell_exec
does that make sense to you?
 
yep that part does
how do I go around actually grabbing the repository each time a commit is made?
 
what do you mean? can you elaborate more?
you can always telnet, or use rsh
 
1:54 AM
aateeque: remember to use escapeshellcmd/escapeshellarg :)
 
or ftp if I understood your question correctly
yup good advice eric lol
 
aateeque: on your testing server, perform a mercurial checkout
your code runs from there. When you receive a post notification from bitbucket simply update that checkout
 
eric: i don't know PHP....how do I go about updating when I get the post notification?
 
that's a little complicated :0
 
happy to learn :D
 
2:00 AM
Assuming you have the appropriate permissions, you would do something like:

<?php
// do something with $_POST, figure out what was updated...
shell_exec("mercurial command_to_update /path/to/checkout");
 
okay
i'll give that a go
any useful starting tutorials to PHP?
 
php.net/manual/en/langref.php not really a tutorial, but the php manual is high quality
 
2:18 AM
Hi Guys
Anyhow able to help... i have no correct answers yet: stackoverflow.com/questions/5254430/…
 
Braddles are you escaping your parameters before placing them into the query? not doing so can cause your "incorrect sql", as well as open some serious security issues.
 
I'm not but this is a password protected page - its also running on a local machine with no public access
 
Doesn't mean anything. It's only running there for now. Try wrapping mysql_real_escape_string around your query parameters. php.net/manual/en/function.mysql-real-escape-string.php
 
eric: yup php documentation is the best so far. the worst i met in my life is java EE. ridiculous.
 
also, as stated in other replies, you need to quote strings in an sql statement.

SELECT * FROM delegates WHERE CheckedIn = 0 AND DStation = $x_station

will only work if $x_station is an int/float. use
$x_station = mysql_real_escape_string($x_station);
..snip.. AND DStation = '$x_station';
 
2:26 AM
Sorry Eric, i should be clearer, this will only ever run on a local pc
 
Songbreaker: not a big java fan myself :)
Braddles, doesn't matter, you need to escape your input.
 
Thanks Eric.
So... I can output the data from SQL fine.. all looks good
the issue I'm having is on submit it does nothing
 
so it's working? great :)
Braddles: you stated 'I set the action to the script name and I now get the following error: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 '
Ohh crap braddles :p
Didn't notice the scrollbars in your question lol
 
Yes because the form is processed within itself if is submit
lol
 
are you still using: 'if($Submit){'
 
2:31 AM
no
But it did work one time with that
 
can you paste your code into a paste bin then?
or gist or something so I can see it's current state?
 
first, make sure it's getting inside your if statement, do something like if (isset(...)) { echo 'it worked'; exit;...
Secondly, I edited your update query to use _POST... pastebin.com/ZfF50fYd
It appears that you are overwriting your post data with your looping display code
 
ok i can echo it worked after isset
 
@Braddles Try the _POST version of the query now :)
 
2:42 AM
Have done
no luck
the big thing I notice is that it does not redirect
if($result1){
header("location: checkin.php&msg=1");
}
should after that but does not...
 
print out your query and exit before you do mysql_query...
 
So I assume that $result1=mysql_query($sql1) is not working
how do I do that
 
echo $sql1; exit; before $result1=mysql_query($sql1)or die ('Error: '.mysql_error ());
 
Before I do that
here is the error from using post
 
what is the error?
 
2:46 AM
and i note that i have not got a hidden field for DID
so I'll set that
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DConfSun='0' CheckedIn='1' WHERE DID=''' at line 1
 
it's not redirecting because mysql_query is deffinitly failing :)
after you add your hidden field, do print the query to the screen and make sure it's actually well formed and valid sql
 
UPDATE delegates SET Dconfdinner='0', DConfSat='0' DConfSun='0' CheckedIn='1' WHERE DID='1'
it's setting did to 1
Is there some other way I can display al records then submit and update them like this is meant to do? Link to a tutorial or similar...
this is above my ability but I just wanted to get it done so I can learn a little
 
you have a typo there Braddles :0
Dconfdinner='0', DConfSat='0' DConfSun='0' CheckedIn='1'
missing commas
 
UPDATE delegates SET Dconfdinner='0', DConfSat='0', DConfSun='0', CheckedIn='', WHERE DID='1'
that's it now
 
nope
UPDATE delegates SET Dconfdinner='0', DConfSat='0', DConfSun='0', CheckedIn='' WHERE DID='1'
 
2:55 AM
I think because this is in a loop and I'm trying to update each record seperately
UPDATE delegates SET Dconfdinner='0', DConfSat='0', DConfSun='0', CheckedIn='1', WHERE DID='1'
 
you have an extra comma after CheckedIn='1'
remove that and you will have a valid sql statement
 
ah
yes i see
so now it's UPDATE delegates SET Dconfdinner='0', DConfSat='0', DConfSun='0', CheckedIn='1' WHERE DID='1'
 
and is it working? or?
well, remove/comment out the echo ..; exit; statement and see if it works :)
 
No.. it does not update any records
i think because it's trying to update DID 1
 
it is trying to update did 1
is that not what it's supposed to be updating?
 
3:00 AM
no
But i think i'll try my old sql command
$sql1="UPDATE delegates SET Dconfdinner='$DiSat[$i]', DConfSat='$Sat[$i]', DConfSun='$Sun[$i]', CheckedIn='checkin[$i]' WHERE DID='$DID[$i]'";
with the added commas
that may work
 
fix checkin[$i] as well
 
As in $checkin[]=$rows['CheckedIn'];
?
 
your old query has CheckedIn='checkin[$i]' im assuming you ment CheckedIn='$checkin[$i]'
 
I can't see a difference?
 
I guess im not as intoxicated as I had previously thought :p
$checkin[$i] vs. checkin[$i]
your missing the variable identifier $ for checkin in your query
 
3:07 AM
OMG
I did not see that
lol
No sleep does this to me
ok
UPDATE delegates SET Dconfdinner='0', DConfSat='0', DConfSun='0', CheckedIn='1' WHERE DID='152'
that looks good
only that the checkbox for check in is not checked and should have value of 0
<input name="checkin[]" type="checkbox" id="checkin" value="1" />
How can I set it to do checked = 1 not checked = 0
I could always change that to a drop down but I thought I could get a checkbox doing that as well?
 
here's is a trick
when a checkbox element isn't checked, no value is passed
the way to correct that is usually with a hidden element...
 
So how is it that I'm getting a value of 1
 
the way i understand it is checkbox unchecked = NULL checked = 1
 
yea, sorry that is correct
 
3:14 AM
But with the way I have it setup.. <input name="checkin[]" type="checkbox" id="checkin" value="1" />
which means if check = 1
 
right
but you didn't check it?
and it was still 1... ?
 
but when i submit and checkbox was not checked it still = 1
Yeah
 
are you sure $checkin wasn't already defined as 1 within the current scope?
 
I have this <?php $checkin[]=$rows['CheckedIn']; ?>
But it's set to 0 in db
 
I'm not sure what's happening now :/
 
3:21 AM
Yeah either am i :S
 
if your setting $checkin[] to $rows['CheckedIn'];... isn't that overwritten your post variables?
which is why I previously suggested changing your query variables to $_POST['VarName'][$i]
 
No because it is before the form element
 
that doesn't mean anything
switching between html/php doesn't change your scope
 
3:55 AM
Hey eric
How can I call a function within a function
 
4:09 AM
call_user_func()
Example: call_user_func("phpinfo");
OR: just use that function name:
myFunction();
@Braddles I answered, but wanted to make the noise ;)
 
5:04 AM
hello everyone
 
5:20 AM
Hello...
 
Tek
5:55 AM
hi
Or am I too late for the party? q:
 
i was late too
 
Tek
hahaha
 
@Tek do you know any good java tutorials?
 
Tek
Not really :(, I've only done PHP,C++,Javascript. I haven't had a need to touch Java yet...
 
how difficult is C++ ?
 
Tek
5:59 AM
To me it wasn't difficult. For some reason it was easy for me to learn. Once you know a programming language the rest are easy to understand.
Though that doesn't mean I'm a C++ expert, just that it makes sense
and if I don't know something I can easily look it up anyway =)
 
yes, the general language is easy, but there are specialities of each language and that makes it unique
 
Tek
Yeah, of course. Then again I guess that depends on what you're going to do and what special parts of the language you're going to be using the most.
 
well, to me right now i just want to do which makes lot of money and is non microsoft
 
Tek
Why non-ms?
 
hahah because why when you search some simple software in internet
i mean like for making bootable pendrive or ... something ...
at fist result shows that they are free
when when you look at them they costs around $28 or so
 
Tek
6:04 AM
lol
 
why do people use ms if they get alternatives for free
 
Tek
so what you're saying is that you don't want to develop for windows?.. Because if that's not it then I'm not sure what you mean
 
well it is my intention to make free softwares for all
though right now i need lot of money
hahaha
 
Tek
lol... I see
Well, sorry I can't help you much. But you should search SO I'm sure the question's been asked before.
 
but my background is quite different
yes but right now i am working on php
 
Tek
6:13 AM
Ah, that's good.
 
6:25 AM
What do people usually discuss here? anything related to PHP
 
yes
 
ok
does anybody know how to get a modal box on new Joomla 1.6
front end
any tutorial kind of thing would be helpful
 
Tek
6:42 AM
PHP is back end, so I don't think your question belongs here
 
not sure abt joomla check joomla plugins if you can't find one then try to create one
 
Tek
You can ask the javascript guys, they're the front end
 
i think you will get video tutorial on youtube
 
:)
Joomla architecture is mixed with PHP and Javascript
especially mootools
they embeded into PHP framework
not worth experiment
 
Tek
Oh that's right, I forgot they had an MVC structure
 
I tried extensions
they are not for good help
 
try some thing like "how to create joomla plugins" in goolge
i somewhere saw that tutorial actually on youtube.. but i quit joomla before i learned it
 
6:58 AM
Hi All Good Noon....
pls Help me Out with this
0
Q: How to get the exact modified PDF using FPDF/FPDI?

OM The EternityHello All, i have a task to modify the PDF and add an image into it, for which I Have used the FPDF and FPDI libraries.. whose action code is given below: <?php require_once('fpdf.php'); require_once('fpdi.php'); $pdf =& new FPDI(); $pdf->AddPage(); //Set the source PDF file $pageco...

 
7:09 AM
Isnt Any Body Interested in Helping me out for this?
 
Well don't know about this
 
Thanks For Reverting @Exp
 
you are welcome
@OMTheEternity BYT where did you get that library
 
chk th elink
@exp Could U pls Pass the question to ur fellow geeks.. if they can help me out with this?
 
@OMTheEternity all my fellows are physics .. however i will see what can i do
 
7:23 AM
nope
@Lol and U seems to Humouric
So any idea :)
 
I am checking it
what does fpdi.php do
i mean what's in it?
 
Its the Supporting Library to Modify the existing PDF
 
7:42 AM
@OMTheEternity where did you get FPDI library
 
I Gave u the Link didnt u got that?
 
Did you pay for it?
 
no
can I mail u the .rar?
can u give me the email address of urs
 
yes, santoshlinkha@hotmail.com
 
Chk ur Mail
will b back by an Hour
going for Lunch
 
7:52 AM
okay have great day
seems there are lot of ifles
 
8:10 AM
@OMTheEternity you have missing file FPDF_TPL
fpdf_tpl
.php
besides i dont think its' free
 
8:51 AM
lemme give u the file
I have it
@exp
 
okay
 
chk ur mail
 
yup got your email.
 

« first day (145 days earlier)      last day (4818 days later) »