« first day (1006 days earlier)      last day (3945 days later) » 

1:11 AM
I don't have anything against it, but why not a popup for delete and a small textarea like (please explain why you are closing this question)?
 
1:37 AM
why do people use $stmt->fetch and others use $stmt->fetchAll even if it involves multiple rows from a table
i can't see a difference =/
 
J L
if I set new PDO( array(PDO::ATTR_PERSISTENT => true) ), how do I check if a persistent connection is open before creating the next one, or does PHP handle that automatically?
 
@Dave one returns a row and the other returns an array of rows
 
yeh but some people loop the fetch() to create an array of them then loop the rows from that array
 
J L
Also documentation says not to use caching if you're using ODBC drivers, but I'm not sure if I'm using them or not
 
@Dave well that's just redundant. Maybe those people don't understand that fetchAll will do the same thing without having to perform an additional loop and create an additional array.
 
1:50 AM
so if my query gets say 10 rows... this:

while($row = $stmt->fetch(PDO::FETCH_OBJ)){
will only do one iteration
 
J L
nevermind, PHP.ini says ODBC support is built in, so I guess I won't use persistent
 
@Dave no it would loop through the results. fetch() will get the next row, the while() will be true as long as there is another row to fetch.
 
so is that also redundant compared to fetchAll ?
or they pretty much same thing
 
@Dave pretty much the same thing as using fetchAll() in a foreach() loop
 
ok. is there a php bench test site any where? be interested to look at times and memory comparisons
like jsfiddle / sql fiddle etc
 
2:12 AM
 
thanks :)
 
Todays joke...stackoverflow.com/a/14909990/1542290 PHP mysql extension, known by it's functions prefix, mysql_* is deprecated by PHP team for no reason
 
i actually don't know the reason
im going to guess it had bad performance ?
 
 <?php
  echo "testing php here";
     ?>
inside <body>
it does not run at all
 
where is your semi colon
 
2:23 AM
and php is enabled on the server
 
error reporting on ?
 
@Dave thats a typo in my paste, its there
@Dave no error, just doesnt show the text when you load the html page
 
is it in the page source even if u cant see it on page
although no error could suggest your have error reports off
<?php
 error_reporting(E_ALL);
 echo "testing php here";
?>
 
yes
its the soource
 
is the font color white? with background color white :P ?
 
2:26 AM
@dave mysql_* was not capable of supporting mysql features llikestored procedures, transactiona etc, also using those func u have to worry about escaping, sanitizing the user inputs where in pdo u dun hav to wry
 
@Dave that code doesnt run iether. Its like php is disabled
yet, the wordpress plugins run just fine
 
but you said its in the page source? so it must of run
 
@JABFreeware do as I say, only type localhost and what so you see?
 
@Mr.Alien I'm not sitting at the server right now
I have ftp access
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>



</head>
<body>

<?php
 error_reporting(E_ALL);
 echo "testing php here";
?>

</body>
</html>
thats html file
 
.html ?
also:
and you see "testing php here! in the page source yes ?
 
2:29 AM
correct
 
then the font color must be the same color as the background color
 
@Dave what?
 
change the font colour
 
in the source (in chrome) the php is in green
 
ohhhh
what is the file format
filename.***?
 
2:30 AM
As expected, I knew it that u wer using .html, Thats y I askd u to c what you get on localhost, perhaps html page shouldve printed the php code
 
can you link us to the page ?
 
change it to
gallery-new.php
 
@Dave hmmm, okay
 
you seem skeptical :P
your html will run fine in a php file. but your php will not run
but eventually you may want to avoid mixing server and client side code in the same page
 
2:33 AM
huh
it does
 
such as javascript to bridge the two together
 
yes it works perfectly
thanks man :)
 
all php must be be in php files :) np
 
@Dave oh one more question. I am a total with php
the php.ini file
allow_url_fopen = "on"
should that have a semicolon after it?
 
no
 
2:37 AM
the file has nothing else in it
 
it's not php code, it's ini settings
 
which is why its *.ini
 
thought so
 
although dont know what ini is short for
maybe initiate
 
is that right for ini?
 
2:38 AM
wiki it?
 
@JABFreeware read what it does here: php.net/manual/en/filesystem.configuration.php and then you can decide if u need it on
but as your new to php i wouldn't go fiddling with your ini settings
 
<?php
 error_reporting(E_ALL);
    copy('https://www.anotherdomain.test.xml', '/test.xml');
 echo "testing php here";
?>
well I read that from
for copy, you need to add a .ini settig
 
doesnt that apply for that domain not yours
ive personally never used copy function
so maybe @CSᵠ can explain better
 
