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
Share on other sites

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.