Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. Revraz is this the function you are talking about? function checkUnique($table, $field, $compared){ if (get_magic_quotes_gpc()) { $table = stripslashes($table); $field = stripslashes($field); $compared = stripslashes($compared); } $table = mysql_real_escape_string($table); $field = mysql_real_escape_string($field); $compared = mysql_real_escape_string($compared); $result = mysql_query("SELECT $field FROM $table WHERE $field = '$compared'"); if(mysql_num_rows($result)==0) { return TRUE; } else { return FALSE; } }
  2. Can I do a if statement to tell if the user is also in another table? The user is in the default table, but if he is in the paid table, make a link, if not make a check box. How would I be able to do this? -- Also How do I make it where the user can only be in the table once? because I have a table, and every time I submit data, even though the user is already in there, it adds them again.
  3. Lamez

    Check Boxs

    it still adds a blank row, along with the selected user. That is ok I can live with that.
  4. Lamez

    Check Boxs

    sure did, I just copied and pasted paid.php <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); print '<div class="box"><h2>Select Paid</h2>'; if($session->isAdmin()){ ?> <form action="pay_do.php" method="post"> <table width="100%" border="0"> <tr> <td width="419"><strong>First Name </strong></td> <td width="487"><strong>Last Name </strong></td> <td width="257"><strong>Paid (username) </strong></td> </tr> <? $qr=mysql_query("select * from users order by first"); while ($rs=mysql_fetch_assoc($qr)) { ?> <tr> <td><? echo $rs['first'];?></td> <td><? echo $rs['last'];?></td> <td><input type="checkbox" name="checkbox[]" onclick="if(this.value=='on') { this.value='<?=$rs['username'] ?>'; } if(this.value=='<?=$rs['username'] ?>') { this.value=''; }" /> (<? echo $rs['username']; ?>)</td> <? } ?> </tr> </table> <br /> <input name="Submit" type="Submit" value="Mark Paid" /> </form> <?php }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?> pay_do.php: <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); print '<div class="box">'; if($session->isAdmin()){ if(isset($_POST['Submit'])){ $boxes=$_POST['checkbox']; $i=0; while ($i<=count($boxes)) { if($boxes[$i]!=='') { mysql_query("insert into paid (user) values ('$boxes[$i]')"); } $i++; } echo "<h2>Processed</h2>"; echo "Selected users have been processed"; }else{ echo "<h2>Error!</h2>"; echo 'No data to process<br><a href="paid.php">Select Paid/Non-Paid</a>'; } }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?>
  5. Lamez

    Check Boxs

    now it just inserts a blank row
  6. take a look here: http://adsense.google.com
  7. Lamez

    Check Boxs

    well how do I set the value? like this? <input type="checkbox" name="checkbox[]" value="<?=$rs['username'] ?>" /> so then I need to change this line: if($boxes[$i]=='on') { to this if($boxes[$i]==$rs['username') { ?
  8. open up notepad, and type this <?php echo "I need help"; ?> and save it as file.php, then upload it to a web server that has php installed, or install php
  9. lol how is this PHP related? congratz
  10. Lamez

    Check Boxs

    now it does not insert anything into the DB
  11. Lamez

    Check Boxs

    now how do I remove the users that I did not select? If I did not select user1, but I selected user2 it inserts a blank for user1 and adds the value for user2? I have this so far: <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); print '<div class="box">'; if($session->isAdmin()){ if(isset($_POST['Submit'])){ $boxes=$_POST['checkbox']; if (empty($boxes)) { //somthing } $i=0; while ($i<=count($boxes)) { mysql_query("insert into paid (user) values ('$boxes[$i]')"); $i++; } echo "<h2>Processed</h2>"; echo "Selected users have been processed"; }else{ echo "<h2>Error!</h2>"; echo 'No data to process<br><a href="paid.php">Select Paid/Non-Paid</a>'; } }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?>
  12. Lamez

    Check Boxs

    like this? <?php $arr = print_r($_POST); foreach ($arr as &$value) { mysql_query("insert into paid (user) values ('$value')"); } ?>
  13. Lamez

    Check Boxs

    mike that loop did not work, how would I use the foreach?
  14. Lamez

    Check Boxs

    when I select a few boxes I get this Array ( [checkbox] => Array ( [0] => GoogleBot [1] => admin ) [submit] => Mark Paid )
  15. Lamez

    Check Boxs

    lol ya. If I could just learn how to handle checkboxes then I think I can get the rest
  16. How do I handle checkboxes in PHP? Say I select 3 boxs out of 4, how do I get it to display those three checkboxs? here is my php code I have so far: (does not work) <?php if(isset($_POST['Submit'])) { for ($i=0; $i<count($_POST['checkbox']);$i++) { echo "<br />value $i = ".$_POST['checkbox'][$i]; } } ?> here is my html <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); print '<div class="box"><h2>Select Paid</h2>'; if($session->isAdmin()){ ?> <form action="pay_do.php" method="post"> <table width="100%" border="0"> <tr> <td width="419"><strong>First Name </strong></td> <td width="487"><strong>Last Name </strong></td> <td width="257"><strong>Paid (username) </strong></td> </tr> <? $qr=mysql_query("select * from users order by first"); while ($rs=mysql_fetch_assoc($qr)) { ?> <tr> <td><? echo $rs['first'];?></td> <td><? echo $rs['last'];?></td> <td><input type="checkbox" name="checkbox[]" value="<?=$rs['username'] ?>" /> (<? echo $rs['username']; ?>)</td> <? } ?> </tr> </table> <br /> <input name="submit" type="submit" value="Mark Paid" /> </form> <?php }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?> -Thanks!
  17. no I want to be able to put a check be side their name, and then click submit, then it adds them to the paid table.
  18. here is what I have so far: <?php $q = "SELECT user,first,last " ."FROM ".TBL_USERS.""; $user = mysql_result($result,$i,"user"); $fname = mysql_result($result,$i,"first"); $lname = mysql_result($result,$i,"last"); ?> <form name="form1" method="post" action=""> <table width="200" border="0"> <tr> <td width="103">First Name </td> <td width="87">Paid</td> </tr> <tr> <td><?php echo "$fname $lname"; ?></td> <td><label> <input type="<?php echo "$user"; ?>" name="checkbox" value="<?php echo "$user"; ?>"> </label></td> </tr> </table> <br> <label> <input type="submit" name="Submit" value="Submit"> </label> </form> <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); print '<div class="box"><h2>Control Panel</h2>'; if($session->isAdmin()){ ?> <?php }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?>
  19. ok how would I make a check list, where I can check off the user who has paid? I have been trying to make this part for the last 45mins now. any ideas?
  20. well I get this error now: what does it mean? here is my code <?php include ("style/include/session.php"); $q = mysql_query("Select * from tablename where user='$session->username'"); if(mysql_num_rows($q) ==0){ echo "Please Pay"; }else{ echo "You Paid!"; } ?>
  21. would this work? <?php include ("style/include/session.php"); $q = "SELECT user FROM `paid` "; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); if (function_exists($session->username){ echo "you have paid"; }else{ echo "you need to pay"; ?>
  22. well I got to thinking, it might to make a table, with just the username then do a if exist statement, so if the username exist, it outputs "you have paid" otherwise "you need to pay" how would I do this?
  23. I have a paid system for my website (I mean I want to make one) How would I write my if statement I have this so far, but I do not think it is correct: <?php include ("style/include/session.php"); $q = "Select count(*) as row_count from `paid`"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); if ($row['paid'] == ('yes')){ echo "Paid"; }else{ echo "Not Paid"; ?> How do I make it call it for each user individually this is what I use to define the user: $session->username any help?
×
×
  • 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.