@Dave yea.. why not?? that's how you learn
 
@CSᵠ not my server :)
 
2:40 AM
@CSᵠ well learn the language basics first :P
 
umm... @JABFreeware why would you want to use that/ copy?
 
@CSᵠ what do you mean?
it was just a test
put in root directory
it*
 
wow
 
JUST A TEST
:D
 
ok...
 
2:44 AM
do a simpler test with a file on your own server first :


    $file = 'example.txt';
    $newfile = 'example.txt.bak';

    if (!copy($file, $newfile)) {
        echo "failed to copy $file...\n";
    }
 
nvm I got it. noob me, ini does not use "value", just value
thanks for your help
thats all
I am actually very skilled in c#, just not php. I hate it
 
could use java or python
unless u have to use php
 
@Dave yeah I have to use php. its not big deal, I'm almost done.
I have to get busy. bye and thanks again
 
cheers @JABFreeware
 
toodles
 
2:47 AM
noodles
 
with soup !
code soup
 
@crypticツ still awake?
@CSᵠ counter strike?
 
of course
and computer science
/out
 
@CSᵠ cya
 
3:03 AM
@Mr.Alien yes
 
LOL News
 
3:18 AM
if you guys do this header("Content-Security-Policy: default-src 'self';"); does PHP/Apache convert the header name to lowercase? I know it doesn't matter, but I'm seeing that happening for me, so just curious if it's just me.
 
@crypticツ negatory
HTTP/1.1 200 OK
Date: Thu, 18 Jul 2013 03:25:03 GMT
Server: Apache/2.2.22 (Unix) DAV/2 PHP/5.5.0
X-Powered-By: PHP/5.5.0
Content-Security-Policy: default-src 'self';
Content-Length: 0
Content-Type: text/html
 
@igorw weird, maybe it's just Firefox
web console shows the header name lowercased
yep, it's Firefox, Chrome shows it normally.
 
3:40 AM
hello guys !
I need some help
today i hosted a website on godaddy
and php variable get dump automatically
 
in Lounge<C++>, 1 min ago, by Ash Ketchum
Are consumers really stupid and is Apple's decision to focus on user-friendly products instead of usability products actually correct?
 
Any one know why ??
please help ??
i checked my scripts many times there not a single var_dump
 
@Cody what do you mean?
 
@ash
this is snippet from one of my php scripts
  $arrRows = getRows( $sql );

    foreach( $userAttr as $value ) :
      if( array_key_exists($value, $arrRows[0]) ) {
   ?>
    <tr>
      <td><?php echo strtoupper($value) ?></td>
      <td><?php echo ($arrRows[0][$value])  ?></td>
    </tr>
    <?php } endforeach; ?>
 
And what is the printed output?
 
3:44 AM
here $arrRows get dump automatically like var_dump( $arrRows )
 
@AshKetchum Apple is all about eye candy products, and nothing about practicality or useful products. Reason why Android is light years ahead in features and abilities, and Apple computers with their bloated prices do not come even close to the specs of a PC prices half as much. You can polish a turd, but in the end it's still a turd and Apple is really good at making turds look like the next cool thing.
 
@Cody I am not a PHP expert, but I can tell you that something is wrong in <?php echo ($arrRows[0][$value]) ?>
 
content of $arrRows
like this array(1) { [0]=> array(10) { [0]=> string(2) "km" ["userName"]=> string(2) "km" [1]=> string(5) "Kevin" ["firstName"]=> string(5) "Kevin" [2]=> string(7) "Mitnick" ["lastName"]=> string(7) "Mitnick" [3]=> string(1) "m" ["gender"]=> string(1) "m" [4]=> string(17) "kevinm@hacker.com" ["email"]=> string(17) "kevinm@hacker.com" } }
 
@AshKetchum what's wrong with that?
 
@AshKetchum but on my local server everything seems to be fine
 
3:47 AM
@crypticツ The reason I say that there is something wrong with that is because that's the only place where he is printing out the contents of the array.
Even if it isn't the part that's wrong, it should be a good place to start.
 
@crypticツ @AshKetchum On my local server everything is fine
 
When you view the page source is the outputted content inside that table cell?
 
Well, then something must be wrong with the way you are pulling it or it might be the database itself. Have you checked if everything is exactly the same as what you have on your local server? Like every single thing?
 
@crypticツ no output is outside table
 
@Cody Then the code outputting it in not in the snippet you posted
 
3:52 AM
@crypticツ Then from where it is coming , there is not a single var_dump on my script
@AshKetchum Checked everything many times
 
@Cody was there a var_dump at some point in testing?
 
@crypticツ Yes
 
Then the file was not properly uploaded after the removal
 
Maybe you put var_dump() earlier in your code and have since removed it and but it either didn't save properly or the site is not being updated?
 
I've had this happen with someone before.
 
3:54 AM
It has happened with me too. Sometimes it doesn't update and you have to just resave it or delete the file and re-upload it.
or clear your cache, cookies etc.
 
Delete the file completelty off server, access it to make sure it 404s and is not present, make sure your local copy does not contain the var_dump. Then upload it, then try.
 
@crypticツ let me check again
 
4:11 AM
@crypticツ issue still exist
 
I use JS/AJAX with dataType: 'json' to post to a PHP script which echos json_encoded array of data and the JS keeps going to .fail even though I'm getting 200 and a responseText with data as expected. From what I have researched this is because of the Content-Type the PHP script has in it's header, but even with setting the content type in the php script and everything else I've seen in researching this it's still not working... what am I missing?
 
@crypticツ here is my script pastebin.com/3WUvMJPY
 
@Cody first off you should never code with error reporting off
 
+1 to that @crypticツ
hmm i may have answered my own question again damnit rubber ducky
 
I am back.
 
4:21 AM
@Cody there is a lot of stuff being done wrong in the code. Honestly I don't even know where to begin.
 
@crypticツ but is working fine on localhost
 
@Cody just because it "works" does not meet it is correct.
 
@crypticツ Can you please mention some errors ?
 
Like your database scheme. You apparently have a column named 1 in the user table.
You check for the existance of $_SESSION['userName'] 7 times using isset() you only need to do it once at top like so $userName = (isset($_SESSION['userName'])); and then do if ($userName) { everywhere else.
if( !( $_SESSION['userName'] && getRows($sql) ) ) you really should not be running a database query inside an if() statement. Put it inside the code block.
 
There is no such column i us 1 bcoz i am just checking if there is any user or not ,So there is no point to fetch all records.
 
4:28 AM
header("location: ../login.php"); the Location header need an absolute URL
$sql = "select userName , firstName , lastName , gender , email from users where userName = \"$_SESSION[userName]\"";
$userAttr = array( "userName" , "firstName" , "lastName" , "gender" , "email" );
$arrRows = getRows( $sql );
foreach( $userAttr as $value ) :
if( array_key_exists($value, $arrRows[0]) ) {
not sure what you were trying to do here.
You shouldn't be using http://localhost/ in your URLs either use a relative URL or set the domain dynamically. Don't hardcode such things. Make migration to a live server or another server a pain.
<link rel="stylesheet" type="text/css" href="http://localhost/ab/styles/css/main.css">
<script type="text/javascript" src="http://localhost/ab/styles/js/base.js"></script>
Your file structure for your assets makes no sense. Why is a JS file in a folder called styles? Not very semantic when style is typically associated with CSS. If it for different themes, then you should rename it to that. Usually they just call it 'assets' as it's where images, JS, and CSS etc reside.
 
@crypticツ 1000 * thanks for all errors you pointed out :)
@crypticツ I'm going to correct all of 'em thanks
 
no problem
definitely redo that SQL query block above, If you aare trying to get the column names you could always extract the key names from the array.
or do foreach( $arrRows as $key => $value ) :
 
@crypticツ Okay
 
not sure how your rows are being returned, so the input may be different
 
hey @Mr.Alien
 
4:43 AM
@YogeshSuthar ayo
 
m59
I just got to an interesting bit of my cms... I'm loading my plugins via ajax, so...I'm now in my php file with something like:
{
  "plugin" : "nameHere",
  "options" : {
    "sampleOption" : "sample value"
  }
}

Now I need to load the specified plugin with those options....but I can't figure out what that actually will look like.
anyone got ideas?
lol I could pass options to php from js all day....other way around is confusing me
I could go the way wordpress does it, I guess.
 
@m59 That is a JSON strong, so you would do this: $options = json_decode($jsonString); You then can see the the options structure with print_r($options); and then load your plugin based on say if ($options['option']->sampleOption == 'some value')
 
m59
right, but the how is the question lol
wordpress makes a script tag and inserts it at the beginning of the html output of the plugin
that's not a bad route, I guess.
 
5:07 AM
Some of them become great programmers but end up writing syntax as sintex
 
Gooodmorning everybodyyy :D
What a wonderfull morning ;x
 
@Tredged had sex yest nyt?
 
XD
How you figure'd
 
Bleh if this cappuccino wouldnt be so bad ;x
 
5:12 AM
Hi
How to create something like this in PHP Language? wklej.org/hash/ee3e4e8669a
 
@user2508989 lmgtfy.com/…
I have totally nothing to do, anyone got an idea?
 
@user2508989 file_get_contents(), json_decode() and http_build_url() should give you aa place to start
 
@tereško Thanka!
Thanks*
 
Oops! There was a problem updating your profile:

Display name may only be changed once every 30 days; you may change again in 10 days
damn
 
Anyone want to help me with a mysql query question?
 
5:25 AM
@AshKetchum Discussion for all things PHP - Don't ask whether someone is here to help you. If someone is around and wants to help they will.
 
Only if you're using MySQLi
 
@Tredged Are you a bot?
 
@AshKetchum Please do not ask the bot any questions!
 
@DaveChen Well, on a page, there is a textbox in which the user enters his hobbies as tags (achieved using bootstrap tags) and then those tags get input into a specific column ("Hobbies") for each user with a comma in between all of them.
 
@AshKetchum Thanks for asking that question, someone will you help you soon enough.
 
5:28 AM
For example, for one user, under the "hobbies" column, it could have "basketball,football,computer,programming"
 
hmm, why not a new row for each hobby?
 
^
 
Because every row has a user on it.
 
Hobbies
id, user_id, hobby

Users
id, name, password, etc
 
But wouldn't that be inefficient
 
5:30 AM
If you have user_id you don't need an ID
 
I wouldnt call basket,football,computer,programming efficient either lol @AshKetchum
 
Just user_id hobby
 
id - autoincrement, just for good practice
 
@DaveChen do you download stuff from kickass?
 
If there are thousands of users and each user has like 20 hobbies they entered, then 1000*20 = 20,000 rows in that table alone.
And it would soon get out of hand. Not scaleable, would it be?
 
5:31 AM
Thats great math ;x
 
@Mr.Alien no I don't :P
 
@DaveChen hmmm
 
@AshKetchum It's a database ... 1bil rows is nothing
 
@Mr.Alien You know a good song :)?
It is something dave xd
 
