- Strength to Increase Rep
- +13
- Strength to Decrease Rep
- -3
- Upvotes Received
- 555
- Posts with Upvotes
- 382
- Upvoting Members
- 169
- Downvotes Received
- 9
- Posts with Downvotes
- 9
- Downvoting Members
- 8
I've been doing all sorts of thing within the IT area. Started on Spectrum for fun back in eighties I started to seriously engage in CAD (Microstation, MDL, Autocad, Lisp) in nineties and then shifted to IT security (smartcards, PKI, e-banking...) and…
- Interests
- My spare time is mostly spent for music. I play keyboards in a seven piece band.
- PC Specs
- HP ProDesk i5, Ubuntu 17.10 at home, Windows 10 at work
Re: The image method: http://www.fpdf.org/en/doc/image.htm The tutorial: http://www.fpdf.org/en/tutorial/tuto2.htm | |
Re: Now, there might also be a problem in the password field definition in the table spec: `password varchar(20) NOT NULL`. As far as I remember the good old MD5 produces a hash of lenght that fits into CHAR(32). So password hashes stored in the users table could be truncated due … | |
Re: This is interesting, thanx for sharing. But what were the requirements for this kind of script? Is this a part of a production application? And did you have to implement any security (so the whole world does not start sending thousands of pages to your printer)? | |
Re: If you intend to use quotes arround field and table names in Mysql you must use backticks, not single or double quotes. However they are not required if table and field names are not same as Mysql keywords/reserved words which is your case anyway. See the list of Mysql keywords … | |
Re: In first version you are missing the other condition ($_SESSION['iiio'] != "pending"). In that case the div is shown by default. It looks like you are using Bootstrap so you can use the `show` and `hidden` classes provided by Bootstrap. I am using ternary expression here since it is most … | |
Re: The code is basically OK except for the `return` statements. Why do you use them? Are the PHP scripts being called using the `include/require` statements? And make sure your first script has the `.php` extension (not the `.html`). | |
Re: Not sure what exactly is the expected workflow but few notes anyway: The PHP code in the beginning of the test.php should probably only execute after form submission or when the `$_POST` values are set so maybe perform a check or you might get errors/warnings: if(isset($_POST['submit'])) { $user = $_POST['user']; … | |
Re: Quite many issues here: The following code is not valid: $valueToSearch = $_POST['requirementtype' 'build' ]; You can not have two strings as an array index. They should be separated in i.e two variables like so: $searchRequirementtype = $_POST['requirementtype']; $searchbuild = $_POST['build']; These two values should be escaped before used in … | |
Re: You can get the variables out of sight by using POST method in your form or call instead of GET which you are using in above example. If you use POST the variables won't be part of the URL instead they will be "hidden" in the HTTP header. Mind you … | |
Re: The ID that appear in the URL depends on the field names of the form that sends the data. A field in your form probably has a name attribute that equals to `id` and information entered into that field goes into the `id` variable in the URL. I would recommend … | |
Re: You should do it in a similar fashion. I presume the information about the gender is stored in a database for each user. When they login you read this information and redirect based on it. Something like: if($row['gender']=='Couple MF') { header('location:landingpage2MF.php'); } else if($row['gender']=='Couple MM') { header('location:landingpage2MM.php'); } else if... | |
Re: If you want to use a variable inside a string then the string must be enclosed in double quotes. [CODE]$var = 'foo'; echo "Variable value: $var";[/CODE] will display: [CODE]Variable value: foo [/CODE] while[CODE]$var = 'foo'; echo 'Variable value: $var';[/CODE]will display: [CODE]Variable value: $var[/CODE] See [url]http://www.php.net/manual/en/language.types.string.php[/url] | |
Re: EDIT: I noticed after posting that the javascript functions are meant to be in a separate JS file. Disregard my 1. remark, sorry. Had a quick look at the code and there are two obvious error: 1. The Javascript functions are outside the `<html></html>` and outside the `<body></body>` pairs which … | |
Re: You can also check how the query gets constructed, using similar technique as described above by cereal. Just add this between line 2 and 3: die($query); This will print out the query on the screen and stop the script. Now you can inspect the query whether it has all the … | |
Re: If you have a fixed number of variables (known in advance and equal to the lenght of the `$row`) you could use the [list](http://php.net/manual/en/function.list.php) function. Something like: list($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m) = $row; But be aware that using an array instead … | |
Re: You can not subtract two strings representing dates on line 4 and expect to get a difference. Besides the variables on line 4 have not been declared anywhere (but I guess you just misstyped them). The best thing to do is to use the [DateTime](http://php.net/manual/en/class.datetime.php) and the [DateInterval](http://php.net/manual/en/dateinterval.format.php) PHP classes. … | |
Re: Looking at your code the new_entries table is in another database (`newentries`). Is that what you really wanted to do? You are duplicating rows (althoug in another database) so maybe you first review your DB design. If that is OK, make sure connection to the `newentries` database is OK and … | |
Re: Quite many issues here, some big, some smaller. I'll try to comment on some without any particular order of importance. 1. On line 9 you try to concatenate some unknown constant. It should be either a variable (i.e. `$error`, but defined somewhere) or mysqli's error function `mysqli_connect_error()`. 2. I strongly … | |
Re: I tried your code and the table gets generated OK. I get this: Age Beg Bal Interest Deposits Ending Bal 45.00 2000.00 324.65 1200.00 3524.65 46.00 3524.65 521.09 1200.00 5245.75 47.00 5245.75 742.58 1200.00 7188.33 48.00 7188.33 992.31 1200.00 9380.63 49.00 9380.63 1273.87 1200.00 11854.50 50.00 11854.50 1591.33 1300.00 14745.83 … | |
Re: Use [PHPExcel](https://github.com/PHPOffice/PHPExcel) to create Excel file from the data you read from the database. Dynamic headers are just headers that contain text and formulae in them (the header changes if the information in the respective column changes). You have to build those formulas yourself. | |
Re: If this is a guide how to do something it has serious issues: * POST variables are not being sanitized so arbitrary code can be injected * An old and deprecated mysql extension is used So sanitize (check, validate, cast, replace, blacklist, whitelist...) the post data and switch to the … | |
| Re: > Is it possible to do a nested checkbox It is, but you will have to code. Use Javascript or even better jQuery to listen to the click event and to check related checkboxes upon clicking the main one. It is easier if you put related checkboxes in a container … |
Re: Displaying images in a grid is probably better since your page will be displayed nicely on mobile devices - provided that your grid is set-up properly. You can use a proven framework for that such as [Bootstrap](http://getbootstrap.com/). If you want to display images in pages use pagination - google for … | |
Re: If you want to prevent unauthorised users from displaying the iamges you can encrypt them using [mcrypt_encrypt](http://php.net/manual/en/function.mcrypt-encrypt.php). But be aware that you have to deal with key management to be able to decrypt later. By that I mean generating secure keys, securely storing the keys not to expose, corrupt or … | |
Re: I can't test the code since I am on Linux and using Firefox and Chrome. However my recommendation is that you use [jquery](http://jquery.com/) functions in your javascript code since jquery is meant to abstract browser differences. Looking at your code you did include jquery library but are not using it. … | |
Re: PHPExcel site is [here](http://phpexcel.codeplex.com/), documentation is [here](https://github.com/PHPOffice/PHPExcel/wiki/User%20Documentation%20Overview%20and%20Quickstart%20Guide). Great library, I have used it many times. | |
Re: Try : echo $user_data[0]['fullname']; since fetchAll returns a set of all the rows (only one in your case). | |
Re: You could use jquery ajax [post](http://api.jquery.com/jQuery.post/) method. The data for the post would be all the parameters, that are needed for the public function. The page won't refresh but you will still be able to carry out the insertion into the database. But you need a javascript event to triger … | |
Re: Or use more jquery-like approach, where you catch onclick event in jquery: <button type="button" class="btn-login" id="btn-login">Login</button> ... <script> $("#btn-login").on("click", function() { toggle_visibility('foo'); toggle_visibility('sidebar'); toggle_visibility('tiles'); toggle_visibility('wsf') }); </script> </body> | |
Re: You have 5 rows of select element and checkboxes so you have to keep track of which row a user has selceted / checked. You can do this if you add row number to the name attributes. So for row No. 1 the attribute would be: <select name="lang[1]"> <input name="speak[1]" … |