Problem..

rbxlmadx

Member
Messages
32
Reaction score
1
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?
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
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
 

rbxlmadx

Member
Messages
32
Reaction score
1
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.
 

andylpsx

New Member
Messages
29
Reaction score
1
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.
 
Top