Give me a second as I go back change the architecture, lol
 
5:32 AM
@Tredged waiting for the end - lp
 
I have a LOGS table that increases by a few hundred thousand rows daily, it's the job of the database to manage it with no issues
 
@Tredged Why so?
 
@Mr.Alien dhanyavad
@AshKetchum How so what?
 
If you can query the database efficiently (prepared, one query over multiple, bulk insert over php loops), then there's no issue.
 
@Tredged lol you welcome, but even I don't speak dat wrd :p
 
5:34 AM
@Mr.Alien bleh, now I feel stupid :(
 
4 mins ago, by Tredged
I wouldnt call basket,football,computer,programming efficient either lol @AshKetchum
 
@AshKetchum In my eyes, I wouldnt do it like that. I agree with dave
 
I imagine you'd explode on it -- which is bad x.x
 
@DaveChen Thats alot ;x
Nice website @Mr.Alien Im gonna make something also ;x
 
@Tredged I agree! It looks very slick.
 
5:38 AM
@Tredged Yeah, I am working on changing it right now.
 
@Tredged that's a pure hindi word which I don't speak that pure... and @Tredged which one? I have 3...
 
@Mr.Alien one listed on your SO profile
 
@Mr.Alien Qratek
The video clip of waiting for the end is sick lol @Mr.Alien
 
@DaveChen Oh ok... @Tredged its Quratek.. Well I've already made a corporate one, am waiting for some content, will be up in a month or so...
@Tredged it's awesome, just see the edits..
@Tredged the other one(domain) I just bought is this
 
@Mr.Alien Got an example, I'm curious now :)
 
5:40 AM
@Tredged for what
 
Ive seen that one yea @Mr.Alien looks nice :)
@Mr.Alien The corporate one :)
 
@Tredged nope, I've not deployed it on the server yet...
 
@Mr.Alien Ah ok :) got another song xd?
 
its not a static one, I've built an engine, which is synced with multiple websites, kinda 1 stop control
@Tredged mmmm do you like rock.. or wiz kinda songs
 
@Mr.Alien I love both, thats sounds nice lol
 
5:45 AM
@Tredged than if you like to listen metallica, you can go for no leaf clover, wiz - work hard, lp - lost in the echo (superb music)
 
Thanks :)
I have total 0 inspiration about my portfolio website ;x
 
The "hobbies" are stored in an array. Since I using foreach to go through the array and select each individual hobby to put into the database, should I put both the prepare and the execute PDO statements in the loop or just the execute statement?
 
Both I think
Why include 'file.txt'; and not include ("file.txt");
 

« first day (1006 days earlier)      last day (3945 days later) »