Jump to content

Recommended Posts

Thanks for the reaponse.

 

1. I currently download all the info into excel format and then save as a csv. It basically has the following headings. Name , date of last sale , sale price of last sale , auction link , image link , lot number. I usually download it then copy the info into a CSV that has all records in it.

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Quick question. I just uploaded the website to a online test site , I have added the database and connected etc and the search works fine , but when I click on one of the results I get the following error

 

Parse error: syntax error, unexpected '[', expecting ')' in details1.php on line 40

 

workds perfectly offline and I am connecting ok because I can do an initial search.

 

I am in a holding pattern with support... yawn

<?php

	$page='details';
	include('header.php');
	include ('navbar.php'); 
	include ('connect.php');

	if (isset($_GET['id'])) {
    $sql = "SELECT w.whisky_name
, price
, date
, avprice 
,url_img 
,whisky_id
FROM test_db t
JOIN 
    whisky w USING (whisky_id)
JOIN (
    SELECT whisky_id
    , AVG(price) as avprice 
    FROM test_db 
    WHERE whisky_id = :id
    GROUP BY whisky_id
    ) avcalc USING (whisky_id)
ORDER BY date DESC 
LIMIT 1";



    $stmt = $conn->prepare($sql);
    $stmt->execute( [ 'id' => $_GET['id'] ] );
    $row = $stmt->fetch();
    echo "<div class='details'>";
        echo "<br>";
        echo $row['whisky_name'];
        echo "<br><br>";
        echo "Average price based on all sales" ;
        echo"<br><br>";
        echo "<div class= 'price'>";
        echo " £";
        echo floor ($row ['avprice']);
        echo "</div>";
        echo "<br>";
        echo "<div class='img_border'>";
        echo "<img src='".$row ['url_img']."' /><br />";
        echo "</div>";
        echo "<br>";
        echo "<a href='records.php?id={$row['whisky_id']}' >Click here for more detailed results</a>";
        echo "<br>";
    echo "</div>";
}
	?>



line 39 $stmt = $conn->prepare($sql);

 

line 40 $stmt->execute( [ 'id' => $_GET['id] ] );

Edited by Barny74
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.