Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Can YOU PLEASE Confirm if I am Right Or Wrong With This Code?

    Alright guys

    I really need your help... I would like you to confirm if this is right or not please... I shall do my best to explain...

    Right firstly I am using a membership script called simple member pro, you can see it here http://www.digitalresellersvault.com...&category=demo



    For over the past month I have been trying to work out how to get the newest category that I have added to the site to appear under the newest product url link...

    I have found these two bits of code

    Code:
    // catagory list
    	function categories($db_domain)
    		{
    		include "/home/megagame/public_html/digitalresellersvault.com/common/config.php";
    	
    		$query  = "SELECT * FROM ".$prefix."category order by cat_name asc";
    		$result = mysql_query($query);
    		$admin_ads_top = "";
    		$kk=0;
    		while ($row = mysql_fetch_array($result, MYSQL_NUM))
    			{	
    			$kk++;
    			$tr=$etr=NULL;
    			
    			$tr="";
    			
    			
    		
    			$cat_title=$row[1];
    			// Count how many products in this catagory 
    			
    			$qry="select count(*) as cnt from ".$prefix."products where category='$cat_title'";
    			$presult = $db_domain->get_a_line($qry);
    			$pcount=$presult[cnt];
    			
    			
    			
    			$link = $cat_title;
    			$link 	= preg_replace('/([^a-z0-9])+/i', '_', $cat_title);
    			$starttable="<li>";
    			$endtable = "</li>";			
    			$admin_ads_top.="$starttable <a href=marketplace.php?cat=t&category=$link><font color=#0000FF>$cat_title</font></a> ($pcount)$endtable";			
    			$tr=$etr=NULL;
    			}
    		$admin_ads_top.="";	
    		return $admin_ads_top;
    		}
    The above code allows me to display the categories under the browse by category section on the left hand side of the page.

    Code:
    function category_select($db_domain, $selectid)
      {
      include "/home/megagame/public_html/digitalresellersvault.com/common/config.php";
      $query  = "SELECT * FROM ".$prefix."category";
      $result = mysql_query($query);
      $select = '<select name="$selectid" id="$selectid">';
      $select .= '<option>&lt;-- Select Category --&gt;</option>';
      while ($row = mysql_fetch_array($result, MYSQL_NUM))
      {
      $select .= '<option value="'.$row[0].'">'.$row[1].'</option>';
    
      }
      $select .= "</select>";
      return $select;
      }
    The above code allows me to display the categories in the drop down box in the search section on the right hand side..


    Well I am thinking do I have to create another function class.. lets says newest and then some mysql php code to get the newest product page to work?

    Please can you confirm...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • #2
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    don't really understand you but if you want the most recent result returned first in the record set change the query to this ~

    PHP Code:
    $query  "SELECT * FROM ".$prefix."category order by `PRIMARY_KEY` desc"
    where PRIMARY_KEY is the primary key/index of the table.

    it's not foolproof but reliable enough. it's the easiest way without having to add a new attribute like "date added".

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by met View Post
    don't really understand you but if you want the most recent result returned first in the record set change the query to this ~

    PHP Code:
    $query  "SELECT * FROM ".$prefix."category order by `PRIMARY_KEY` desc"
    where PRIMARY_KEY is the primary key/index of the table.

    it's not foolproof but reliable enough. it's the easiest way without having to add a new attribute like "date added".
    I have just added your query to this page code

    Code:
    <?php
    include_once ("header.php");
    $cat = $_GET["cat"];
    $link = $_GET["category"];
    $search = $_GET["search"];
    $cat_title = str_replace("_"," ",$link);
    
    if($cat != "t")
    	{
    	$GetFile = file("http://www.digitalresellersvault.com/template/template.php");
    	$Content = join("", $GetFile);
    	$categories=$common->categories($db);
    	$content=str_replace("{categories}",$categories,$content);	
    	$Pat = "/<{Begin}>(.*?)<{End}>/s";
    	preg_match($Pat,$Content,$Output);
    	$SelectedContent = $Output[1];
        
     $query  = "SELECT * FROM ".$prefix."category order by PRIMARY_KEY desc";
    	$r = $db->get_a_line($q);
    	$id = $r[id];
    	$imageurl = $r[imageurl];
    	$prod_description = $r[prod_description];
    	$salesprice = $r[price];
    	$product_name = $r[product_name];
    	$salespage_link='<a href="prods.php?pid='.$id.'">Click Here For More Information</a>';
    	$product_name='<a href="prods.php?pid='.$id.'">'.$product_name.'</a>';			
    	$prod_image='<a href="prods.php?pid='.$id.'"><img src="images/'.$imageurl.'"></a>';		
    	$Content = preg_replace($Pat,$ToReplace,$Content);
    	$Content = preg_replace("/{{(.*?)}}/e", "$$1", $Content);
    	echo $Content;
    	include_once ("footer.php");		
    	exit();		
    	}
    include_once ("footer.php");
    ?>
    Onto this page http://www.digitalresellersvault.com/member/newest.php

    What is suppose to happen it suppose to show the latest category in this instance it would the specials category but doesnt show anything

  • #4
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    glad you can read properly

    Quote Originally Posted by met View Post
    PHP Code:
    $query  "SELECT * FROM ".$prefix."category order by `PRIMARY_KEY` desc"
    where PRIMARY_KEY is the primary key/index of the table.

    it's not foolproof but reliable enough. it's the easiest way without having to add a new attribute like "date added".

  • #5
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by met View Post
    glad you can read properly
    what is that suppose to mean? You put down the word primary key. How was I suppose to know??

  • #6
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by Byronwells View Post
    How was I suppose to know??
    By reading his post and taking note of what he had written. He made it quite plain to understand.

  • #7
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by MattF View Post
    By reading his post and taking note of what he had written. He made it quite plain to understand.
    Matt

    Please dont try and get smart.. You know exactly what you are trying to cause when you left the above post.. So Watch it

  • #8
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    Quote Originally Posted by Byronwells View Post
    what is that suppose to mean? You put down the word primary key. How was I suppose to know??
    and how am i supposed to know what your tables primary key is called? think a little for yourself, else i'm just wasting my time trying to help you.

  • #9
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by Byronwells View Post
    Matt

    Please dont try and get smart.. You know exactly what you are trying to cause when you left the above post.. So Watch it
    Pointing out a simple fact is not 'trying to be smart' in any way or form. If you had some sense, you would take heed and actually start paying attention to the help which people give you, without getting arsey, just because they say something you don't like when you continually insist on ignoring parts of their post.

    People on here are not bound to help you in any way or form. They do so out of their own goodwill. You should be grateful for any help and advice which you receive, and you should at least have the courtesy to pay attention to the advice they give, instead of literally wasting their time. The worst part is that you continually get arsey as soon as you receive any comment which you don't like.


    p.s: Watch what, btw? You think I honestly give a toss regarding your opinion of I?

  • #10
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by MattF View Post
    Pointing out a simple fact is not 'trying to be smart' in any way or form. If you had some sense, you would take heed and actually start paying attention to the help which people give you, without getting arsey, just because they say something you don't like when you continually insist on ignoring parts of their post.

    People on here are not bound to help you in any way or form. They do so out of their own goodwill. You should be grateful for any help and advice which you receive, and you should at least have the courtesy to pay attention to the advice they give, instead of literally wasting their time. The worst part is that you continually get arsey as soon as you receive any comment which you don't like.


    p.s: Watch what, btw? You think I honestly give a toss regarding your opinion of I?
    Matt lets get it right.. The only reason you left your comment in the first place was to patronize someone, ie me.. Or you would not have left in the tone that you did...

    "By reading his post and taking note of what he had written. He made it quite plain to understand. "

    There was no need for that post at all.. You never came on here to help at all.

    Did you really leave a comment that was helpful?? No you didnt.. You left a comment to start an agruement that is why I said dont try and get smart, because you knew what your intentions was by leaving that orginal comment

    Now before I report your to the moderators of this site. I suggest that you should stop

  • #11
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,549
    Thanks
    8
    Thanked 1,095 Times in 1,086 Posts
    Byron, with all due respect, we don't know what your MySQL variables are called.
    It's hard to provide a query example without using (or knowing) your variable names.

    The project you're working on is very complex and difficult to troubleshoot.
    I've had this discussion with you before about allowing us (or anyone) to go into
    your FTP account and try to help you out by actually seeing the whole project, and
    allowing us to try a few things out ... allowing us to test-out the ideas we might have.
    You have, with good reason, reluctance to let anyone go into your files. I totally
    understand that, and respect that ... but, we're driving blind.

    Out of frustration, we're trying our best. We can't test-out any ideas we suggest.
    Nothing is worse for a programmer than to "guess" about a script. I hate to sign my
    name to any script that fails, but most of the time, my "guesses" fail.

  • #12
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Byron, with all due respect, we don't know what your MySQL variables are called.
    It's hard to provide a query example without using (or knowing) your variable names.

    The project you're working on is very complex and difficult to troubleshoot.
    I've had this discussion with you before about allowing us (or anyone) to go into
    your FTP account and try to help you out by actually seeing the whole project, and
    allowing us to try a few things out ... allowing us to test-out the ideas we might have.
    You have, with good reason, reluctance to let anyone go into your files. I totally
    understand that, and respect that ... but, we're driving blind.

    Out of frustration, we're trying our best. We can't test-out any ideas we suggest.
    Nothing is worse for a programmer than to "guess" about a script. I hate to sign my
    name to any script that fails, but most of the time, my "guesses" fail.
    MSLEIM

    Alright how are you doing?

    I have no found a way that I can allow you to see the script and files without actually giving you all my login details to my server, etc.. No it has got nothing to do with download the files I can now let you access my computer screen and do it that way, that way I can monitor what you are anyone else is doing....

  • #13
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by Byronwells View Post
    There was no need for that post at all.. You never came on here to help at all.
    I've never come on here to help? That's good to know.


    Did you really leave a comment that was helpful?? No you didnt.. You left a comment to start an agruement that is why I said dont try and get smart, because you knew what your intentions was by leaving that orginal comment
    The comment was extremely helpful. You just refuse to understand the point of it. I know I, for one, no longer answer any of your questions due to your arsey attitude when you receive any answer you don't like, and your near total inability to pay attention to the advice given you. Occasional misinterpretation and outright time wasting are two different things. The latter appears to be your forte.


    Now before I report your to the moderators of this site. I suggest that you should stop
    If you want arse kissing, then *pay* someone to do your work, otherwise, tough. Feel free to report me, btw. I've hardly been insulting. If you believe otherwise, you know where the report button is.

  • #14
    Regular Coder
    Join Date
    Dec 2009
    Posts
    243
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by MattF View Post
    I've never come on here to help? That's good to know.




    The comment was extremely helpful. You just refuse to understand the point of it. I know I, for one, no longer answer any of your questions due to your arsey attitude when you receive any answer you don't like, and your near total inability to pay attention to the advice given you. Occasional misinterpretation and outright time wasting are two different things. The latter appears to be your forte.




    If you want arse kissing, then *pay* someone to do your work, otherwise, tough. Feel free to report me, btw. I've hardly been insulting. If you believe otherwise, you know where the report button is.
    When did I ever say I wanted an arse kiss? Again you have just persume that... If you are going to open your mouth or write anything then you need to know the facts, and not the facts that you think are correct, but the actual trurth.. Which is very obvious that you have no clue in.

    I never said that you did not come in here to help no one.. I said you came here in to start an arguement which means that you did not want to help me.. I am not talking about if you have help other people or not, am I??

    And again you claim that I am wasting peoples time by writing a post and asking for help? Len Whistler have helped me before and several other coders have helped me and I have taken their advice.. So yet again you have got your facts wrong..

    MattF if you are going to open your mouth. Write anything then you need to make sure you have the facts. Instead of delibrating going on to a post and think you are way better than that person because they are asking for help...

    Now just leave it

  • #15
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by Byronwells View Post
    MattF if you are going to open your mouth. Write anything then you need to make sure you have the facts. Instead of delibrating going on to a post and think you are way better than that person because they are asking for help...

    Now just leave it
    I'll keep badgering on until I'm forced to stop or it sinks in.

    Be considerate to those whom you ask for help.

    Is that plain enough?


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •