...

View Full Version : Can YOU PLEASE Confirm if I am Right Or Wrong With This Code?



Byronwells
03-20-2010, 07:27 AM
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/member/marketplace.php?cat=t&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



// 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.



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...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

met
03-20-2010, 01:39 PM
don't really understand you but if you want the most recent result returned first in the record set change the query to this ~



$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".

Byronwells
03-20-2010, 02:09 PM
don't really understand you but if you want the most recent result returned first in the record set change the query to this ~



$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



<?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

met
03-20-2010, 02:32 PM
glad you can read properly





$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".

Byronwells
03-20-2010, 02:53 PM
glad you can read properly

what is that suppose to mean? You put down the word primary key. How was I suppose to know??

MattF
03-20-2010, 09:01 PM
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.

Byronwells
03-20-2010, 09:13 PM
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

met
03-20-2010, 09:37 PM
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.

MattF
03-20-2010, 10:26 PM
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?

Byronwells
03-21-2010, 09:23 PM
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

mlseim
03-21-2010, 09:39 PM
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.

Byronwells
03-21-2010, 09:50 PM
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....

MattF
03-21-2010, 10:28 PM
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.

Byronwells
03-22-2010, 12:20 AM
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

MattF
03-22-2010, 12:54 AM
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?

vinyl-junkie
03-22-2010, 01:30 AM
That's enough, people. One more rude remark from anyone in this thread, and it will be closed.

Byronwells
03-22-2010, 01:36 AM
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?

Mattf

You can only keep badgering something if you are correct...

Be considerate to those whom you ask for help...

Which I was! Which does not include you one bit because YOU was not being helpful at all.. And I have already proved that! So why cant you get your facts right first...

Byronwells
03-22-2010, 01:37 AM
That's enough, people. One more rude remark from anyone in this thread, and it will be closed.

Please close this thred.. Becuase now Mattf is now really 100 percent trying to wind me up. There was no point for his remark to begin with



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum