Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts 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. 53 minutes ago, dodgeitorelse3 said:

    $due = $prevbal + $latechg + $secdep + $damage + $courtcost + $nsf; // Warning: A non-numeric value encountered x 5 line 21

    is equal to saying

    $due = "prevbal" + "latechg" + "secdep" + "damage" + "courtcost" + "nsf";

    these are not numeric.

    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;

    and that behavior has actually been removed since PHP 8.

  3. 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>";


  4. So basically it's a question of syntax.

    <?php tags are for entering PHP mode.

    this is html mode
    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>';


  5. 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;
    /* } */

    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);


    • Great Answer 1
  6. 3 hours ago, eaglehopes said:

    No. I am using index.php page to include other pages and external url tag is inside one of that pages. I can give an example :

    url of the external page  : http://x.freecluster.eu/index.php?page=articles

    tag in the external page : <h2 id="specialfirewall"> ....</h2> (title of one article)

    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.

  7. 18 minutes ago, webdeveloper123 said:

    @requinix nailed it. What he said is what i am trying to acheive

    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.