
Classico
Members-
Posts
21 -
Joined
-
Last visited
Classico's Achievements

Newbie (1/5)
0
Reputation
-
I've ran into this problem many times, and I'm sure others have too. I'm trying to redirect users to the main page after login/doing other stuff on the website. But every time I login just to test it, I keep getting an error something about the header (can't remember the full error, haven't tested it in a while). I'm using the PHP's way of redirecting: header("Location:index.php"); I managed to find a work around, by outputting a link if they've logged in and when they click on the link, it takes them to the selected page. But I don't want that. I want it so it redirects automatically. I do have error reporting on. Is there a way to get this working, without the error? I can post my login code if needed.
-
Validate Textbox Before Continuing To Paypal Payment Page
Classico replied to Classico's topic in PHP Coding Help
It checks the price in my IPN script, but I also have the price in the button code too. Is there another way of holding the pricing information? Oops, my bad! I forgot to add 'onsubmit="return checkForm(this);"' to my form code. Thanks for that. -
Validate Textbox Before Continuing To Paypal Payment Page
Classico posted a topic in PHP Coding Help
I have a small javascript function which is meant to check if a user has entered anything in the given textbox. <script type="text/javascript"> function checkForm(form) { if(form.on0.value == '') { alert("Error: No amount was entered!"); form.on0.focus(); return false; } return true; } </script> <form action="https://www.paypal.com/cgi-bin/webscr" method="POST"> <input type="text" name="on0" value="" placeholder="Username"> That doesn't seem to work when I press my PayPal button. <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="[email protected]"> <input type="hidden" name="item_name" value="VIP"> <input type="hidden" name="item_number" value="1"> <input type="hidden" name="amount" value="2.50"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="lc" value="GB"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="hidden" name="return" value="http://www.dawncraftmc.com/index.html"> <input type="hidden" name="cancel_return" value="http://www.dawncraftmc.com/index.html"> <input type="hidden" name="rm" value="2"> <input type="hidden" name="notify_url" value="http://vip.dawncraftmc.com/ipn.php" /> <input type="hidden" name="custom" value="<?php echo $on0; ?>"> <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form> Is there an easier way to check this? -
Set 'status' To 'open' On Newly Submitted Questions
Classico replied to Classico's topic in PHP Coding Help
I never really thought about using the first method. But it's the method that I'm currently using now, thanks a lot -
Basically, I have a form which my players fill in. Which then gets submitted to my database, and sets the question 'status' field to 'Open'. I have that working, but there's a problem. When you submit a question, and my update query is executed, it sets every row in the database to 'Open' in the 'status' field. Is there a way to just set it to open for just that ticket? Here is my code for inserting. $query = mysql_query("INSERT INTO unbanappeal (username, email, topic, banned_you, ban_reason, unban_reason , ticket_id) VALUES ('$username','$email', '$topic','$banned','$banned_for','$why_unban','$ticket_id')") or die(mysql_error()); $set = mysql_query("UPDATE unbanappeal SET status = 'Open'"); Also, is there a way to have SET in my $query. I've tried it, but it never worked.
-
Sorry for the late reply. And sorry for sounding like this... But what do you mean by 'add a static column to the select list'? I've done what you said, and to only use what columns I need, and have this so far. SELECT 'ban' as type, time, player, banned_by, reason FROM bans WHERE player = '$search' union all SELECT 'kick' as type, time, player, kicked_by, reason FROM kicks WHERE player = '$search'
-
I've ran into a small problem. I have 2 tables called 'kicks' and 'bans', and I have created a query that selects all the data from both of them. On my webpage, I have a table column called 'Type', and I'm wanting to display 'Ban' if it's from the ban table, and 'Kick' if it's from the kick table. Is there a way to echo words out based on what database table the values are coming from? Here's my query if needed. $query = mysql_query("SELECT * FROM bans WHERE player = '$search' union all SELECT * FROM kicks WHERE player = '$search'");
-
Oh, that's no good then. Do you know if there is any alternative that will work in both Chrome and Firefox?
-
I have a dropdown menu which uses the onclick="window.location =''" feature to navigate to different pages on my statistics website, and it works fine in FireFox. But it doesn't seem to be working at all when I try it in Chrome.... Is there a simple way on how to get it working for both FireFox and Chrome, or doesn't Chrome support it? Here's my dropdown if needed. <select> <option></option> <option onclick="window.location = 'http://www.stats.dawncraftmc.com/online.php'">Online</option> <option onclick="window.location = 'http://www.stats.dawncraftmc.com/kills.php'">Kills</option> <option onclick="window.location = 'http://www.stats.dawncraftmc.com/deaths.php'">Deaths</option> <option onclick="window.location = 'http://www.stats.dawncraftmc.com/xp.php'">XP</option> <option onclick="window.location = 'http://www.stats.dawncraftmc.com/blocks.php'">Blocks</option> </select>
-
Sorry for not selecting the columns that I actually needed. But after I changed the players_killed.players_kill to player_stats.players_killed it worked. Thanks for your help
-
Thank you. Looks like I'll have to learn JOIN. I've put in the ORDER BY as you suggested, but now I have an error in my while loop. $user = mysql_query("SELECT players.id, players.username, players_killed.players_killed FROM players JOIN players_killed ON players.id = players_killed.playerid WHERE players_killed.players_killed > 100 ORDER BY players_killed.players_killed DESC LIMIT 50"); while($stats = mysql_fetch_assoc($user)){ echo "<tr bgcolor='#BFFFFF'><td>".$stats['username']."</td>"; echo "<td bgcolor='#00FF00'>".$stats['players_killed']."</td></tr>"; } I get an error on line 90, which is while($stats = mysql_fetch_assoc($user)){ I've had the error before, and it was simple to fix. But I can't seem to find the problem this time...
-
Hi, I'm trying to show the players that have more than 100 player kills. But I seem to be having a small problem. I store my players username and statistics in different tables, and I can't seem to get it working. This is what I have so far: $user = mysql_query("SELECT * FROM players LIMIT 50"); while($username = mysql_fetch_assoc($user)){ $id = $username['id']; echo "<tr bgcolor='#BFFFFF'><td>".$username['username']."</td>"; $user_s = mysql_query("SELECT * FROM player_stats WHERE playerid = '$id' AND players_killed > 100"); while($player_stats = mysql_fetch_assoc($user_s)){ echo "<td bgcolor='#00FF00' class=\"td_b\">".$player_stats['players_killed']."</td></tr>"; } } It lists the first 50 players, which isn't what I want. I'm wanting it to display only kills over 100 from the player_stats where the id from players is equal to the player_id in player_stats. I looked into joining the queries, but I wasn't sure if would of worked. Could someone help me please? Thanks in advance
-
The 'No results found' problem has been fixed. Thanks guys. I need to check whether the user has entered their value in the input field next, as I'm doing 'No results found' as a default message if a user decides to go to that page in the URL. It does work now though, thanks for your reply.
-
Hi, I'm having a small problem with my query. I'm basically getting the user's input, and searching the database for a match towards their input. If it finds a match, display it. If it doesn't, display a message. My query does display the data if it finds a match, but it display everything from the database if it doesn't find anything. Could someone tell me what I'm doing wrong please? Here is my code: <?php $search = mysql_real_escape_string(trim($_POST['ticket'])); $query = mysql_query("SELECT * FROM unbanappeal WHERE ticket_id LIKE '%$search%'"); $ticket_id_check = mysql_num_rows($query); if($ticket_id_check < 0){ echo "No results found."; }else{ while($row = mysql_fetch_assoc($query)){ echo $row['username']; } } ?> Also, is it possible for me to change my query from displaying any data that's like the user's input, to the data that is exactly like the user's input? Thanks in advance.
-
That works fantastic! Thank you I never knew that it was so easy. Looks like I was just using the wrong input fields and passing it through to the IPN script wrong too