Jump to content

ober

Staff Alumni
  • Posts

    5,327
  • Joined

  • Last visited

Everything posted by ober

  1. PHP 4 or 5?  It's different. http://www.php.net/microtime
  2. And I assume that is in a file called "saveaddress.php"?  That code looks fine except for the fact that all your variables in the VALUES part should be '$_REQUEST['first_name']'... etc.  You can't access the variables directly like that on another page.
  3. Can you show us the code where you're actually using the INSERT statement?
  4. No... I think you misunderstood me.  If I understood you correct, you have the listing already, you just want to limit it to 3 subcategories, right? You can either use the LIMIT clause or a counter variable.
  5. A few things: 1) don't put your table name in quotes: $data = mysql_query("SELECT * FROM user") or die(mysql_error()); 2) print is all lowercase
  6. I think what you're looking for is the LIMIT clause.
  7. Try this: [code]<?php//create subcategories $qc = "select * from dd_subcategories order by SubcategoryName"; $rc = mysql_query($qc) or die(mysql_error()); $subcategories .= "<ul style=\"margin-top:0; margin-bottom:0; margin-left:15\">"; while($ac = mysql_fetch_array($rc)) { //get the subcategories $qsc = "select * from dd_subcategories where CategoryID = '$_GET[CategoryID]' order by SubcategoryName "; $rsc = mysql_query($qsc) or die(mysql_error()); if(mysql_num_rows($rsc) > '0') { while($asc = mysql_fetch_array($rsc)) { //get the items number at this subcategory $qin2 = "select count(*) from dd_items where ItemCategory = '$_GET[CategoryID]' and ItemSubcategory = '$asc[SubcategoryID]' and ItemStatus = 'approved' "; $rin2 = mysql_query($qin2) or die(mysql_error()); $ain2 = mysql_fetch_array($rin2); $subcategories .= "<li><a href=\"ShowCategory.php?CategoryID=$ac[CategoryID]&SubcategoryID=$asc[SubcategoryID]\">$asc[SubcategoryName] ($ain2[0])</a></li>"; } } } $subcategories .= "</ul>"; echo $subcategories; ?> [/code] I think your problem was that you were creating the <ul> each time you entered the loop.
  8. Well, do you have an IP address of the SMTP server?  I'd definatley go that route if you have the information.
  9. Not sure, never used it, but you could try this: http://www.php.net/manual/en/function.image-type-to-extension.php
  10. I don't think there is a way to make the keys read-only.  At least I've never come across it.
  11. Well, there's a flaw in your logic, for starters.  If 1 is friends with 3, 3 also has to be friends with 1. To find the "shortest road", you're going to have to build relationship rules and priority.  Like, if you're trying to find out who is friends with your friends... you're going to have to do a recursive link and it's not always going to be accurate.  It will have to be smart enough to know which path to go down first and which will find the next person faster.  It'll have to be a binary tree or something similar that can traverse the entire system very quickly. I think you'd be better off in a math/discrete math forum for something like this than asking a bunch of code monkeys.
  12. .... SMTP is the protocol.  mail() is a PHP function.  PHPMailer is a class. Maybe you should understand what you're doing before you ask questions.
  13. You should be using a setup like this: [code] <?php if(isset($_GET['page'])) {   switch($_GET['page'])   {       case "1":         require("somepage.php");       break;       case "2":         require("someotherpage.php")       break;       default:         require("index.php");   } } else     require("index.php"); ?> [/code]
  14. Well, you haven't implemented anything as far as user levels in that script or indicated whether you want to use cookies or sessions. As far as that, you just have to check if the cookie is set: [code] <?php if(!isset($_COOKIE['mysite_username'])) {     echo "Please signup"; } else {     echo "Welcome ...."; } ?>[/code]
  15. 1) echo "Welcome " . $_COOKIE['mysite_username']; 2) Depends on your implementation... sessions or cookies: <?php if($_SESSION['user_level'] == 2) {   echo "whatever content"; } else {    echo "other content"; } ?>
  16. SESSIONS.  Look them up in the manual.  See my sig for a link to the manual.
  17. You cannot use an echo before you use setcookie() or ANYTHING that might send output to the file that you are transmitting to the user. You would have to use another cookie to set the user's level, but be aware that this should be encoded somehow.  They could potentially hack the cookie and change the value to allow themselves into your forums.  It's best to just check the user's level from the database each time. EDIT: beaten to it.
  18. We will not condone filesharing/piracy on this site.
  19. Please see conversation in Admin Cafe
  20. I assume you have other rows in the database that it can update? As a troubleshooting technique, you should always build your query outside of the mysql_query() function.  Then you can echo the query to see what is actually going into the query. Also, you're not checking for failure of the query.  You should be doing this: $result = mysql_query($query); if(!$result)     echo mysql_error();
  21. Weird... I would have thought the global mod group would supercede those other groups.  I'll have to look into that.
  22. What exactly are you coloring in the row?  Normally when I alternate row colors, I color the actual <td> elements, not the <tr>. When you say it's not working, is it just not coloring the rows or are you getting an error?  Have you looked at the HTML code once the page is created to make sure that the output is what you expect?
  23. You would have to run the same sort of SQL query for the page contents.  Your actual content display function can be kind of generic, but you just plug the ID from the URL into the SQL statement to get the different content.  Now, where it can get somewhat tricky is if the content is actually specific to one user.  In that case, you just store the userid AND the page id in the contents table and use an AND in your WHERE clause to grab the right data. Does that make sense?
  24. I'm able to send them... but I'm not completely surprised.  Wildteen, can you try to reply to the one I sent you and then try to send me a new one as well?
  25. When you're using more than one $_GET variable, it should always be like this: www.myurl.com?user_id=1&page=x After the initial question mark, you have to use ampersands.  And if you're coding the links on the page, always use the HTML equivalent &amp;
×
×
  • 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.