|
haarvik
|
 |
« Reply #2 on: November 19, 2005, 03:36:20 PM » |
|
Hi. If your DB supports it, you basically need to design your php code to perform queries on the related tables within the db. For example, if I were using MySQL and had a db named movies and within that db I had a table called new (new releases). My table might be structured so: Title Rating Released Status Now, in order to see if the particular movie is in you perform a query like so: select*from new where(title='Star Wars') This would return any fields within the table new. To perform this with PHP, you have to make sql calls to the db in a similar fashion: $host='localhost'; $db='movies'; $user='username'; $pass='password'; mysql_connect($host,$db,$user,$pass)or die("Cannot select db"); $sql=select*from new where(title=$title); $result=mysql_num_rows($sql); $num=mysql_result($result); $i=0 if($num > $i){ $title=mysql_result($result,$i,"title"); $status=mysql_result($result,$i,"status); print "$title is $status"; $i++; } So this returns the $title Star Wars, and if the status was out, then $status would be Out, and displays it on a web page. Now if you are using Microsoft SQL, then the syntax for connecting is slightly different. I've never coded for M SQL so you would have to google for the correct syntax. It is very similar, but there are noticable differences. Hope this helps. Tom
|