boredd
-
Posts
2 -
Joined
-
Last visited
Posts posted by boredd
-
-
Hi, I am a newbie in PHP (about week and a half). I'm writing a website for myself right now. I've got a problem that I cannot solve.
The website is about buying files with website custom balance. What I want to do is disable buy button if user bought this file b4. The is a table user_files that stores user id and file id.
And another table that stores files data, ID name who uploaded date time ect....
What I'm trying to do, is disabling buy button if the user has already the file.
This is what I've done :
while ($row = $rocket->fetch()) { ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['name']; ?></td> <td><?php echo $row['uploader']; ?></td> <td><?php echo $row['uploadtime']; ?></td> <td><button <?php // Echo "disabled" if $row['id'] id is present in row2['file_id'] <<<<<<< Need to do this in a while. ?> ><a href="download.php?id=<?php echo $row['id']; ?>"></a><?php echo $row['price'] . "D$" ?></button></td> </tr> <?php } ?>
What I can't do is check if the file id ($row['id']) is present in ($row2['file_id']), if yes echo "disabled";
disable button if value exists or equal to array
in PHP Coding Help
Posted
All query :
$row $rocket = $bdd->query('SELECT * FROM files'); $row2 $rocket2 = $bdd->prepare('SELECT * FROM user_files WHERE user_id = ?'); $rocket2->execute(array($uid)); $row2 = $rocket2->fetch();
Files table structure
user_files table structure