PDA

View Full Version : more help please


ali_b
05-27-2007, 11:29 AM
hello,

before i asked how to make a link using php and java... this is what i got.
<table width="100%" border="1">

<?php do { ?>
<tr>
<td width="80%"><?php echo $rowShop['shop']?></td>
<td width="20%"><a href="#" onclick="window.open('shop_details.php?shop_id=<?php echo $rowShop['shop_id']?>','shopwindow','location=1,status=1,scrollbars=1')" >more info</a>
</td>
</tr>
<?php } while ($rowShop = @mysql_fetch_array($result)); ?>
</table>

this led to this page:

<?php
require_once("connections/connection.php"); //database connection
$shop_id = $_GET['shop_id']; // << $_GET *********
//if($shop_id) {
/////////////////////////////////////////////////////
$query = sprintf("SELECT * FROM shops where shop_id='$shop_id'");
$result = @mysql_query($query);
$rowShop = @mysql_fetch_array($result);
////////////////////////////////////////////////////
//}
?>
<body class="about">
<div id="page-container">
<div id="header">
<div id="main-nav">
<dl class="">
<dt id="about"><a href="#">About</a></dt>
<dt id="services"><a href="#">Services</a></dt>
<dt id="location"><a href="#">Location</a></dt>
<dt id="contact"><a href="#">Contact Us</a></dt>
</dl>
</div>
<h1><img src="img/menuheader.jpg" /></h1>
</div>

What i need help with this time is how to add links to the above tabs... i.e. the about, services, location and contact us. they will have to pull data from a database depending on what shop is clicked on... i also dont no how to put a picture of an image into a database ( that will be the locaion i want to display a map.)

EDIT *ok, i have worked out how to do that, but i still dont no how to put in a image into a database.*


cheers for your help,

Ali.

davidj
05-27-2007, 02:29 PM
store the path to an image in the db

ali_b
05-27-2007, 02:36 PM
cheers, but could u explain it a bit more? what type of field should it be and wht would the php be? would it be soming like this?

if there was a location field in the img tags: <img src="<?php echo........... ?>" /> and echo the location feild?

davidj
05-27-2007, 02:42 PM
just store the image name in the db


img1234.jpg
img1233.jpg
img1345.jpg


then store the path in a define or a variable

$path = "/images/pic1/"

then just apply the above like this...

<img src="<?php echo $path.$row['image']; ?>" >

ali_b
05-27-2007, 04:45 PM
cool cheers m8. thats it working :D thanks for your help :D:D:D

ali_b
05-27-2007, 05:05 PM
thats all of the php done that i need to do... untill now i have been testing the website on my pc. now what i need to do it transfer it to my webhosting package thing...

could you please tell me how to make the right databases so that all of the pages still work.

EDIT*on EMS SQL Manager if i click on DLL is that all i need? if i put that in a file would that work?*

cheers

davidj
05-27-2007, 08:05 PM
you need to replicate your db on the live machine

just renuild it as you have it in your testing environment