-
Posts
155 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Frank_b
-
A lot of beginners will think something like 'wow that will be a long list in the join table'. Yes but computers are fast these days and its exactly where databases are made for. It is not a problem at all and besides of that it is the only way to keep track on which user has which apps!
-
That is not be too dificult either. First of all your application needs to know what are standard apps and which one not. To do that you could simply add a column to the apps table with a name like for example 'default' or 'standard'. Give apps a 1 if they are standard and otherwise a zero. After that, when a user signed up and you store the user details into the database you can also immediately add records to the users_apps table. (that would be a while loop with INSERT queries)
-
That sounds as a many-to-many relationship with three tables: table 1 : users table 2 : apps table 3: users_apps Table 3 is what we call a jointable which makes relations between records out of the users and the apps table. a little example would help i guess: users table : - user_id (primary key, autoincrement) - username - password - email - .... apps table: - app_id (primary key, autoincrement) - name - description - download_url - .... users_apps table: - user_id (foreign key, in phpMyAdmin als index called) - app_id (foreign key, in phpMyAdmin als index called) some example rows in users_apps: user_id app_id 1 1 1 2 3 1 this let us know that user with id 1 have downloaded two apps: 1 and 2 Also we see that user 3 have downloaded only one app: app nr 1. With a little query we can also count how much times every app is downloaded: app 1 has been downloaded twice and app two has been downloaded once.
-
MySQLi not working after converting from MySQL
Frank_b replied to NovaPark's topic in PHP Coding Help
Jacques, What you write is absolutely true but don't forget that PDO uses OOP techniques that not suit for a lot of hobbyist programmers. -
Hi, My advise is to contact the supportdesk of your provider or to use PHPMailer to send your emails by a SMTP server. For example you can use a SMTP server from godaddy.com or one from your internet-connection provider or gmail.com for example. You can find the original PHPMailer repository at https://github.com/PHPMailer/PHPMailer
-
MySQLi not working after converting from MySQL
Frank_b replied to NovaPark's topic in PHP Coding Help
Starting with the first function: mysqli_connect() .. In a perfect world the connection to the mysql server would never fail but this does not sound realistic. In reality i could fail couse of many reasons. That's why functions gives data back. Take a look here: http://php.net/manual/en/function.mysql-connect.php and then under the section Return Values. You will learn that this function can give a FALSE if something went wrong. You should test that and if it gives FALSE you could use mysql_error() to show an error. Same story for other functions like mysqli_query() for example. -
It is JSON and the strings are encrypted.
-
Help - Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result
Frank_b replied to EW123's topic in MySQL Help
A little warning: if your query works fine but the user was not found in the table then you won't get an error. Instead you will get your result with zero rows! You can use mysqli_num_rows($result); to test if there would be a row available. -
Should be tieder to use different identifiers like this: instructor_id class_id
- 2 replies
-
- join
- multiple columns
-
(and 2 more)
Tagged with:
-
Yes that is possible. its called a default value. The only rule is that parameters with default values come after parameters without.
-
Help cleaning invidible characters out of scraped data
Frank_b replied to 5kyy8lu3's topic in PHP Coding Help
Stealing data from somebody else? -
Creating a dynamic table with 5 columns per row
Frank_b replied to Texan78's topic in PHP Coding Help
can you post (a short version of ) the xml file? -
Creating a dynamic table with 5 columns per row
Frank_b replied to Texan78's topic in PHP Coding Help
or like this: $legend .= "<table>"; $legend .= "<tr>"; $i = 1; foreach ($result as $entry) { $event = $entry->children("cap", true)->event; $legend .= "<td> <span style='$spanStyle'> $event</span></td>"; if($i % 5 == 0) $legend .= "</tr><tr>"; $i++; } $legend .= "</tr>"; $legend .= "</table>"; -
Hi, First of all it makes a difference about what kind of users you are talking about. Are these random users from all over the world like on this forum or are these users inside a company? If from around the world and you want them to be self supporting then there are two possibilities: a) a user had forgotten his credentials. b) a user just want to change his password. in situation a it is not possible for the user to login. Therefor there should be a password reset function. As we know we human can fill in any name, address, age and more we want. it can be a fake one, the server does not know. The only sureness you can build in is if a new user register is to check if he is the owner of an emailbox. We can do that by sending the user a link that he have to follow to register himself. a link like this could be https://mydomain.com...nvasperuq84j-y0. The last part of the url is a unique identifier to see if it matches a new user account. Later if this user loses his credentials you can offer to send the emailaddress again. After that you should send the user a same email with a url with a unique identifier. if he clicks that link then the user would be able to change the password for that account. The username could be sended again on request.
-
Hi, From my favorite dutch forum i know that the most people over there use Laravel. But i think that the Zend and Symfony frameworks are still the most advanced frameworks. I use Symfony and can say that it is really great but also hard to learn. The form builder of symfony is really most flexible and extensive ever made. Before i started using Symfony i used CodeIgniter which is a very easy to use MVC framework. I do not recommand CodeIgniter as an adult framework but it could be a start to get yourself up into the world of frameworks.
-
At first try to use the mail function standalone like this mail('[email protected]','testmail','Hi did you receive this mail?'); Check if you receive the testmail. Don't forget to look into the spam map also. If you do not receive the email then the email() function might be disabled in the php configuration file or the outgoing email server has not been properly set. Please tell us more about the machine where you run you scripts from. (Windows or Linux, home computer or provider ?)
-
Saving data from all text boxes in one click
Frank_b replied to harilalmn's topic in Application Design
Take a look at this little working example: <?php if($_SERVER['REQUEST_METHOD'] == 'POST') // check if the form has been submitted { for($i = 0 ; $i < count($_POST['id']) ; $i++) { echo 'id '.$_POST['id'][$i].' has name '.$_POST['name'][$i].'<br>'; } } ?> <html> <head> <title>test</title> <meta charset="UTF-8"> </head> <body> <pre><?php print_r($_POST); ?></pre> <form action='' method="post"> <input type='hidden' name='id[]' value='1' /> <input type='text' name='name[]' value='Frank' /> <input type='hidden' name='id[]' value='2' /> <input type='text' name='name[]' value='Joop' /> <input type='hidden' name='id[]' value='5' /> <input type='text' name='name[]' value='Carl' /> <input type='submit' value='Send' /> </form> </body> </html> -
With complex calculations PHP's automatic typecasting could be a problem. Also as far as i know PHP only supports up to 32 bit integers. There are a few opensource C(++) webserver's available on the net with documentation. If you run you own (virtual) private server it should be posible to run a secondary webserver on a different port. One example is https://code.google.com/p/mongoose/
-
function removeTextBetweenBrackets($str) { $inside = 0; $result = ''; for($i = 0 ; $i < strlen($str) ; $i++) { if($str[$i] == '(') $inside++; if($str[$i] == ')') $inside--; if($inside < 0) $inside = 0; if($inside == 0 && $str[$i] != ')') $result .= $str[$i]; } $arr = explode(' ', $result); $arr = array_map('trim', $arr); return implode(' ', array_filter($arr)); } echo removeTextBetweenBrackets('S (180 degrees) at 26 MPH (23 KT)');
-
Okay i do only see a part of a user registration process and not of a login . Your code is not secured for sql injection. (google it) if a user wants to log in he will enter his username and password into a login form. When the form has been sent your php script have to compare username and password to the usernames and password available into the database. In the database are only encrypted passwords. so you need to compare an encrypted password to another encrypted password or they will never be equal. THerefore you have to encrypt the password that has been sent through the form first before you compare it to the passwords into the database. If you nee more help, please post the part that handles your login form.
-
type ssh <hostname>
-
once that an array is loaded in your servers memory it will be as fast as any other variabele in your server's memory. But with PHP it will common be loaded again and again on every request to the server. For the best performance you should programm an apache extension that loads your array once on startup and keeps it into memory as long that the server is up and running. Database engines takes that job away for you and serve you a lot more behavior which you can use.
-
so if you type in your browser: http://mydomain/blog you do get an error, and if you type http://mydomain/blog/index.php everything is fine? That is server behavior i think. Is there any .htaccess file somewhere in http://mydomain or in http://mydomaine/blog ? If there is, what is the content of this file? Is it your own server or computer or do you use a shared server from a host?
- 3 replies
-
- content-management
- syntax-error
-
(and 3 more)
Tagged with:
-
what i expect is that it will still be suported for a while simply because a lot of existing webpages will not change in years. But if you want to use a better method then you should use the data- tag: <a id="me" data-id="him" data-name="you"> The id tag is NOT deprecated in html5.
-
Refresh part of a page upon successful ajax call
Frank_b replied to lordterrin's topic in PHP Coding Help
You need to understand the difference between a common page refresh after a press on the submit button and what happens if javascript handles everything. I assume that you know how a simple form works: User fills in some formfields and presses the submit button. Submitting a form is like a page refresh or a redirect with only that difference that some additional form-data has been sent with the request. And now you are dealing with AJAX. Ajax is a feature in javascript. And before i forget to tell you: javascript runs in the browser from the user where PHP runs on the webserver. That is a HUGE difference. Right we are talking about scripting in the browser. With javascript you can hide, show or change some elements on the page. With the help of AJAX you can also fire a new request to ANY server in the world. That will happen completely on the background. The user will not mention that. The action that the server does can be anything: updating a record, deleting a record, what ever you want. After this action the server has to send a response to the client. This response can be anything as well. It can be an answer like "accepted" or "Ok" but it can also be data. For example new data to fill a div with a new content. These days this data comes often in a format that we call JSON, But can be sent as plain text or xml as well. After that THE JAVASCRIPT in the browser received some data back from the AJAX call to the server there will be still nothing visible. The javascript must be extended with some functions that handle the data and update a part of the page content. Before i start to write a complete tutrorial: Google on basic AJAX examples and start to play with it. After that google on JSON. If you are common with JQuery than you could search on the JQuery website as well.