t.bo Posted November 25, 2007 Share Posted November 25, 2007 Hello everybody, Im making a website that has a menu that consists of several treatements when u click on one treatment a submenu appears that everytime has a "info" , "price", "pictures" button about that treatment. Now I was wondering what is the best way to solve this in php/mysql. My idea was to make one table for each treatment that consists of an idfield, an infofield, pricefield and picturefield. That way I can do a link like this index?content=botox&action=price where botox.php would be like this : <? include('dbconnect.php'); $action = $_GET[action]; if($action == "") { $action = "info"; } else { $sql = mysql_query("SELECT * FROM treatmenttable WHERE actionfield='$action'") or die(mysql_error()); $r=mysql_fetch_array($sql); $info = mysql_result($sql, 0 ,"info"); $price = mysql_result($sql, 0 ,"price"); $picture = mysql_result($sql, 0 ,"picture"); if($action = "info"){ echo "$info"; } if($action = "price"){ echo "$price": } } ?> Im having a little problem displaying the output (price, info or pictures) so im little stuck with the last lines. Can anyone help me out? Thanks in advance... ps : u can find an example of the layout here : http://euroclinix.site2start.be/euronew/ Link to comment https://forums.phpfreaks.com/topic/78785-navigationstructure-problem/ Share on other sites More sharing options...
xyn Posted November 25, 2007 Share Posted November 25, 2007 change $info = mysql_result($sql, 0 ,"info"); $price = mysql_result($sql, 0 ,"price"); $picture = mysql_result($sql, 0 ,"picture"); with... $info = $r[info]; $price = $r[price]; $picture = $r[picture] Link to comment https://forums.phpfreaks.com/topic/78785-navigationstructure-problem/#findComment-398699 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.