Hey guys, I wrote a script for my website which has a mySQL database. The name of the table is "pending". I also have a few rows. "proxyname" "proxyurl" "user" "email" "approved". The way I want the script to work is the users add a proxy to the database which I have taken care of. But then I need it to show the users which proxies have been approved and which have been denied. This is in their account when they log in. If the "approved" row is equal to 1, then the proxy is pending. If its equal to 2, then its approved. This is where the problem comes in. The script that I wrote is below. When I run the script, the "select * from pending..ect" part doesn't work. If the user has a proxy submitted, it shows every single proxy ever submitted. How should I write this so that it only shows the proxies that the user submitted? If you can help, please let me know. I can pay a few dollars if needed. I juyst need this fixed. Thanks
I'm not getting a php error. The problem that I have is that the script is only suppose to select the proxies that the user thats signed in submitted and if approved = 2. Right now its showing all the proxies that were submitted even if it was by other users. Thanks
Thats becuase of this line $result = mysql_query("SELECT * FROM pending"); PHP: That is telling it to search every thing. I think you mean $result = mysql_query($qryreview); PHP:
Thanks bro. It fixed the problem I was having but now it doesn't say if there are no proxies submitted. Theres just a blank spot
Try: $num_rows = mysql_num_rows($result); PHP: Click the link in my sig and grab my functions for MYSQL, it makes life so much easier.
hi, Can you please try this, Please put the below code in the place of that you mentioned, <b>Active Proxies</b><br /><br /> <?php $result = mysql_query("SELECT * FROM proxy where user = '".$_SESSION['Username']."'"); while($row = mysql_fetch_array($result)) { if($row['approved']==1) { echo ("You currently do not have any active proxies."); } else { echo "<a href='http://www." . $row['proxyurl'] ."'>". $row['proxyname'] . "</a><br />"; } } ?> Insert this coding and try, if you got the solution please let me know,. Thanks & Regards www.joomla-web-designer.com, Joomla Custom Template Design, Hire PHP & MySql Programmer, Hire LAMP Programmer
The code works but if there is no proxies submitted, it says the echo x3 or the total amount of proxies. How do I fix this?