Jump to content

bujashaka

New Members
  • Posts

    3
  • Joined

  • Last visited

bujashaka's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello. I'm in need of help when it comes to page rendering, is it good practice to have own html file for each controller and controller->method OR 1 view file for each controller and then dynamically change content depending on the method? My structure is like so: controllers methods ------------- services-> repair, car glass..... info-> contact, about me..... What is the best or good practice to handle the content in the view? The content is always the same. Thanks in advance.
  2. Hello! I've been into mysql and encountered a problem, not serious one but it is bugging me. I can do dynamic page linking as follows, in short hand.... echo "<a href=\"foo.php?page=" . $vastaus['id'] ."\">" . $vastaus['menu_name'] . "</a><br />"; // URL LINK function showcontent() { /// FUNCTION TO DISPLAY CONTENT FROM SERVER. global $yhteys; $sql = "SELECT * "; $sql .= "FROM subjects "; $sql .= "WHERE id=" . $_GET['page']; $kysely= mysql_query($sql, $yhteys); $content = mysql_fetch_assoc($kysely) or die(mysql_error()); echo strip_tags($content['content'], "<br><dt><dl>"); Problem is... I can make this work with the ID, how ever, i want the URL bar saying it like this -> index.php?page=Info. This way it looks smarter (tells more to a user) and not just numbers as IDs. If i try to do the query like this... $sql = "SELECT * "; $sql .= "FROM subjects "; $sql .= "WHERE menu_name=" . $_GET['page']; It says unknown column "Info, Services". etc etc. It can only regonize the first column in each row. ( aka the id=number) I've tryed num_rows, fetch_array and fetch_assoc. I can't find a way to accomplish it. PLEASE i know this is simple, need help. Thanks in advance!
×
×
  • 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.