Jump to content

[SOLVED] PHP, MySQL and a Headache


SelfObscurity

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.

Archived

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

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