I am new to php and spent hours trying to get some code to work, looking for someone to fix my code so that it works..I have the code below, I am trying to get it to show a random url in an iframe, which i have working...However, for the life of me, I cannot get it to update the associated row and deduct 1 credit.
So, this job is for $15 for someone to fix my code so that it pulls a random url from database and puts it in iframe, and then deducts 1 credit from the ID / row that it pulled the url from.
Below is the code I have...
<?php
include 'config.php'; ?>
<?php
$result = mysqli_query($conn,"SELECT id, url FROM oto_msites order by RAND() limit 1"); ?>
<?php
$i=0;
while($row = mysqli_fetch_array($result)) {
>
<?php
mysqli_query($conn,"UPDATE oto_msites SET credits = credits-1 WHERE id = echo .$id."); ?>
<main>
<iframe border="0" frameborder="0" height="100%" width="100%" id="banner" marginheight="0" marginwidth="0" scrolling="yes" src="<?php echo $row["url"]; ?>"></iframe>
</main>
<?php
$i++;
}
>