Problem..

Discussion in 'Off Topic' started by rbxlmadx, Apr 16, 2015.

  1. rbxlmadx

    rbxlmadx Member

    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    8
    Lets say I have a link:

    http://ww.google.com/ads?id=14

    I want that 14 to be fetched from my database, so it would look like this in script:

    <img src='http://www.google.com/ads?id=$fourteen'>

    Now, it is not a php script, like this:


    <?php
    <img src='http://www.google.com/ads?id=$fourteen'>
    ?>

    It is just the img without the <?php ?>

    Anyway, I want that $fourteen from my database so I do this:

    $four = mysql_query("SELECT four FROM days");
    $fourteen = mysql_num_rows($four);

    days is the table, four is located inside that table, and inside that it's number is 4, so when we have this link:

    <img src='http://www.google.com/ads?ad=$fourteen'>

    That $fourteen turns to 14. But this is not working in my script, there might be a few reasons like:

    Not php: doesn't start with <?php and end with ?>

    Not fetching right:

    $four = mysql_query("SELECT four FROM days");
    $fourteen = mysql_num_rows($four);



    So... What am I doing wrong?
     
  2. leafypiggy

    leafypiggy Manager of Pens and Office Supplies Staff Member

    Messages:
    3,819
    Likes Received:
    163
    Trophy Points:
    63
    It would help if you supplied the DDL for your database table, as well as a full working example of what you're trying to do. You can use code BB tags to put in the code here. (http://www.bbcode.org/examples/?id=15)

    Moved to Scripts/3rd Party Applications
     
  3. rbxlmadx

    rbxlmadx Member

    Messages:
    32
    Likes Received:
    1
    Trophy Points:
    8
    The Google url was an example, I am trying to get the 14 from phpMyAdmin and it can't seem to get it.
     
  4. caftpx10

    caftpx10 Well-Known Member

    Messages:
    1,511
    Likes Received:
    112
    Trophy Points:
    63
    Is 'four' in the query supposed to be a row or table?
     
  5. andylpsx

    andylpsx New Member

    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    3
    This is old and probably answered but I helped you with a similar problem a while ago. Use PHP, Try something like:

    <?php echo "<img src='http://www.example.com/ads>ad=" . $fourteen . "'>";

    Assuming your query is correct this will pull the value of $fourteen as defined by your query. without using php you are unable to grab the value from the variable.
     

Share This Page