Barny74 Posted January 23, 2017 Author Share Posted January 23, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303000-show-single-listing-from-search-php-sql/page/3/#findComment-1541901 Share on other sites More sharing options...
Barny74 Posted January 23, 2017 Author Share Posted January 23, 2017 2. About 5k per download 3. Not very often for new whiskies , but it is possible. Quote Link to comment https://forums.phpfreaks.com/topic/303000-show-single-listing-from-search-php-sql/page/3/#findComment-1541902 Share on other sites More sharing options...
Barny74 Posted January 23, 2017 Author Share Posted January 23, 2017 (edited) 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 January 23, 2017 by Barny74 Quote Link to comment https://forums.phpfreaks.com/topic/303000-show-single-listing-from-search-php-sql/page/3/#findComment-1541911 Share on other sites More sharing options...
Barand Posted January 23, 2017 Share Posted January 23, 2017 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'] ] Quote Link to comment https://forums.phpfreaks.com/topic/303000-show-single-listing-from-search-php-sql/page/3/#findComment-1541912 Share on other sites More sharing options...
Barny74 Posted January 23, 2017 Author Share Posted January 23, 2017 Once again thank you so much. Quote Link to comment https://forums.phpfreaks.com/topic/303000-show-single-listing-from-search-php-sql/page/3/#findComment-1541913 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.