Monkuar
Members-
Posts
987 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Monkuar
-
im not explaining myself ebtter $this->output .= $this->html->subs_row($topic); if ($counter > 4){ $this->output .= <<< E </table></dd> E; } this needs to be outputted inside the loop bro, I CANNOT use this outside of my LOOP.... if i did, it doesn't display right.. the $counter++ shows 4 oujtside of my while loop, im sick and tired of why it cant show j ust SHOW "4" inside myloop, ridicilious instead it shows 1234
-
i see what you are trying to do, the code that we have already provided is what you need, attempt to implement it into your code. But, to answer your question on why substr() isn't working. 1. $cats will not contain 1234567 when echoed after the loop is finished 2. substr() expects parameter 1 to be type string, $cats is type int 3. if you want the last iteration value outside of the while loop, $counter will hold that value outside of the loop, if you want to echo something on the last iteration, refer to the code already given. if($index == $DB->get_num_rows()) //this indicates the last iteration { $this->output .= <<< E </table></dd> E; $last_iteration = $index; //stores the last iteration value } i put in $index = 1; ontop of my loop that doesn't seem true and it returns false
-
All I need is to get the amount of Categorys... .the user has and use it in my while loop, but i cant
-
substr removes a portion of a string, it has nothing to do with what you are trying to do. Unless you actually post code we can't really help you any further. ok fine be warned it's bad $DB->query("SELECT s.trid, s.member_id, s.topic_id, s.last_sent, s.start_date as track_started, t.*, f.id as forum_id, f.name as forum_name, f.read_perms " ."FROM ibf_tracker s, ibf_topics t, ibf_forums f " ."WHERE s.member_id='".$this->member['id']."' AND t.tid=s.topic_id AND f.id=t.forum_id " ."ORDER BY f.id, t.last_post DESC"); if ( $DB->get_num_rows() ) { $last_forum_id = -1; while( $topic = $DB->fetch_row() ) { $counter++; if ($last_forum_id != $topic['forum_id']) { $cats++; $last_forum_id = $topic['forum_id']; $this->output .= <<< E <td colspan=10><dl><dt><a href=?z={$topic['forum_id']}>{$topic['forum_name']}</a></dt><dd> <table class="tuble"> 25 E; } $topic['last_poster'] = ($topic['last_poster_id'] != 0) ? "<b><a href='{$this->base_url}?i=03&MID={$topic['last_poster_id']}'>{$topic['last_poster_name']}</a></b>" : "-".$topic['last_poster_name']."-"; $topic['starter'] = ($topic['starter_id'] != 0) ? "<a href='{$this->base_url}?i=03&MID={$topic['starter_id']}'>{$topic['starter_name']}</a>" : "-".$topic['starter_name']."-"; if ($topic['poll_state']) { $topic['prefix'] = $ibforums->vars['pre_polls'].' '; } $topic['folder_icon'] = $std->folder_icon($topic); $topic['topic_icon'] = $topic['icon_id'] ? '<img src="'.$ibforums->vars[html_url] . '/icon' . $topic['icon_id'] . '.gif" border="0" alt="">' : ' '; if ($topic['pinned']) { $topic['topic_icon'] = "<{B_PIN}>"; } $topic['start_date'] = $std->get_date( $topic['track_started'], 'LONG' ); if ($topic['description']) { $topic['description'] = $topic['description'].'<br>'; } $pages = 1; if ($topic['posts']) { if ( (($topic['posts'] + 1) % $ibforums->vars['display_max_posts']) == 0 ) { $pages = ($topic['posts'] + 1) / $ibforums->vars['display_max_posts']; } else { $number = ( ($topic['posts'] + 1) / $ibforums->vars['display_max_posts'] ); $pages = ceil( $number); } } if ($pages > 1) { $topic['PAGES'] = "<span class='small'>({$ibforums->lang['topic_sp_pages']} "; for ($i = 0 ; $i < $pages ; ++$i ) { $real_no = $i * $ibforums->vars['display_max_posts']; $page_no = $i + 1; if ($page_no == 4) { $topic['PAGES'] .= "<a href='{$this->base_url}a=ST&f={$this->forum['id']}&t={$topic['tid']}&st=" . ($pages - 1) * $ibforums->vars['display_max_posts'] . "'>...$pages </a>"; break; } else { $topic['PAGES'] .= "<a href='{$this->base_url}a=ST&f={$this->forum['id']}&t={$topic['tid']}&st=$real_no'>$page_no </a>"; } } $topic['PAGES'] .= ")</span>"; } if ($topic['posts'] < 0) $topic['posts'] = 0; // Do the quick goto last page icon stuff $topic['last_post_date'] = $std->get_date( $topic['last_post'], 'LONG' ); $this->output .= $this->html->subs_row($topic); echo 4; if ($counter > 4){ $this->output .= <<< E </table></dd> E; } } } else { $this->output .= $this->html->subs_none(); } I need the $counter to be > 4 and 4 has to be dynamic based on the content generated, because the </table> and </dd> shows the end of the category per row, it's confusing but the code: if ($last_forum_id != $topic['forum_id']) { $cats++; $last_forum_id = $topic['forum_id']; $this->output .= <<< E <td colspan=10><dl><dt><a href=?z={$topic['forum_id']}>{$topic['forum_name']}</a></dt><dd> <table class="tuble"> 25 E; } is what shows each Category, then the forum data under neath it, but the stupid part is I cant even copy paste this and use it at the bottom? it's retarded, I have to use some counter thing, really pissing me off
-
LOOP $cats++; LOOP my code echo substr($cats, -1); Does not display my last number? This is getting retarded, the substr code on php.net says it display the LAST NUMBER/STRING using the -1, and it does not. your guys code not working because the num_rows is to broad, hence im only counter if the data is a Category of a forum, not all the data
-
Yes, when i Do it, it echo's 1234567 but how can I get just "7" out of the loop? i need to use it in a variable i dont need to use the 1234567 just need the last number, or the sum of all which is 7 last time i checked, 1+2+3+4+5+6+7 != 7, but maybe something changed. okay so you want to only echo the last iteration, or store it in a variable. Can you post the loop so I can have a look? Yea i just need to get the last number, lol my bad. while( $topic = $DB->fetch_row() ) { $counter++; { the query just seleects some dumb mysql data for testing I just need need to echo out the last number in the $counter++, I know 1234567 = 7 numbers, but I am doing a if statement if ($counter > 4){ $this->output .= <<< E </table></dd> E; } and I need to get my 4 to a different variable so it matches my database, it's really confusing atm, but if I can just get the $counter to show the last number instead of 1234567 it would work my code is to big/crap to post all of it it's confusing as is
-
Yes, when i Do it, it echo's 1234567 but how can I get just "7" out of the loop? i need to use it in a variable i dont need to use the 1234567 just need the last number, or the sum of all which is 7
-
I have a $counter++ it goes inside my while loop but it echo's out 12345 instead of the amount of the all of them? (like 1 2 3 4 5 should echo out 5.. not 12345 ? any help? i think my brain farting atm lol i even tried to wrap count around it, doesnt wokr
-
Wow, lol never knew you could use if's in mysql, rofl this is great code, saved for future use to, and i am going to study this,
-
Here's a update, it's not showing amount2? $DB->query("SELECT SUM(amount) FROM gold_logs WHERE from_id = {$ibforums->member['id']} GROUP BY from_id UNION SELECT SUM(amount) as amount2 FROM gold_logs WHERE to_id = {$ibforums->member['id']} GROUP BY to_id"); $data = $DB->fetch_row(); When I echo out the data it shows: Incoming Gold: <b>{$data['SUM(amount2)']}</b> it doesn't show amount2? but shows 1?
-
$DB->query("SELECT SUM(amount) FROM gold_logs WHERE from_id = {$ibforums->member['id']} GROUP BY from_id"); $data = $DB->fetch_row(); Okay, then I echo out {$data['SUM(amount)']} but I want to select the sum(amount) from "to_id" ALSO! how can I add that into the query I dont want to use 2 queries, thanks
-
thanks bunch' topic resolved
-
With unixtimestamps? I have let's say 20records, and like 5 of them are from January and 15 are in February, how would I go about showing all the records that were just in February (2012) or maybe 2013? (trick is using timestamps) Pretty much sort the records by each Monthy, by using unixtimestamp as the value in the db field, possible?
-
Okay, I have a 3 column table layout on my forum, I want users to beable to select where they want 1 of there profile sections to go under, (and display order) either, left middle or Right side. See now I can code the javascript/etc ajax to make them update if selected to move to (any direction) But I need help to do it server side, what kind of value/row in my db should i use? just 1 field and use arrays? Also, let's say I want to move the "Calendar" to the middle or far right, and save that position, what kind of functions would i be working with (in php) I can prob do it if I use like 200 IF and ELSE conditions, but that would take way to long, any help?
-
Im still confused $card1 = rand(1,4); $card2 = rand(1,4); if ($ibforums->input['id'] == "1"){ if($card1 == "1" && $card2 == "1"){ if my stuff is 1 in 4 chances and it both has to equal the same "1" that would be 25% divided by 2 which is 12.5% of winning right?
-
$card1 = rand(1,3); $card2 = rand(1,3); /// check money win //////// if($card1 == "1" && $card2 == "1" ){ echo "You won 100$?"; exit; mysql_query("UPDATE card SET money='$win_money' WHERE name='$name'"); } My code works wonderfully prob tho how can I show the odds of winning out of 100 to my suer?
-
how to select name from db with special characters?
Monkuar replied to Monkuar's topic in PHP Coding Help
blah it seemd like something from ibforums was making it get convered into hex -
how to select name from db with special characters?
Monkuar replied to Monkuar's topic in PHP Coding Help
$user= mysql_real_escape_string($ibforums->input['to']); $DB->query("SELECT id,name from ibf_members where lower(name = '{$user}') LIMIT 1"); $e2 = $DB->fetch_row(); if ($e2['id']){ }else{ $std->Error2("Username doesn't exist dude"); } doesn't work either , $ibforums is escaped too Thanks for ur comment anymore idea? -
$DB->query("SELECT id,name from ibf_members where name = '{$ibforums->input['to']}' LIMIT 1"); $e2 = $DB->fetch_row(); if ($e2['id']){ }else{ $std->Error2("Username doesn't exist dude"); } Ok, if I put in my username let's say 1of my users name is "$tabB" if I do that, it doesn't work is there a work around?
-
Of course not. PHP is open source. What mods do you think he did to make it run so fast? must have a dedi server or root to kernal? i can mod php if I do it on my vps right? i got access to the files? lol were would I start? isn't php fast enough?
-
the guy that told me this is the admin @ d2jsp.org (worlds fastest forum) it's on php too..... on his last post, he said: http://forums.d2jsp.org/topic.php?t=60533349&f=126&p=405037537 is it illegal to hack into php and edit source?
-
"I'm also running a forked version of php, that has many custom additions and modifications that I added to it, which helps keep everything running as fast as it does" what does saying u have a "forked" version of php and makes your site run super fast, wats this mean? What exactly can u edit in your php config to make it faster? I thought only php accelerators do that? lol
-
this data will not be searched though, (didn't point that out, my fault) here is a s/s of what the data looks like that is being called This way would be better instead of adding 8 more rows to call each | data right? See, i would have to add like 12 more fields just to get the data I want to pull out, but doing it this way it's alot simpler to me (IMO) These is the board's main stats (it's being called whenever sum1 visit's the board forum index) it should be fine? there both varchar's (100)
-
Does storing multiple values in 1 database field with a varchar let's say set at 150, all separated by "|'s" so I don't have to create a field name for each one is it better performance wise or no? (storing 6-7 different |'s that will be outputted with a array ofc) ?
-
Wow, wonderful Psycho, I added that to it for even more security, (Sick of tamper data noobs) This lottery system is actually turning out greater then expected, I am learning so much in so little time, it's crazy, Thank you. I will be adding more validations with that code also if I ever want to change the way the lottery works, this is Great!