Jump to content

Help with a php/mysql query & results


Fallen_angel

Recommended Posts

Firstly hi , :)

I am currently learning php/mysql whilst at the same time writing a webapp fro  my website ( I know that the first version will have allot to fix but thats how I find I learn the best )

in the bellow script what I am tryign to do is , build the frame work for the actual articles , at the moment it ofcourse has no stylign or formatting so it's ugly however that is not very important to me untill I actually get it working

I want the pages to be accessed by going to
http://website/page_name.php?id=1 ( or whatever id I wish to put in ) this should then , use the id variable at the end of the url and search for that value in the s_id collum  in my database and pull down the rest of the information tied into that row

I belive I have it pretty close but am goign wrong somewhere ( i belive it is the $id variable thats not working ) however I am not sure how I should fix it any help you can give is greatly apreciated


[code]<?php
//Connect To database
include "connect.php";
//collects Data
$data=mysql_query("SELECT * FROM strains where s_id='$id'")
or die(mysql_error());

Print "<table border=2px>" ;
Print "<tr><td><b>Name</b></td><td><b>Breeder</b></td><td><b>Type</b></td><td><b>Yeild</b></td><td><b>Time</b></td></tr>";
while ($info= mysql_fetch_array($data) )
{
Print "<tr><td width=150px> ".$info['s_name']. "</td><td width=150px> ".$info['s_breeder'] ."</td><td width=100px>".$info['s_type'] ."</td><td width=35px> ".$info['s_yeild'] ."</td><td width=25px> ".$info['f_time'] ." Days</td></tr>";
}
Print "</table>" ;
?>[/code]


thankyou again in advance

regards,

Fallen Angel
Link to comment
https://forums.phpfreaks.com/topic/26017-help-with-a-phpmysql-query-results/
Share on other sites

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.