Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
Means your query is probably failing. Change this line to 1 line: $query = "SELECT header, body, header2, body2 FROM index"; And this line to: $mysql_stuff = mysql_query($query, $mysql_link) or die(mysql_error()); Tell me what the output is.
-
Doh! That's what I was thinking because your syntax was correct.
-
What exactly happens? Do you get any errors? Does it always INSERT even if you're not logged in? Here's your code fixed up: include("config.php"); if(isset($_POST['add_suggestion'])) { if(isset($_SESSION['myusername'])) { $Suggestion_username=$_SESSION['myusername']; $Suggestion_avatar=$_SESSION['myavatar']; $Suggestion_comment=$_POST['Suggestion_comment']; $sql="INSERT INTO Admin_suggestionsT (Suggestion_username, Suggestion_comment, Suggestion_avatar)VALUES('$Suggestion_username', '$Suggestion_comment', '$Suggestion_avatar')"; $result=mysql_query($sql); if($result) { echo "Thanks for your feedback, AdMiN!"; } else { echo "Ops, try again !"; } mysql_close(); } else { header("location:login.php"); } } ?> </pre> <form method="post" action="#"> "> Hear at weloveweed mansion we appreciate your feedback, so feel free to add your comments and dont fucking abuse it </form
-
Sure np, do you mind sharing what it was? Please mark topic solved, thanks.
-
Even though your SQL syntax is correct, change your query to: $result = mysql_query($query) or die(mysql_error()); It should display any errors. You can also echo out your $query to see what exactly you're passing through.
-
Yep, you don't need any parentheses. So this is solved?
-
Try: /* Please leave all the credits. */ include "config/config.php"; function shitChecker($str) { $var = preg_match('/[^a-zA-Z]/', $str); return $var; } function shitCheckerNum($str) { $var = preg_match('/[^a-zA-Z0-9]/', $str); return $var; } if(isset($_POST['submit'])) { //User entered account name $account = $_POST['account']; $apassword = $_POST['password']; } //Connect to accounts db // we connect to example.com and port 3306 $con = mysql_connect($aHost.":".$aPort,$aUsername,$aPass) or die(mysql_error()); // Enter your information here!! mysql_select_db($aDatabase) or die(mysql_error()); //remove bullshit characters $account = mysql_real_escape_string(html_entity_decode(htmlentities($account))); //check for non-alphanumeric characters if(shitCheckerNum($account) == 1) { die("Error: Account contains invalid characters!"); } //Get email and password from account $query = "SELECT (login, password, email, url, nextpay, lastpay, space, band, emails,) FROM accounts WHERE (login='$account' AND password='$apassword'"); $result = mysql_query($query) or die(mysql_error()); $numrows = mysql_num_rows($result); //If no rows, account doesnt exist, die. if($numrows == 0) { $row = mysql_fetch_array($result); $account = mysql_real_escape_string(htmlentities($row[0])); $password = mysql_real_escape_string(htmlentities($row[1])); //Change this body message to whatever you wish. echo "Your Site Url: $query[url]"; echo " "; echo "Next Payment: $query[nextpay]"; echo " "; echo "Last Payment: $query[lastpay]"; echo " "; echo "Total Space: $query[space]"; echo " "; echo "Total Bandwith: $query[band]"; echo " "; echo "Total Emails: $query[emails]"; echo " "; mysql_close(); } else { echo "</pre> <form name="'myform'" method="'post'" action="'bancheck.php'">"; echo "Account Checker"; echo ""; echo " "; echo "Account: "; echo " "; echo "Password: "; echo " "; echo " "; echo "</form>";<br> echo "";<br>}<br><br>echo "<center>"; echo ""; echo " "; echo " "; echo "Created by Chris270"; echo " "; echo " "; echo " "; echo " "; echo "</center>";<br><br
-
$query = "SELECT (login, password, email, url, nextpay, lastpay, space, band, emails,) FROM accounts WHERE (login='$account' AND password='$apassword'); You need the closing quote here as well. But that won't solve your problem. You really need to format your code and learn how to properly indent... Now what line is the error, after you fix the quote issue?
-
From updated code: (Line 46) There is no starting curly brace for your IF statement. if($numrows == 0) { //need this
-
Do you mean all records for that field? You can do: UPDATE table SET field = field - 1
-
If all the fields are checked, and you want to have a button appear, then you need to use JS, this is a client side action where PHP does not exist.
-
You can do this with javascript, moving there...
-
Look at chr. All these functions I find are in the manual, I suggest you take a look.
-
Or, use array_sum. I did not know that one. Thanks for the heads up Maq. The function itself probably does what you suggested, loops through and adds the element values. But there's no need to write it yourself.
-
You resurrected a thread from over a year ago... congratulations.
-
haha, that would be funny and sad at the same time. It would also indicate to say no to drugs, at least more often...
-
I think nrg_alpha covered this in his post (not sure about the dash): http://www.phpfreaks.com/forums/index.php/topic,251852.msg1182619.html#msg1182619
-
You output to the browser before you call the header redirect. You can call ob_flush or you can use a meta redirect.
-
What happens? Are there any errors? Please use tags around code.
-
I assume this is a MySQL question. jack is correct, it's 'AND'. I suggest you read up on basic MySQL syntax.
-
Please re-read my very first post.
-
So what did it output when you echoed the query statement?
-
You coded something and don't have permissions to it?