Jump to content

requinix

Administrators
  • Posts

    14,233
  • Joined

  • Last visited

  • Days Won

    369

Everything posted by requinix

  1. Are you trying to show prospects with some of the deal information? Or deals with some of the prospect information? The latter is easier: you SELECT the fields you want FROM the deals table, then JOIN in the prospects table ON the two tables matching their prospect IDs (and also add the fields you want from that to the SELECT list, of course). The fact that the same prospect could show up multiple times for multiple deals isn't important. The former is a bit trickier because you should think a little harder about precisely what it is you want to do. Show a prospect and then list the associated deals underneath? Somehow summarize all the matching deals? Your example seems to suggest that you want to focus on the deal information, then show alongside it the information about its prospect.
  2. Dump the value of __DIR__ so you can see what it ends with. You can assume that's mostly always going to be the case. Then consider whether there are possible exceptions to that. Then realize that having doubled-up slashes doesn't cause any problems.
  3. As long as each one has the $ then it's a variable, and if undefined PHP will just treat it as null (and 0). The name-to-string thing applies only to constants, as in code like const PREVBAL = 1; const LATECHG = 2; const SECDEP = 3; const DAMGE = 4; // typo const COURTCOST = 5; const NSF = 6; $due = PREVBAL + LATECHG + SECDEP + DAMAGE + COURTCOST + NSF; and that behavior has actually been removed since PHP 8.
  4. Because "John" is a reasonable example of an fname, I would think...
  5. PSA: I will remove any further posts which tell OP how to do the task as-asked. As well-intentioned as the question and its direct answer is, using variable variables is not a good thing.
  6. 1. https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity 2. <table class="classname"> <tr> <td>This has the class</td> </tr> </table> <div class="classname"> <table> <tr> <td>So does this</td> </tr> </table> </div>
  7. What? Rather than this pattern you're starting, which I think you're saying doesn't work, consider sprintf: $domains = [ "BSCSCAN" => "https://bscscan.com/token/%s", "TRONSCAN" => "https://tronscan.org/#/token/%s", "DGB" => "https://dgb.com/token/%s", // ... ]; $url = sprintf($domains[$checkSqlRow["ADDRESS"]], $address); echo "<td><a href='$url' style='color:lime' target='_blank'>$address</a></td>";
  8. Admins really don't like it when users try to bypass restrictions.
  9. If you're using PDO and SQLite then why is there calls to mysqli_query and mysqli_close in there?
  10. That would be because the HTML is invalid. Did you notice that?
  11. Which is why I didn't say anything about it being wrong or not working. And I'm trying to tell you what you have to change with your not-working code in order to make it work.
  12. So basically it's a question of syntax. <?php tags are for entering PHP mode. this is html mode <?php this is php mode echo "this is still php mode even though you're outputting html"; ?> back to html mode So the <?php in echo '<a href="https://bscscan.com/token/<?php echo $checkSqlRow["ADDRESS"]; ?></a>'; won't work because you're already in PHP mode. Compare that to <a href="https://bscscan.com/token/<?php echo $checkSqlRow["ADDRESS"]; ?> "style="color:lime" target="_blank"> which starts in HTML mode, uses <?php to switch to PHP mode and output the address, then switches back to HTML mode. If you want to echo some HTML with a PHP variable in it, you can do that with echo '<a href="https://bscscan.com/token/', $checkSqlRow["ADDRESS"], '</a>';
  13. That's a lot of queries to run. Start off with a single query that gets all the replies for that post or whatever it is. All of them. Then shove them into an array based on their parent ID. $comment_parents = []; $count = 0; /* get each $row from the query { */ if (!isset($comment_parents[$row['parent']])) { $comment_parents[$row['parent']] = []; } $comment_parents[$row['parent']][] = $row; $count++; /* } */ That also gets you a count of the number of comments, which it seems you want. Now you display them. What's the markup? I don't know. But you're pretty much guaranteed take a recursive approach: show one comment, then immediately show all the comments below it, and repeat. function showComments(array $comment_parents, array $comment, int $level = 0) { /* show the $comment */ foreach ($comment_parents[$comment['id']] ?? [] as $child) { showComments($comment_parents, $child, $level + 1); } } foreach ($comment_parents[0] as $comment) { showComments($comment_parents, $comment); }
  14. The best way we can help is if you know what you want to do but don't know what the code needs to be. We're good with code. We're not good with things like "able to show ethscan website". You have to figure out what it is you need to do - like, are you talking about a <a> or an <iframe> or what - and then we can show you what code you need to do it.
  15. Not that I know of. But are you sure you want something slick? Maybe something readable would have its advantages?
  16. To get a new number every day, seed the RNG with a number that stays the same all day long - say, the date in YYYYMMDD format - then request a random number. With the same seed you'll get the same sequence of numbers.
  17. SoapClient::__setSoapHeaders looks relevant.
  18. Is that what you want to do? Find out the "character" position for a match's byte position? You're only giving out small pieces of information at a time. It's hard to give advice on broader problems or situations when we have to work with is your use of mb_strlen and substr...
  19. Bytes and characters are not the same thing. You think it's characters, PHP is telling you bytes.
  20. $x = 70.889661; I don't understand this thread.
  21. I don't see any H2s with ids on the page. You can't link to one of them until they are given ids. Why do you not have a page dedicated to showing a single article? You should be linking to that, not to some anchor buried deep on a paginated page.
  22. Variables defined outside of functions are not available inside of functions. If you need $pdo then pass it as an argument like you're already doing for $id.
  23. I was actually trying to point out that you're attempting to solve your problem the wrong way. If you have an ID and want to make sure it exists then what you do is execute a query to see if there are rows matching that ID. You do not retrieve every single one. That's terribly, terribly inefficient. SELECT 1 FROM customer_details WHERE customer_id = ? Use that as a prepared statement and put your expected ID value into it as a parameter. Then execute and see if you got any rows back. But what's more, I'm skeptical you even need this at all. What are you going to do later on? You said redirect to yet another page? Why? Why can't you check that the row exists on that page? And you know, when you do that, your edit page is going to need to retrieve the records from customer_details too, and won't that look very, very much like the above query? So not only do you not need this page, you don't even need this query because your edit page will find out if the ID doesn't exist when it tries to load up the data it needs. Does that make sense?
×
×
  • 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.