AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
Take a look at "sticky forms" and file_get_contents, file_put_contents
-
You are referencing index values that do not exist. You must first verify that both indices are set before using them.
-
-
1. "Login" isn't really an object it's a procedure and shouldn't be made into a class. Creating a User class and creating login method(s) for that class would be a better OOP solution. 2. In the call to mysql_query() you are using variable $connection when in fact variable $conn is what holds your mysql link.
-
How to print PHP errors and warnings in the web browser?
AyKay47 replied to dariyoosh's topic in PHP Coding Help
phpinfo -
The user can input apostrophe's without tampering with the SQL code as long as mysql_real_escape_string() is called on the data before using it in the SQL statement. This will escape any potentially harmful characters so they are not parsed as literal characters.
-
Besides the incorrect SQL syntax:
-
To clarify, session_start() is needed in any script where you are using sessions.
-
I wouldn't use a $_GET value to begin form handling for various reasons. Instead, check either a hidden input value or an existing input value being passed to begin form handling. Make sure to only use the die() function during development, as it is not very user-friendly. Also, you should be implementing error checking logic into your code so you can see exactly what and where the problem is: $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $q = "SELECT * FROM `client` WHERE `Username`= '$username' AND `Password`= '$passLIMIT 1"; $r = mysql_query($q); if(!$r) { die("SQL statement: " . $q . "<br />" . "SQL Error: " . mysql_error()); } ... I'm also curious why you are using the MYSQL PASSWORD() function? You shouldn't be in this context.
-
There is also a nice tutorial on this topic provided by phpfreaks: http://www.phpfreaks.com/tutorial/sessions-and-cookies-adding-state-to-a-stateless-protocol
-
First attempt at designing an MVC for my new project
AyKay47 replied to MySQL_Narb's topic in Application Design
Please post the code onto this thread. -
Something like this should work for you: $emails = array(); //initialize $query = "SELECT * FROM mailinglist ORDER BY email"; $result = mysql_query($query); $numrows = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $id = $row['id']; $email = $row['email']; $links .= '<li><a href="mailto:'.$email.'">'.$email.'</a> <span class="delete"><a href="?cat=05&delete='.$id.'" onclick="return confirm(\'Are you sure you want to delete?\n This action CAN NOT be undone\')"><a></span></li>'; $emails[] = $row['email']; } $list = implode("; ", $emails); Also, be sure to implement error checking logic into your code
-
Just from the context of those two lines, a few things can be said: 1. $row is already an array (What does the index "email" actually hold?) 2. $emails contains a two dimensional array 3. A variable that does not yet exist in the script context is being concatenated onto. We need to see ALL of the relevant code logic in order to be able to properly help you.
-
Make sure that the allow_url_fopen option is enabled in the servers master php.ini file.
-
trouble with querying php mysql multiple tables
AyKay47 replied to savage's topic in PHP Coding Help
Post the initial problem and solution to possibly help others in the future. -
make sure that the "id" index is set in the $_GET superglobal array before setting it's value to a variable. $id = (isset($_GET["id"])) ? intval($_GET["id"]) : false then proceed with PaulRyan's code
-
Look into using fgets and store the lines into an array.
-
What? Jessica pointed out the problem that we both overlooked.
-
Also, it may help to output your query and check for errors there.
-
What results are you expecting? Also, use mysqli_error() instead of mysql_error()
-
How To Output Multidimensional Array , With For Loop ?
AyKay47 replied to printJimy's topic in PHP Coding Help
"a" and "b" are both string keys. In a situation where you would need to have string keys and do not want to use a foreach loop (why not?), use a persistent naming convention for the keys so you can reference them properly inside of the loop(s). Something like this: $mArr = array( "number1"=>array(1, 2, 3, 4, 5), "number2"=>array(7, 20, 43, 44, 25) ); $i = 0; $c = count($mArr); while($i < $c) { $index = "number" . ($i + 1); $j=0; $c2 = count($mArr[$index]); while($j < $c2) { echo $mArr[$index][$j] . PHP_EOL; $j++; } $i++; }- 23 replies
-
- multidimensional arrayphp
- for loop
- (and 1 more)
-
Holy global batman! Please post the relative code in this thread instead of an attachment.
- 3 replies
-
- search
- search form
-
(and 3 more)
Tagged with: