Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. If I read you correctly, you want to make sure that the anchor tag is located below the image? Each image and text should be output inside of a div tag and you can position each pair as you like inside of that. Perhaps something like: <div> <img> <br> <center> anchor </center> </div> Repeat that block of code for each image you wish to appear. As for the 261 images, don't know what you are referring to. But if it is because you are involved in the pagination here, then keep track of what id you are querying for and start your output loop with that value and only go for that number plus you limit value.
  2. Or how about select cat1, count(cat1) as tot_cat where cat1=1 or cat1=2 group by cat1 giving you at most 2 rows showing the value of cat1 and the count of recs with that value
  3. 1 - Please use the <> icon above to post your code proerly as I am doing now. $conn = new mysqli("localhost", "root", "xxxxxx", "password"); $Surname = $_POST['Surname']; $Maidenname = $_POST['Maidenname']; $Firstname = $_POST['Firstname']; $sql = "SELECT * FROM 1984 WHERE Surname LIKE '$Surname' AND Maidenname LIKE '%$Maidenname%' AND Firstname LIKE '%$Firstname%'"; If(!$conn) die('Could not connect: ' . mysqlerror()); // MYSQLI ERROR???? $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo $row["Surname"] . " " . $row["Maidenname"] . " " . $row["Firstname"] . " " . $row["ID"] . " " . $row["Occupation"] . " " . $row["Address"] . " " . $row["Notes"] . "<BR>"; } } else echo "0 records found"; $conn->close(); You should read up on using prepared queries and change this to use them. Security. Don't know if you are using mysqli or PDO for your database access but I'm guessing that mysqlerror is not a valid function. Could be wrong. Note the changes I made to your query. Could be the whole issue. Programming change: you should check the connection results right away instead of moving on to building the query and gathering the data items. What's the point of doing more steps if the connection won't allow you to use them? Suggestion. Add the query statement to your echo when you get 0 records. That way you can see the actual query you ran.
  4. What you wrote means absolutely nothing to me. Now that may be my ignorance. What I tried to ask you for was a plain English description of the task you have made for yourself. Not in terms of programming but in a way that describes the problem you are trying to fix using a computer. All the stuff above just goes around and around something that I have no picture of.
  5. Maybe if you just tell us what you want to do we could tell you how to do it. Forget what you have done.
  6. Not sure what "setted" means but when you do set a cookie in your current script, it is not available until you refresh the page you are on. Cookies are loaded when the server sends a page to the client. Does that help?
  7. This means nothing to me. If I understand you are getting the first row and you should be echoing out those values for the customer or whatever your header info is. Then you should begin the do-while loop by outputting the detail data from that same row and afterwards hit the while to get the 2nd record and loop back and output the next set of details. When the do-while completes you should then output the totals row of your html table. Then close the table (</table). BTW - an echo does not use parentheses.
  8. YOu really don't read the manual very well. Either that or you just don't have a mind for this business. You are using a loop. But - what is inside that loop that does any kind of output? I don't see it. What do you think you should do about that? And - just what are name, qry and amount for? Are they the order header parts that need to be output before the order detail lines? If so, then where is the output of those values before you go into the detail part? And: where is the start of your html table code? Where are you showing the header information that you collected from the first row? Do you have column headers for your html table?
  9. If that were true, why would Barand suggest it to you?
  10. I see that now. Did not realize what he/you was trying to do. Of course I doing this, I would look for a change in order number and output the header data and keep track of the new order number and then continue on with the detail data from the current row and then move on to the next one until I caught a new order number.
  11. As for your total calculations - add up the amounts as you process each row in the loop. When the loop is done output one more table row showing what you have summed up. It's really very simple.
  12. I think he's reading both of our examples and thinking he needs them both....
  13. You really need to do what Barand suggests and READ A MANUAL! You can use the do---while OR the while{}. Either one works. He prefers the Do, I use the While{} method. Make your choice and LEARN WHAT THEY DO. And try and remember it.
  14. I have no idea what your overall goal is. I just helped you out to read the query results properly. What I gave you will output your entire result set. Do what you will.
  15. Barand - That's why I change his code to now work properly. I left the print_r there with my questioning comment. He should remove it.
  16. Have you not read Barand's post? I think he is suggesting to you a better way.
  17. Perhaps this is a bit easier to read (and write): $invoice = "SELECT d.order_id, DATE_FORMAT(o.order_date, '%M %e %Y') as order_date, concat(c.first_name, ' ', c.last_name) as customername, c.address, c.town, c.county, c.post_code, p.name as productname, d.qty, d.qty * p.price as amount FROM order_details d JOIN orders o ON o.order_id = d.order_id JOIN customer c ON c.customer_id = o.customer_id JOIN product p ON d.product_id = p.product_id WHERE d.order_id = '$last_id'"; $invoiceOutput = $link->query($invoice); $inv_total = 0; // Fetch 1 result row $row = $invoiceOutput->fetch_assoc(); // show the row just retrieved WHY? print_r($row); // start a loop // show all rows now while ($row = $invoiceOutput->fetch_assoc()); { echo " <tr> <td>{$row['productname']}</td> <td>{$row['???']}</td> <td>{$row['???']}</td> <td>{$row['???']}</td> <td>{$row['???']}</td> <td>{$row['???']}</td> </tr>"; } I used aliases in your query to show you how much easier it is to write it when you do so. I switched the while loop to the way I like it. Don't know if that works for you but it really should. Please look at it carefully and understand how it works. I also changed your output to be easier to type as well. Switching into and out of php mode is just silly. I also added a comment on your print_r line because I don't know why you are doing it.
  18. $articles = $html->find('div[class="entry-content"]') ? $html->find('div[class="entry-content"]') : []; foreach($articles as $article) { $items = $article->find('ul',0) ? $article->find('ul',0) : false; if($items !==false) { $lis = $item->find('li') ? $item->find('li') : []; foreach($lis as $b) { $mcpcons .= $b->plaintext; } } } Not familiar with this type of exerise at all but I ask this: Since the first line that creates $articles apparently collects multiple div blocks and you are looping thru them, do you not also need to do that for the $items collection of ul blocks? And just where is $item defined? Perhaps that needs to be in this (missing) loop?
  19. So what exactly are you able to retrieve?
  20. Just a thought: If you are seeking a record for a user there s/b only 1 ever. So using a limit of 1 defeats your security since you could possibly have a duplicate username and if so the limit 1 is not going to tell you that. Drop that and do a check on record count right after the query runs. If it is not === 1 you have another problem.
  21. I do believe that if you are not referencing a proper charset your displays will be showing as you describe - not what you want. As you have noted in your use of notepad++, when you change the encoding it shows up fine. Have to do that with your browser and probably your script.
  22. I"m gonna guess that this is a character set issue. What are you using when you display the output?
  23. Benanamen - wonderful idea but the guys will do it anyway. It's not like we stand around the clipboard when drill is over. Yes - sometimes it is easily doable when there are only 2-3 guys on one sheet and all the rest on the other. But then it happens. Barand - You Da Man! Must of stayed up late or arose early and had nothing to do but look at my problem. Your query worked perfectly. And with the change below it made my query work as well. Although I like yours better. I need to learn your style/fashion but this old dog really doesn't learn new tricks quickly. WHERE YEAR(d.Drill_date) = '2022' AND d.Description Not Like '%National%' GROUP BY roster_no, drill_date HAVING drills > 1 ORDER BY Drills DESC, d.Drill_date, q.Roster_no Changing the bottom of my original query makes it work.
×
×
  • 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.