Creating a function
Posted on
16th Feb 2014 07:03 pm by
admin
Basically i wanna put all this code in a seperate file
Code: <?php
$query = "select product.ProductID, product.ProductName, product.ProductCategory, product.ProductPrice, product.ProductQuantity, product.ProductDescription, image.ImageID, image.ImagePath, image.ImageName, product_image.ImageID, product_image.ProductID
FROM product
JOIN product_image
ON product.ProductID = product_image.ProductID
JOIN image
ON image.ImageID = product_image.ImageID";
//Use this query below
$result = mysql_query($query, $conn)
or die ("Unable to perform query");
while($row= mysql_fetch_array($result))
{
$productname = $row['ProductName'];
$productprice = $row['ProductPrice'];
$imagename = $row["ImageName"];
$imagepath = $row["ImagePath"];
//Get the product id so i can pass it
$productid =$row["ProductID"];
$file = $imagepath.$imagename;
?>
<ol>
<li class="newproducts">
<!-- Make the product name clickable and pass through its id -->
<?php echo '<a href="product_details.php?productid='.$productid.'">' .$productname.'</a><br />';?>
<?php echo '<a href="'.$file.'" target="_blank" rel="lightbox"><img src="'.$file.'" width="100" height="100"/><br />';?>
<?php echo 'Price' . $row ['ProductPrice'].'<br /><br />';?>
</li>
</ol>
<?php
}?>
Then call it on the index page, how can i do this
No comments posted yet
Your Answer:
Login to answer
268
19
Other forums
Select Rows as Columns..
is there a way to select COLUMN_NAME from user_tab_columns where table_name='TABLENAME';
and ha
fire away
i launched about 4 months ago as a lagit co. i have 2 paying clients, 1probono, 1 side progect, and
I need to increse 6hours more, and i don't know how???
I need to increse 6hours more, and i don't know how???
<tr>
<t
SAP Logon Failed
I tried to login to SAP through MMC.
When i click start and give password.
it
How to Handle more than one submit button in single form?
Hi
I have one PHP file which contains one Form. In this form there are two Submit type Buttons
array_diff weirdness
I'm using the following bit of code
$diff = array_diff($pids, $pidlist);
$diff = array_va
Blocking video streaming
Hello everyone,
I post a message here because i didn't find any solution yet.
I just finis
Must be a string? Huh, what? HELP?
with the following script, I get
Fatal error: Property name must be a string in /home/content/e/
upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t
Best way to check for end of a record and send it back to the first record
I'm hoping someone can help me out and explain the best way to accomplish this.
What I'm doin