Jump to content

Show single listing from Search - PHP SQL

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.

Share this post

Link to post
Share on other sites

2. About 5k per download

3. Not very often for new whiskies , but it is possible.

Share this post

Link to post
Share on other sites

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


	include ('navbar.php'); 
	include ('connect.php');

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

    $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 "<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

Share this post

Link to post
Share on other sites

It could be they have an ancient version of PHP that doesn't support [..] array definition syntax.


To verify try

array( 'id' => $_GET['id'])

instead of

[  'id' => $_GET['id']  ]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.