Jump to content

soltek

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Everything posted by soltek

  1. Hey guys, I'm trying to customize the look of a script, but I'm having issues extracting the output of a string - I think that's a string. This is the the code the function/string: function notice(){ printf($this->lang['notice'],Tools_get::convert_time($this->ttl*60),$this->limitPERIP,Tools_get::convert_time($this->ttl_ip*60)); $this->CheckMBIP(); $MB1IP = Tools_get::convertmb($this->countMBIP*1024*1024); $thislimitMBIP = Tools_get::convertmb($this->limitMBIP*1024*1024); $maxsize = Tools_get::convertmb($this->max_size_other_host*1024*1024); printf($this->lang['yourjobs'],$_SERVER['REMOTE_ADDR'],$this->lookup_ip($_SERVER['REMOTE_ADDR']),$this->max_jobs_per_ip,$MB1IP,$thislimitMBIP); printf($this->lang['status'],$maxsize,count($this->jobs),$this->max_jobs,$this->get_load(),$this->max_load,Tools_get::useronline()); } And this is the code on the footer that display the IP address, maximum jobs and stuff: <?php echo $obj->notice();?> This last line prints everything I need on the page, but I wanted to put them inside <span>s, to I tried to do something like: <span><?php echo <?php echo $config->lang['yourjobs'] ?></span> But it doesn't work. Can you give me hand please?
  2. This is the SQL table: id parent_id name image 1 0 cars 2 1 ford 16 13 Other Bracelets 9 0 Pendants 1333394949.jpg 10 9 Silver Pendants 1333394961.jpg 11 0 Blue Pendants 1333394975.jpg 12 9 Blue Pendants 1333395004.jpg 13 0 Bracelets 1333395054.jpg 14 13 Silver Bracelets 1333395068.jpg 15 13 Children Bracelets 1333395093.jpg Some subcategories aren't visible. Actually only: Ford Silver Bracelets Children Bracelets Silver Pendants Blue Pendants And this only happens after I delete the categories and subcategories from the SQL code you guys gave me. I tried to delete all but one - cars - but that didn't work either.
  3. Hmmm this is weird. I just created the categories table again, using the SQL code you guys shared with me earlier, and the subcategories thingy works properly. I deleted all the rows from that table and added the new categories and subcategories guess what? There were no subcategories on the HTML output. I created the table again using the SQL code, added the new categories and subcategories withougt deleting the categories added using the SQL code and... it works. Any idea what's going on?
  4. Here: Array ( [23] => Array ( [id] => 23 [parent_id] => 0 [name] => Bracelets [image] => 1333296301.jpg ) [27] => Array ( [id] => 27 [parent_id] => 0 [name] => Pendants [image] => 1333296468.jpg ) )
  5. Anyone? I'm using this code <?php $mysqli = new mysqli('localhost', 'root', 'root', 'test'); $query = 'SELECT id, parent_id, name, image FROM categories'; $result = $mysqli->query($query); if ($result->num_rows > 0) { $categories = array(); while($row = $result->fetch_assoc()) { if ($row['parent_id'] != 0) { $categories[$row['parent_id']]['sub'][] = $row; } else { $categories[$row['id']] = $row; } } echo '<ul>'; foreach($categories as $cat) { echo '<li>'; if ($cat['parent_id'] == 0) { echo $cat['name']; } if (isset($cat['sub']) && is_array($cat['sub'])) { echo '<ul>'; foreach($cat['sub'] as $sub) { echo '<li>' . $sub['name'] . '</li>'; } echo '</ul>'; } echo '</li>'; } echo '</ul>'; } else { echo 'There are no categories'; } It kinda works, but the output display no sub-categories, when in should. I think the problem may be in this line: if (isset($cat['sub']) && is_array($cat['sub'])) { [/doce]
  6. I don't get it Where does this: $categories[$row['parent_id']]['sub'][] = $row; comes from -the sub part?
  7. Only up to one level. Each category may have more than one subcategory, but that's it.
  8. Oh okay. Category table: - ID - name - image Subcategory table: -ID -name -image -parent
  9. Hello there, this is a really noob question, but I've no idea on how to make it work without making everything messy and crappy. I have one SQL table called categories, and another called subcategories. Inside the subcategories table there's a field named 'parent' that will link it to the correspondent category, so it should look something like this in html: <ul> <li>Category <ul> <li>Subcategory</li> </ul> </li> </ul> Would you please give this poor guy a hand? =)
  10. Thanks a lot =) Would you please tell me you share a link about what does the '+' sign stands for on this line? $('#'+this.title).show('slow');
  11. Oops, I forgot to say I'd like to do it using Jquery. I kinda know how to use the 'hide' and 'show', but I've no idea about how to display automatically the correspondent element.
  12. Here I am once again, guys =) First, my markup: <div class="items_list"> <span ID="1">Item</span> <span ID="2">Item</span> <span ID="3">Item</span> </div> <div class="content_list"> <div id="1">Content</div> <div id="2">Content</div> <div id="3">Content</div> </div> So, all the divs inside .contant_list are hidden using css, what I'm trying to do is to make them visible, once the correspondent span is clicked. For example, you click on the second span, with ID=1, and the div with the same ID would become visible. Can you help me do that? If this method isn't... suitable, you can suggest me another ones. Thanks!
  13. Hey guys, I've been using JQuery for the last week (amazing stuff) and I've come to a problem. What I did is this: »A page with two buttons, each of them grabs another file from the server and display it on the div bellow. This using the .load function. (just like an old iframe) That .load function loads a table that one has one toggle action. When you click on each row, it would slideDown another div. And here's the problem, everything works fine, the .load and the slideDown, but after loading the content, the slideDown doesn't work anymore. I think the problem is that the loaded page isn't being affected by the JS code contained in the header. As a test I made a simple hide-on-click on that page and that didn't work either. So, my question is, after the page is .load(ed), I can't grab the content from the page where it is being loaded? Thanks!
  14. Hello again, guys! I'm trying to do this: Get $user_ID -> SELECT FROM favorites WHERE user="$user_ID" -> Now I should create an array with the ID of all the results of the previous command -> SELECT FROM books WHERE genre="$favorites_ID" -> populate a html table. The part I've no idea about how to do is building an array with the results and then using the SELECT command, find in the other tables the match. Could you please give me a hand - one more time?
  15. Sorry for being an undertaker, but I dont think my question needs a new topic. So, does this function includes the 'daylight saving time' thing?
  16. I'm a noob - ORLY - could you tell me how to do that? If you have a link about it, it would be even better But thanks
  17. Hey there, could you give this at this piece of code? It's giving me this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/xxxxx/public_html/Tyler/index.php on line 99 (the line 99 is the one with the sprintf) echo" if( $diff=@get_time_difference($start, $end) ) { sprintf( '%2d days %02dh%02dm', $diff['days'], $diff['hours'], $diff['minutes'] ); } "; Danke!
  18. Hey there, this is a bit embarrassing, but I dont know how to store correctly, dates on a SQL table. I've been googling it for a while and got confused. So, I have a table, where the user would type a date, as 20/10/2012 23:30 inside a form field. That form would store the date in the sql table. Do you know any website that explains how to send the information properly? Also, later I'll need to print on a page how much time lefts to that date - in this case, one year. Would a simple subtraction do? Thanks!
  19. Got you. I thought something was wrong because it doesnt use to look like that. It uses to be 1 2 3 4 14 15 17, nor 1 2 3 4 17 16 15 14. I had the idea that this would affect the performance, but I guess not. Thanks
  20. That's a pretty good question, my friend
  21. Hey there, I just noticed that my auto_increment of the new entries is... well, backwards. Like: ID 1 2 3 4 17 16 15 14 13 12 [...] You know what I mean? If I add another entry, whose ID value would be 18, it would be added not to the end of the table, but after the forth, instead. Do you know how to fix it? I think it may harm the performance. Cheers!
  22. Hey there, this has both HTML and PHP, but I chose this section. I hope it's okay. So here's the thing. I know how to use forms to upload pictures into a server folder using php and html, but the issue is now I need to submit: » Text details such as Product Name and Price; » One image to folder ABC; » 3 images to folder XYZ; Do you know if this can be done? If it's possible, could you enlighten me? Thanks!
  23. Hey again, My purpose is to warn my customers that the products they've purchased will be having an update a day later. Displaying a message like «Tomorrow 2 of your products can be updated» » I have one table called Bought storing each purchase, with it's buyer and product id; » I have one table called Productsshedule that has the product ID. Also I have created an array that stores in the page which products the client has bought and another array with the products' updates comming on the next day. How can I make it so it looks into the matches between updates array and bought products array?
  24. I got it, the in_array built-in function is pretty handy.
  25. Oh, actually it would be better to use have a sql query to look for all the products bought by the member, storing them in a array and then compare the ID of the product listed on the page, with the ID of the products in the array. Is this correct?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.