
Alex
Staff Alumni-
Posts
2,467 -
Joined
-
Last visited
Everything posted by Alex
-
[SOLVED] MySQL UPDATE issue and a problem with fwrite().
Alex replied to ZeroError's topic in PHP Coding Help
put error_reporting(E_ALL); at the top of the page and see if any errors are thrown. -
[SOLVED] MySQL UPDATE issue and a problem with fwrite().
Alex replied to ZeroError's topic in PHP Coding Help
If you check the manual you'll see that fwrite() takes 2 mandatory parameters: 1. The resouce ($handle in your case) which you are passing. 2. The data that you want to write to the file. if(fwrite($handle, $data)) {...} -
Add some debugging to your code so you can see what's going wrong. More specifically you might want to check to make sure $session->referrer contains what you want it to.
-
$var = implode("\n", array_map(create_function('$a', 'return implode(" || ", $a);'), $arr)); First array_map() is preformed on $arr which is our multidimensional array. For every array it preforms implode(" || ", $a), which basically takes each array and implodes with a delimiter of " || ". So basically array_map() in this case overall returns an array of strings like "linkname || linkurl.com", finally the last implode() takes that array returned by array_map() and creates a string with a delimiter of "\n". array_map() create_function() implode()
-
You're never closing your constructor. class Process { /* Class constructor */ function Process(){ global $session; /* User submitted registration form */ if(isset($_POST['subjoin'])){ $this->procRegister(); } } // Forgot this.
-
That's just a static array for the example.. You can plug any other Array with any other number of elements and it'll work.
-
Yea, I can see it's there.. But why?
-
Why are you doing this? for($i=0; $i<256; $i++) { imagecolorallocate($file, $i, $i, $i); } There's no purpose for that at all..
-
Then just use a similar concept to append text to a div 5 seconds after a page has loaded if the account was created.
-
You have an extra ) in the query.
-
If I understand you correctly, you want the user to enter information, press submit then in about 5 seconds output if it's valid or not? This seems like a very bad idea for many reasons.. But here's a basic example: <script type="text/javascript"> function validate(username) { var t = setTimeout("check('" + username + "')", 5000); } function check(username) { alert('It\'s been 5 seconds..'); } </script> <form action="" method="" onsubmit="return false;"> <input type="text" name="username" /> <input type="submit" value="submit" onclick="validate(this.form.username.value)" /> </form> Inside check() you'd want to perform any checks on the data..
-
You can get this effect by using JavaScript validation (make sure you're also validating by PHP) and timed events.
-
The reserved $this variable can only be used inside methods of objects.
-
I don't know what you're talking about.. My solution will work with any number of arrays..
-
You'd do it simply like this: $username = mysql_real_escape_string($_POST['user_name']); I don't see why you'd want to preform stripslashes on the input as well.. You'd use that when returning the information from the database if magic quotes are on (which isn't a good idea in the first place).
-
You never closed the bracket on this line: if ($_SESSION['username']) { And I'm guessing you're also mixing up some brackets.
-
To answer your question, no it will not check the queue function only once. It will check it each iteration.
-
You should never reply on a hidden field named MAX_FILE_SIZE. You should be checking the filesize in PHP using filesize(). To prevent mysql injections preform mysql_real_escape_string() on all data before passing it to mysql_query().
-
You need to be more specific..
-
I showed you which brackets weren't being closed. To solve your problem simply put 2 more right curly brackets before ?>
-
<?php $arr = Array( Array('linkname', 'linkurl.com'), Array('linkname', 'linkurl.com'), Array('linkname', 'linkurl.com') ); $var = implode("\n", array_map(create_function('$a', 'return implode(" || ", $a);'), $arr));
-
$end errors are almost always caused by forgetting a bracket. In your case you're missing 2 brackets that you need to add to the end of your PHP. Both of these statements aren't be closed: if ($submit); { //check for existance if($name&&$surname&&$email&&$username&&$password&&$confirmpassword) { And for the future make sure you use [ php ] or [ code ] tags (without the spaces).
-
So like the opposite of what I did? I don't really follow what you're saying..
-
You want to use explode(), not implode(). implode() takes an array and makes a string, the opposite of what you want to do. <?php $file = <<<FILE linkname || linkurl.com linkname || linkurl.com linkname || linkurl.com linkname || linkurl.com FILE; $arr = array_map(create_function('$a', 'return array_map("trim", explode("||", $a));'), explode("\n", $file)); echo "<pre>"; print_r($arr); echo "</pre>"; Output: Array ( [0] => Array ( [0] => linkname [1] => linkurl.com ) [1] => Array ( [0] => linkname [1] => linkurl.com ) [2] => Array ( [0] => linkname [1] => linkurl.com ) [3] => Array ( [0] => linkname [1] => linkurl.com ) )
-
Np, just remember to always mark topics as solved once the issue has been resolved. There's a button on the bottom left to do so.