Jump to content

Archived

This topic is now archived and is closed to further replies.

OLM3CA

approval comments

Recommended Posts

hi i would like to ask a question.
I have a link submit form. Firstly I want to see the submitted links and than if its ok,I want to approve it and let it display in homepage.I mean the posted links can not be displayed,if I dont approve it.How can I do this ? i have some thought some ways but confused.Store them in a table like temp table and then transfer them to my real table ?

and I have another question.I want to show the catagories (no problem with this) and then show the links that is related with that catagorie.Is this correct ??? How can I jump from catagories to Links table.

[color=red]create table Catagories[/color]
[color=green]cat_id  (key)
catagory_name[/color]

[color=red]create table Links[/color]
link_id (key)
[color=red]cat_id[/color]
link_title
link_url
link_desc

I am sorry for my english.

Share this post


Link to post
Share on other sites
This should be a fairly simple fix for ya = )

Add a new field to the links table that has `status` with a default of 0.  When someone submits a new link it will automatically take on the status of 0.  When you authorize the link, it can update the field to 1.  When you query your links, just show only the links that are equal to 1.

As for the categories -> links question, do something like this.

[code]
<?php
$sqlCategories = mysql_query("SELECT cat_id, category_name FROM categories ORDER BY category_name ASC") or die (mysql_error());
while ($Category = mysql_fetch_array($sqlCategories)) {
  $sqlLinks = mysql_query("SELECT link_id, cat_id, link_title, link_url, link_desc FROM links WHERE cat_id = $Category[cat_id] AND status = 1 ORDER BY link_title ASC") or die (mysql_error());
  // You can output your categories here
  while ($Links = mysql_fetch_array ($sqlLinks)) {
    // output your links here
  }
}
?>
[/code]

Share this post


Link to post
Share on other sites
Thank you very much gijew;This is out of question but if I have 30,40 mysql queries is it normal ? :)

Share this post


Link to post
Share on other sites
Don't apologize for your English, your question was quite a bit clearer than many of the native speakers I've seen post on here

Share this post


Link to post
Share on other sites

×

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.