Jump to content

Recommended Posts

Can someone review my code, and see if there are any errors.

 

What it is suppose to do, is see if the user is in the paid table, and if they are show a link, but if the user is not in the paid table show a checkbox.

 

So please just look over my code for errors

<?php
include ("../../style/include/session.php");
include ("../../style/include/cons/head_2.php");
if($session->isAdmin()){
print '<div class="box"><h2>Select Paid</h2>';
?>

<form action="pay_do.php" method="post">

<table width="63%" border="0">
  <tr>
    <td width="194"><strong>First Name </strong></td>
    <td width="261"><strong>Last Name </strong></td>
    <td width="273"><strong>Paid (username) </strong></td>
  </tr>
  <?
  
$qr=mysql_query("select * from users order by first");
$pt=mysql_query("select * from paid order by user");
while ($rs=mysql_fetch_assoc($qr)) {
       $pu=mysql_fetch_assoc($pt);
       $table = 'paid';
       $field = 'user';
       $compared = $pu['user'];
       $result = mysql_query("SELECT $field FROM $table WHERE $field = '$compared'");


?>
  <tr>
    <td><? echo $rs['first'];?></td>
    <td><? echo $rs['last'];?></td>
    <td>
<?
       if(mysql_num_rows($result)==0) {
             //"Not Paid ";
?>			 
<input type="checkbox" name="checkbox[]" value="<? echo $rs['username'] ?>" />
<?php
       } else {
echo '<a href="pay_dele.php?cmd=delete&user='.$rs['username'].'">Not Paid</a> '; 

       }
?>
(<? 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");
?>

Link to comment
https://forums.phpfreaks.com/topic/90373-any-errors/
Share on other sites

If you want us to check if there is any errors in your code, you need to gives your include files!!!

 

Why are you using lon and short php tags?

Did you enable short tags?

 

Can't you just start your script and see if you get any errors?

 

What do we need to check?

Link to comment
https://forums.phpfreaks.com/topic/90373-any-errors/#findComment-463348
Share on other sites

I am very sorry.

 

Those include files are just my heading, and the file to tell if the user is logged in or not(session.php), and my footer. Those are not the problems. I do have shot tags enabled.

 

I did not get any errors, but the scripts does not run properly

Link to comment
https://forums.phpfreaks.com/topic/90373-any-errors/#findComment-463549
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.