jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
I can't figure out why data isn't saving in my tables
jazzman1 replied to Fish181's topic in PHP Coding Help
It should be something like $result = mysql_query($sql, $link); if(!$result) die('Error: ' . mysql_error()); As a newbie in php you should consider using mysqli or pdo libraries in php instead the mysql. Don't waste your time! -
I can't figure out why data isn't saving in my tables
jazzman1 replied to Fish181's topic in PHP Coding Help
He-he, you didn't execute the query string to your database. -
Save the file which contains this text field as UTF8 file encoding without BOM, because I don't see anything wrong with this name.
-
Help with code. query does not work inside a function?
jazzman1 replied to r2get's topic in PHP Coding Help
I think, that's a logic error b/s of if{}else{} block and the $emailcode has never been assigned a value as an argument to the activateUser function. So, try something like that: <?php if (isset($_GET['emailcode'])) { $emailcode = strip_tags(trim($_GET['emailcode'])); //Check if only numbers and letters if (!preg_match("/^[a-zA-Z0-9]+$/", $emailcode)){ $errors[] = 'De door jou opgegeven email code klopt niet'; } // check for errors if (!empty($errors)) { // display the errors and return false } else{ // call the activateUser function and procced the query statement activateUser($emailcode); } } -
@mac_gyver, in the beginning I was thinking that the database server is external for omgtechnotes.me.pn. Anyways, good spot
-
Change this: $host = "fdb5.freehostingeu.com"; to $host = "83.125.22.199"; Also, as mac_giver said:
-
Phone and ask them why the port 3306/port is closed for mysql.By default, it should be filtered not closed.
-
What about the port connection? By default mysql use port 3306 to connect to database, but....I don't see this port to be opened for that domain.
-
$host = "fdb5.freehostingeu.com";
-
What about the mysql address?
-
I am not sure whether the checkbox element accepts a value attribute itself, check at docs, but .. entirely sure that the checked attribute can be used to indicate the default state. So, you should set this to either true or false.
-
No, that's impossible or you have a logical error somewhere in the script. My briefly test just works fine: <?php error_reporting(-1); if (!empty($_POST['registerbtn'])) { $getuser = $_POST['user']; $getemail = $_POST['email']; $getpass = $_POST['pass']; $getretypepass = $_POST['retypepass']; if (isset($_POST['fn'])) { echo "checked"; exit(); } } ?> <form action='index.php' method='post'> <table> <tr> <td></td> <td><font color='red'></font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='user' value='' /></td> </tr> <tr> <td>Email:</td> <td><input type='text' name='email' value='getemail' /></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='pass' value='' /></td> </tr> <tr> <td>Retype Password:</td> <td><input type='password' name='retypepass' value='' /></td> </tr> <tr> <td>Receive Forum Notifications:</td> <td><input type='checkbox' name='fn' value='1' /></td> </tr> <tr> <td></td> <td><input type='submit' name='registerbtn' value='Register' /></td> </tr> </table> </form>
-
Can you post here some piece of text?
-
No! You should consider using cURL or IMAP libraries in php.
-
If you're running into a blank page and you have no clue what is wrong, you should consider turning on PHP error reporting. To display all PHP error messages you could include this line of code on the top of the file: // Report all PHP errors error_reporting(-1); Add: If somehow your display_errors directive in php.ini is set to "Off", try next ini_set('display_errors',1); error_reporting(E_ALL);
-
But, you have already saved this information, everything you have to do, is to display this JSON object in proper readable format! To keep the things simple, let's say we have two files: json.php ( it's a file that we're connecting to our database and retrieve our database data into a JSON object) display.php (it's a file that we want to display JSON) So, the conetent is: json.php <?php echo '{"Sofia":["26","42.696693","23.302080"],"Lovetch":["13","43.140461","24.718996"]}'; display.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.getJSON('json.php',null, processJSON); function processJSON(data){ var infoHtml = ''; $.each(data, function(city, cityInfo) { infoHtml += '<h4> City: '+city+'</h4>' infoHtml += '<p>Numbers: '+cityInfo[0]+'</p>' infoHtml += '<p>Latitude: '+cityInfo[1]+'</p>' infoHtml += '<p>Longitude '+cityInfo[2]+'</p>' }); //end each loop //display infoHtml variable $('#infoBox').html(infoHtml); } }); </script> </head> <body> <div id="infoBox"></div> </body> </html> So, if we run the script, the result shoud be someting like: If we want to edit(update) or delete some particular row in our database, we should have to create only two html input fields (or links) and each of them can provide some paricular information itself to delete or update something in our database. Send this request by Ajax and everything should be Ok. That's all you have to do. PS: If you want to add a new info, you have to create an html form to do this. Just forgot to mention
-
What do you want to be count here? $count=strlen($name); The "$name" is already a string not an array.
-
Nobody asked me whether I wanna be a guru at phpfreaks.com.It was just a guru(mod) community decision.It does not matter for me to be or not a guru at all. I just wanna provide my help. Yes, he could put the error_reporting() function on the top of the page, but var_dump() is a good solution too. No, the message has been sent with empty values! It's not really necessary to use curly braces or heredoc here, but if you want it, you should aware that all braces expansion are performed before any other expansions, and any characters special to other expansions are preserved in the result. That's why, you cannot have more then one variable, like { $var1 $var2 } outside of a function or just for "for", "while", "foreach" looping constructs. If you're using some IDE, you will get a syntax error!
-
Yep, you should read that for sure. Don't be a lazy boy or girl
- 45 replies
-
- apache
- mod_rewrite
-
(and 1 more)
Tagged with:
-
@hakim, please don't provide wrong or useless solutions! Here isn'a a children's place. It's a help forum. Also, check at docs where and how you can use curly braces in the scripts.
-
The first thing, you should have to do before sending any data, is to check the values of every POST request. var_dump($_POST) is a very good debugging php function.
-
Well, your regexp pattern is wrong in that case PS: This is a good article for beginners.
- 45 replies
-
- apache
- mod_rewrite
-
(and 1 more)
Tagged with:
-
How do you get these names from a database or just from a regular file?