my first real php script.
Posted: Tue Feb 08, 2011 11:47 pm
Okay, so this is my first real php script from scratch.
This is the theory of the script I am writing.
Mysql database connect script already done.
So, first things I need to do is connect, right?
Displays this, http://67.23.249.45/~gaogier/shop1.php
What do you think so far?
Whats still to come.
How do I link 2 tables together?
I mean, I plan to have many shops displayed, then, inside the shop, have the items, which will be linked to each shop.
I plan to link each shop to a different page, which will be displayed like, url/shop/shopname
If you are confused, i need to have a working shop database that works like this, http://www.tip.it/runescape/?rs2shops
I don't care about styling at the moment, I just want the script to work.
What do I do now?
This is the theory of the script I am writing.
Mysql database connect script already done.
So, first things I need to do is connect, right?
Code: Select all
<?php
//connect to db
require_once ('includes/connect.php');
//connect to table
$result = mysql_query ("select * FROM shop1");
//display data in table
echo "<table border='1'><tr><td>Shop</td><td>city</td><td>members</td></tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['members'] . "</td>";
echo "</tr>";
}
echo "</tr></table>";
?>
What do you think so far?
Whats still to come.
How do I link 2 tables together?
I mean, I plan to have many shops displayed, then, inside the shop, have the items, which will be linked to each shop.
I plan to link each shop to a different page, which will be displayed like, url/shop/shopname
If you are confused, i need to have a working shop database that works like this, http://www.tip.it/runescape/?rs2shops
I don't care about styling at the moment, I just want the script to work.
What do I do now?