@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31



Comments:

<0> so why would my pastebin not work?
<1> How would I get A and B B into C?
<0> in short: cl*** C {}; cl*** A extends C {}; cl*** B extends C{};
<2> so i'm trying to verify that a user from a form they filled out is in our databse and im using the following statement: $query = "SELECT username FROM j_users WHERE username='$username'";
<2> however, this ALWAYS evaluates to true
<2> when i throw that into: mysql_query($query, $database) that is
<2> ***ign that to $result, and check
<1> okay, I need this (pseudocode) (on my site, brb)
<2> anyone know what i should be doing, or what im doing wrong
<3> asdfasdf: you want to reread qhat it says for return values on http://php.net/mysql_query
<2> I did, it returns a Resource ID
<3> ok, so what you do is to check whether a resource id is set?
<3> or do you actually evaluate the result of your query?
<2> we do: $result = mysql_query($query, $database); then do: if (!($result)) die("User does not exist");
<2> but it always comes out true
<4> asdfasdf: because the query is always run



<4> asdfasdf: you need to check the number of rows returned
<2> GarethA, ahh, okay.
<0> going out on a limb here.... possibly you need @mysql_query? idk if errors would be ***igned to the returned value or not...
<2> and if 1 is returned, that means user does exist, right
<4> yeh
<4> asdfasdf: mysql_query returns a result object whether or not there are any results, so it'll always evaluate as true in an if()
<1> Elviso: http://r-butler.net/~robert_/heir.php
<2> awesome, thanks man
<0> alright
<0> robert_, show me how you'd implement that
<2> how would i p*** a username to multiple pages so i can keep track of who is signed on?
<2> i just wanna p*** a username, not like a session or anything, so i can get their id, and whatnot
<1> I need two cl*** 'namespaces' inside of one cl***
<0> asdfasdf, use a hidden form field and/or throw it in the url
<2> if i throw it in the url, how would i extract it on the next page?
<5> what is the best way to do the current date in format dd/mm/YYYY
<0> asdfasdf, or use output_add_rewrite_var
<0> asdfasdf, just like any form
<6> is there a function to find out how many items are in an ary?
<0> DragonD, count()
<2> how would i do a hidden form?
<2> i can do it, but then i click on the link, and how do i know it's sent
<2> or if i add it to the url, how would i get it from the url
<0> <input type="hidden" value="<?=$username?>">
<2> but everytime i click on a link, i can use extract($_POST) and get the username?
<0> robert_, I'm still not 100% what you mean, sorry.... but maybe http://php.pastebin.com/718211 ?
<2> you see what im saying?>
<0> asdfasdf, using output_add_rewrite_var yes
<0> asdfasdf, or actually, if you just used any post method you could
<2> yeah, but say i have a hidden form, with a post method, and then say the user clicks a link. that post method would carry over even though no one submitted?
<0> robert_, minor correction: http://php.pastebin.com/718214
<7> asdfasdf: the output_add_rewrite_var function adds the variable/value to all forms/links
<2> but how would i then access that variable in the other page?
<8> any better way than if(strtolower($a) == strtolower($b)) to do a case-insens test? or is that the best
<7> Using $_REQUEST['variable name'], or use $var = ($_POST['variable name) ? $_POST['variable name'] : $_GET['variable name'];
<7> the later if you don't want to allow cookies for that variable
<2> so i use it like so:
<1> Oh, I can't use extends with more than one cl***'es 'namespace', can I?
<2> output_add_rewrite_var('$username');
<1> er
<1> inheritance doesn't work like that
<1> does it?
<2> and then it's added to the url, and i just use $_REQUEST['$username']
<2> or even $username with no single quotes
<7> no, read the manual http://us3.php.net/output_add_rewrite_var
<2> do we havce to use the form?
<9> if I have
<9> function color() { if($_GET[color]==red) echo "?color=$_GET[color]";}
<7> only if you happen to need p***ing POST data
<2> okay, so then it'd be like:
<9> how would I add move colors then red?
<2> outpud_add_rewrite_var('var', '$username');
<7> Mickly: how about a switch/case? Also, shouldn't you have global $_GET;
<7> asdfasdf: yes, and then you access the variable with $_REQUEST['var']
<2> sick, thanks man
<9> what is wrong with a global $_GET
<7> nothing
<9> then why should I not have it
<7> You should have it, in what you posted you don't
<9> what is the differance?
<2> that didn't seem to work



<2> what i have is:
<2> output_add_rewrite_var('username', '$username');
<7> asdfasdf: don't add single quotes around $username
<7> Mickly: without global $_GET; in your function you can't access the $_GET variables
<9> well it is working
<9> but for red only :(
<7> well, you only have the case statement for red
<9> and how would I write it to add green?
<7> function color() { global $_GET; if ($_GET[color] == 'red') { echo "?color=$_GET[color]"; } elseif ($_GET[color] == 'red') { echo "?color=$_GET[color]"; } }
<7> woops, make that last red green :P
<0> gannon, it's possible he has register_globals 1
<0> gannon, wouldn't that explain not having to use global $_GET?
<7> Yeah, I just don't ***ume that since I use too many different servers :P
<0> heh
<10> and... GLOBAL'ing _GET is stupid
<7> Not as stupid as global-ing a super global :P
<9> function color() { global $_GET; if ($_GET[color] == 'red' or $_GET[color] == 'green' ) { echo "?color=$_GET[color]"; }} is simpler
<11> I have this code which create a PDF file on disk and it seem the file is there but when pdf should be opened it say the file cannot been found http://pastebin.com/718236
<7> yes it is :P
<9> :) I am better at this than I though
<9> thought
<11> could you have a look and a suggestion to corect the code ?
<0> shouldn't it be $_GET['color'] ?
<12> HolyGoat: are you awake?
<9> Elviso that was giveing me a error about white space
<7> then use echo "?color=".$_GET['color'];
<9> what dose the . do
<13> well it means less work the php interpreter has to do
<13> try and use single quotes aswell
<0> "error about white space", huh?!?
<7> yep
<0> I believe PHP will automatically convert the value to a string for you, however it's best-practice to use single-quotes I believe
<13> function color () { if ($_GET['color'] == 'red' || $_GET['color'] == 'green') { echo '?color='.$_GET['color']; } }
<0> or you could do echo "?color={$_GET['color']}";
<7> That's slower though
<9> is it better to use || over or?
<0> for that yes
<13> i always use || and &&
<9> why?
<13> i find it easier
<0> "or" functions differently
<13> makes it easier to find the operator
<7> Same as the difference between =, ==, and ===
<9> there is a difference gannon?
<13> Mickly: = (***igning a variable), == (is equal to), === (is IDENTICAL to)
<0> http://us2.php.net/manual/en/language.operators.php#language.operators.precedence
<9> another bookmark :P
<9> How do you do this in php
<0> $this->do() :p
<7> lol
<9> function pagename() {out put page name}
<0> __FILENAME__?
<7> $_SERVER['PHP_SELF'] ?
<14> what does & preceding declaration of a function indicate ?
<0> viyyer: & is p*** by reference
<9> thanks gannon
<14> does this change the way to call the function?
<7> viyyer: no
<7> well, IIRC that is :P
<0> viyyer: http://us2.php.net/manual/en/language.references.php
<14> Elviso, but if I have a function like " function & myfunc( $var )"
<14> Elviso, aah ok it returns reference thanks
<0> np :)
<9> would function1()+function2() be the correct way to join two functions that both out put a string
<15> hi... when I have display_errors = off, is there a way that I can display a custom error message instead of aa blank screen ?
<15> such as "an error occuredm please inform the admin"
<7> Mickly: no, that'd add the 2, use function1().function2()
<9> oh
<0> tokyoahead, http://us2.php.net/manual/en/ref.errorfunc.php
<0> Example #1 shows how to implement a custom error method
<9> why would function red() { global $_GET; if ($_GET[color] == 'red' { echo 'id=n'; } } give the error Parse error: syntax error, unexpected '{' in .............. on line 3
<16> 'unexpected X' usually means you've missed something important *just before* the X
<16> and it's the second { it's talking about


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

gentoo photosmart 8250
#css
ubuntu wont restart
ubuntu set QTDIR put it in your PATH
#qemu
mozilla-browser debian etch
/media/sde1
vfs cannot open root device hd3 or unknown-block(0,0)
drano potency
phpeclipse debug $_SESSION



Home  |  disclaimer  |  contact  |  submit quotes