Jump to content

Recommended Posts

Evening everyone,

 

I have been working on a databse driven web site for some time now.  I have been working with web development for a long time, but I always took the easy way out.  Well, I have no problem with the easy stuff (connecting to the DB, displaying table information, etc).  A friend of mine says that it would be quite easy for me to put everything, and make it all run off the index.php.

 

So my question would be, how would I go about that.  I have looked around and I see that I would use if statements.  What I want to do is have, for example...

 

index.php?area=1, I would want to have something say if area was the var, then it would pull from that database, whatever number was showing.  How would I even do that?

 

or

 

index.php?area=news... how could I get that to reflect at a particular table

 

and..

 

index.php?area=news&id=1 ... I have seen that around, but I cant find anything to help me that I understand..

 

Any help would be appreciated, or a direction of a site tot ake a look at that will help, thank you!

Link to comment
https://forums.phpfreaks.com/topic/53011-solved-php-mysql-and-a-headache/
Share on other sites

My man, we're talking about the very basics of PHP here. I am most certain that if you're hitting a roadblock with this, you will only confuse yourself more if you try to take on more than you know. Best advise I can give you, is to take the time to learn PHP form the very basics...ground up. Life will be easier, and your experience with PHP will be much more beautiful.

 

 

<?php

  $page = $_GET['content'];

    if(isset($_GET['content'])) {

    $query = $db->query("SELECT * FROM table WHERE content='$page'");
    $result = $db->fetch_array($query);

    }

?>

 

No problem. And yeah...start with finding out how $_GET works...(http://www.w3schools.com/php/php_get.asp). That should get you on the right track. Dedicate a couple days to writing/duplicating really simple PHP scripts...and find out how they work....be worth it in the long run.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.