-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
This outta be in the Code Repository when your done.
-
Actually, this is a more accurate thread.. Moved to the repository just for reasons such as this http://www.phpfreaks.com/forums/index.php/topic,208965.0.html
-
\ normally used in things like \n, \g, \r, etc oh yeah...and comments.. like \\comment and \* comment *\ / Although if you are using fopen or file or any other file commands and you are using windows.. and you want to include a direct path using the drive letter you would then use the backslash.
-
How can I "activate" an account after recieved payments
Zane replied to Rifts's topic in PHP Coding Help
Paypal IPN is what this is called 2 useful links --------------- https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro http://designertuts.com/paypal-ipn-receiving-instant-payments-in-your-web-application/ -
Most strenuous tic tac toe game of my life.
-
$number=preg_replace('/\D/', '', $number); should be $number=preg_replace('/[^\D]*/', '', $number);
-
It's the quality of your post not the quantity... if someone hasn't said that already (in this thread) Hell, I've barely got 2500 and I've been here 5 years and I'm a Mod.
-
http://poststuff2.entensity.net/092809/image.php?pic=suggestions.jpg WTF... and more.. http://www.in.com/news/wild-n-wacky/the-20-funniest-suggestions-from-google-suggest-10750485-4efff0f28434badac22d566b4b1c4d3e883ff939-rhp.html got some? post em.
-
Wow... ok Now that's what I'm talkin about. Now it's really working like a charm and I completely understand your explanation. Notice I deleted the cat field because it was bugging me. mysql> SELECT *, IF(parent=0, id, parent) AS `board` -> FROM `boards` -> ORDER BY `board` ASC, `parent` ASC; +----+------------------+--------+-------+ | id | name | parent | board | +----+------------------+--------+-------+ | 1 | Board 1 | 0 | 1 | | 2 | Board 2 | 0 | 2 | | 9 | Two's Subboard 1 | 2 | 2 | | 13 | Two's Subboard 2 | 2 | 2 | | 3 | Board 3 | 0 | 3 | | 6 | Board 3's Sub 1 | 3 | 3 | | 7 | Board 3's Sub 2 | 3 | 3 | | 4 | Board 4 | 0 | 4 | | 5 | Board 5 | 0 | 5 | | 8 | Sub For Five | 5 | 5 | | 12 | Sub For Five 2 | 5 | 5 | | 15 | Board 6 | 0 | 15 | | 16 | Board 7 | 0 | 16 | +----+------------------+--------+-------+ 13 rows in set (0.00 sec) and I'm not so much worried about the subboards being in alphabetical order if that was your thought. I was just trying to get them to be in ID numerical order....which they are.. AWSOME.
-
I guess I spoke to soon Once I begin to add more boards they show up at the top of the list mysql> SELECT * , IF(parent=0, id, CONCAT(parent, '.', id)) AS sort FROM `boards ` ORDER BY sort; +----+------------------+--------+------+ | id | name | parent | sort | +----+------------------+--------+------+ | 1 | Board 1 | 0 | 1 | | 15 | Board 6 | 0 | 15 | // | 16 | Board 7 | 0 | 16 | // | 2 | Board 2 | 0 | 2 | | 13 | Two's Subboard 2 | 2 | 2.13 | | 9 | Two's Subboard 1 | 2 | 2.9 | | 3 | Board 3 | 0 | 3 | | 6 | Board 3's Sub 1 | 3 | 3.6 | //These two are the only ones acting corectly...I wonder why? | 7 | Board 3's Sub 2 | 3 | 3.7 | // | 4 | Board 4 | 0 | 4 | | 5 | Board 5 | 0 | 5 | | 12 | Sub For Five 2 | 5 | 5.12 | | 8 | Sub For Five | 5 | 5.8 | +----+------------------+--------+------+ 13 rows in set (0.08 sec) I've tried doing this ORDER BY sort, id; this ORDER BY id, sort; and this Group By id, ORDER BY sort; but I'm clueless as to why it does it like that
-
That couldn't have worked more perfectly.. Thanks Mjd! mysql> SELECT * , IF(parent=0, id, CONCAT(parent, '.', id)) AS sort -> FROM `boards` -> ORDER BY sort ASC; +----+------------------+-----+--------+------+ | id | name | cat | parent | sort | +----+------------------+-----+--------+------+ | 1 | Board 1 | 1 | 0 | 1 | | 2 | Board 2 | 1 | 0 | 2 | | 11 | Two's Subboard 1 | 0 | 2 | 2.11 | // I can't figure out why the 11 comes before the 9 though. | 9 | Two's Subboard 1 | 0 | 2 | 2.9 | | 3 | Board 3 | 1 | 0 | 3 | | 6 | Board 3's Sub 1 | 0 | 3 | 3.6 | | 7 | Board 3's Sub 2 | 0 | 3 | 3.7 | | 4 | Board 4 | 2 | 0 | 4 | | 5 | Board 5 | 2 | 0 | 5 | | 10 | Sub For Five | 0 | 5 | 5.10 | //The same with the 10. | 8 | Sub For Five | 0 | 5 | 5.8 | +----+------------------+-----+--------+------+ 11 rows in set (0.01 sec)
-
yeah.. well the names of the boards were to be self explanatory. My goal is to have one SQL command that will display all the boards in their normal order...but putting the sub-boards beneath their parents.
-
I'm not the sharpest tool when it comes to SQL and I"m somewhat stumped here...it seems possible though I may just be dreaming.... Honestly, I just want to keep from calling mysql_query twice and having to use a "while inside a while" approach to it. Anyway. I have this table mysql> select * from boards -> ; +----+-----------------+-----+--------+ | id | name | cat | parent | +----+-----------------+-----+--------+ | 1 | Board 1 | 1 | 0 | | 2 | Board 2 | 1 | 0 | | 3 | Board 3 | 1 | 0 | | 4 | Board 4 | 2 | 0 | | 5 | Board 5 | 2 | 0 | | 6 | Board 3's Sub 1 | 0 | 3 | | 7 | Board 3's Sub 2 | 0 | 3 | +----+-----------------+-----+--------+ 7 rows in set (0.00 sec) Is there anyway possible..any JOIN or some sort of magic that would allow me to achieve these results instead. mysql> select * from boards -> ; +----+-----------------+-----+--------+ | id | name | cat | parent | +----+-----------------+-----+--------+ | 1 | Board 1 | 1 | 0 | | 2 | Board 2 | 1 | 0 | | 3 | Board 3 | 1 | 0 | | 6 | Board 3's Sub 1 | 0 | 3 | // | 7 | Board 3's Sub 2 | 0 | 3 | //.... same thing for a board with a parent id of 5 or 2 | 4 | Board 4 | 2 | 0 | | 5 | Board 5 | 2 | 0 | +----+-----------------+-----+--------+ 7 rows in set (0.00 sec)
-
$b = mysql_query($a) or die("Query: $a " . mysql_error());
-
well I'll be damned...
-
[SOLVED] Extract a specific line from a text file
Zane replied to Jeroen1000's topic in PHP Coding Help
$yourfile = "thelog.txt"; foreach(file($yourfile) as $x) $data[] = explode(':', $x); echo "" , print_r($data), ""; -
try list-style-type: none instead
-
Read all files from folder and handle the lines separately
Zane replied to khosh's topic in PHP Coding Help
look at using foreach http://php.net/foreach foreach($file as $line) echo $line . " \n"; -
$yourFilledArray[] = "blank entry"; for($i=0;$i $yourFilledArray[$i] = $i++; array_shift($yourFilledArray); could work. EDIT: scratch that. EDIT2:Ok..I've done my good deed for the day $someArray = range(1, 100); function PushDownArray(&$row) { $row[] = null; for($i=0;$i} PushDownArray($someArray); echo "",print_r($someArray),""; ?> Executes in 0.0037 seconds
-
why would you want to do that in the first place
-
can you elaborate a little more.. do you mean you want $row[0] to be $row[1]?
-
table.rows[0].cells.innerHTML
-
this is when you would use a loop $offices3 = mysql_fetch_array($offices1); $offices[] = $offices3['Office']; print_r($offices); becomes while($offices3 = mysql_fetch_array($offices1)) { $offices[] = $offices3['Office']; } print_r($offices);