812 Posted Topics
Re: Have you corrected the missing $ in line 1 of your code (as JorgeM suggested). You might have overlooked it since the error wasn't explicitly mentioned (just guessing). Also you can examine the contents $_GET array by adding this code in the beginning of the script: die(print_r($_GET, 1)); | |
Re: Test the sql staement by inserting this temporary debug code right after line 19: die($sql); This will display the insert query and stop the script. Now you can inspect the query or test it in phpmyadmin. You can also post it here. Also use error checking: $result = mysql_query($sql, $db) … | |
Re: I would check whether the $IdArray exists and is not empty: $query = "SELECT * FROM test WHERE user = '$user'"; if(isset($IdArray) && !empty($IdArray)) { $ids = implode(',', $IdArray); $query .= " AND id IN ($ids)"; } ... And, maybe you should post the $IdArray here (using print_r($IdArray)). Just to … | |
Re: Put $email in single quotes since it is expected to be a string: $result = mysql_query("SELECT users_email, users_pass FROM login WHERE users_email = '$email'"); | |
Re: Learning PHP and web technologies by watching videos: https://phpacademy.org/ A lot of good already made PHP classes (if you decide to go OOP), ready to use or learn by examining the code: http://www.phpclasses.org/ And good old PHP manual, a wealth of first hand information: http://www.php.net/manual/en/ | |
Re: Have you tried to add a second argument that will hold the output of the command: $command = "/usr/bin/lftp -u username,password ftp.website.com -e 'set ftp:ssl-allow off; put /var/www/folder/file.zip; bye'" . " 2>&1"; exec($command, $output); print_r($output); | |
Re: Well, this function looks rather complex. This is valid, but quite hard to debug. But, let's try it anyway. Put this temporary debug code on line 149: echo $applicants[$applicant_id_number] . '<br>'; This should presumably display somewhere all the values of the $applicants array used in the if test (if not, … | |
Re: The trouble is probably in the following statement on line 15: if (mysql_query ("INSERT INTO movieinfo VALUES ('','$Movie_Name','$Poster', '$GenreArray', '$IMDB_Rating', '$Quality', '$Year', '$Trailer')")) where you are trying to use the `$GenreArray` variable, which is of an array type instead of a string. I suppose you want to save genres as … | |
Re: Salt actually increases the complexity of the hashed value and makes dictionary attacks more difficult. The salt should be known only to authorized users (or applications). If you use the default (pre-set) value in CakePHP it's almost like not using the salt since almost everyone knows it or can get … | |
Re: Seems like you had a standalone mysql server installed before you installed xamp and the two do not want to work in parallel. If you do not need a standalone server remove it through the control panel (backup existing data). If you need it, do not start the one in … | |
Re: Seems like you are missing the quotes in the $_POST associative indexes. And in addition to that to get the $_POST array elements properly parsed withing the double quoted string enclose them within curly brackets. $checkdate = "SELECT * FROM emp_status WHERE user_id = '{$_SESSION['user_id']}' AND ((start <= '{$_POST['start']}' AND … | |
Re: To backup a database you use [mysqldump](http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html) command on the db server. You must provide a root password (or dbuser password with appropriate access rights), : mysqldump -u root -pdyourassword yourdbname > yourdbname_backup.sql To do it from a php script use the [system](http://php.net/manual/en/function.system.php) command: $result = system('mysqldump -u root -pdyourassword … | |
Re: You can create [sessions](http://www.php.net/manual/en/book.session.php) on your server only, not on other servers. To create a session put the [session_start()](http://www.php.net/manual/en/function.session-start.php) command on the beginning of your script. Then assign values to the $_SESSION array. On each script that contains a session_start command you can read and change these values. The values … | |
Re: The `$achternaam` variable contains spaces before the actual name and the first space gets capitalized by `ucfirst` function. Use trim to get rid of the spaces: echo ucfirst( strtolower( trim($achternaam) ) ); | |
Re: Try with [curl](http://php.net/manual/en/book.curl.php) and see [this article](http://stackoverflow.com/questions/1363925/check-whether-image-exists-on-remote-url) if it helps. | |
Re: If I got it right your script works fine on local PC but does not work when on online server? But what does not work - inserting into the database or redirection to another page? If insertion does not work you have to make sure the connection to the database … | |
Re: Is the `total` field declared as NOT NULL in your table? If it has to have a value you have to make sure the value exists in the query. You can also check the query if you insert this temporary debug code on line 8: die($insertSQL); This will display the … | |
Re: Do you want to start a war? <= [just kiddin] Seriously, this is a question you won't get a definite answer to. I think both are good. PHP for me is better since I know it :-) (or at least I think I do). As far as I know PHP … ![]() | |
Re: This topic has been already marked as solved but I would like to add useful information that deserves to be added, and this is [OWASP top 10](https://www.owasp.org/index.php/Top_10_2013-Top_10) list of vulnerabilities of web apps and guides on how to minimize them. It might be a slightly more complex reading but it … ![]() | |
Re: You declared `$pass` variable but used `$password` in the query. And also you should check for existence of the data sent from the form and only if it exist query the database. In additon to that you should use quotes when queryinig for strings. And in addition to that you … | |
Re: > This is where the session stops. What do you mean by that? Do you get any error messages? > init.php included at first line, includes the session_start() In this case it is important that you post the code of the included file. On line 61 you have: header('Location: edit.php?success'); … | |
Re: Examine the constructed query to spot possible errors. Add the following temporary debug code to the register_user function: function register_user($register_data) { array_walk($register_data, 'array_sanitize'); $fields = '`' . implode('`, `', array_keys($register_data)) . '`'; $data = ''' . implode('', '', $register_data) . '''; // temporary debug code die("INSERT INTO `sikeres` ($fields) VALUES … | |
Re: You could try with [INSERT ... ON DUPLICATE KEY UPDATE](http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html) provided that you have a unique index or primary key defined (you could use email for that or first_name+last_name). | |
Re: If you look at the source code for the html in browser you will see a script inserted into the jquery load method (probably through the search box): // the script is inserted after this code $("#result").load("search-data.php?keyword= The script is encoded in a way using character codes, and you can … | |
Re: You should use javascript (or better jquery) to read which teacher was selected in the first select element and remove of disable that option in the second select element. The javascript (jquery) code could be controlled by php. The data should be pulled ftom the database. | |
Re: > but when I enter two variables it crashes What do you mean by that? Does your computer crash? Or you just get an error message instead of expected outoput? If there is an error message, please post it. If it isn't enable [reporting](http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) and [display](http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors) of error messages. If … | |
Re: You have to initialize the $error_message to empty string frst: `$error_message = '';` so in case there are no errors the empty string will be displayed (= nothing will be displayed). EDIT: Also you can check if error message exists and display it only then: <?php if(isset($error_message) && !empty($error_message)) { … | |
Re: In my opininion you do not need the cust_type field since it is redundant which is against the database normalization rules. You can always get the oldest one with: SELECT id FROM thetable ORDER BY date_of_trans ASC LIMIT 1 | |
Re: The simplest solution: move the html part (the form) to the end. This way no HTML will be output before the pdf. <?php if (isset($_POST['print'])) { require('fpdf/fpdf.php'); class PDF extends FPDF { // Page header function Header() { $this->SetFont('Arial','B',14); $this->Cell(30,10,'Negros Oriental High School','C'); $this->Ln(); $this->SetFont('Arial','',12); $this->Cell(0,0,'Dumaguete City'); $this->Ln(); $this->SetFont('Arial','',14); $this->Cell(0,20,'OFFICIAL … | |
Re: One approach: 1. make a form for your questions 2. use radio buttons for questions 1 and 2 3. use a text input or text area for question 3, and enclose it in a hidden element (i.e. a div) 4. attach a javascript function on the onclick event of the … | |
![]() | Re: > "Select query returns a result set upon success, whereas Insert query returns a true value upon success" This just means that INSERT query returns true if it succeeds to insert the data into database. On the contrary the SELECT query return rows. If query is unsuccessful it returns false … |
Hi I have just replied on a post that was posted 43 years ago. My reply was also 43 years ago. I had that feeling that time just flies lately but this might be a little too fast. Or is it just some issue with unix time. This is the … | |
Re: Many solutions to that. Basically you have to have two columns for each value in different languages. The field names can have language in their names (such as comment_en, comment_fr for english and french languages). The language is stored somewhere (like in a cookie, in a session or as user … | |
Re: First thing, please do not start [two threads](http://www.daniweb.com/web-development/php/threads/461231/how-to-stored-image-are-display-in-fpdf#post2006442) in a very short time span for the same problem. The problem I ran into was that fpdf's image method expects a file with an extension for supported images. This is why it is a problem to pass it a binary data … | |
Re: For some ideas see [this tutorial](http://www.phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html). | |
Re: > How to make a captcha code unhackable ? What do you mean by this? Captcha is meant to protect against automated scripts and robots (it tries to confirm that the human is using the service). It is not meant to protect from unaothorised access fom hackers. > How to … | |
Re: The problem is that $offerpricepl is not defined yet in the first iteration of the while loop. Put the test first and then echo the row: ... while($row1 = mysql_fetch_array($result1)){ // this is the heading row echo "<tr><td>" . "Selection" . "</td><td>" . "Profit/Loss" . "</td></tr>"; // now define the … | |
Re: You forgot to enclose index name in single quotes. If you want to use double quotes you also have to enclose the array element in curly braces: echo "<div>{$abc['ID']} $id</div>"; | |
Re: The issues with your function are: - The function has it own scope so $row array is unknown to it. Pass the $row array as a parameter. - the code `$bid==$bidpricepl;` and other similar do nothing (== is a comparison operator) - if the function echoes something you do not … | |
Re: In real life nothing is 100% secure. But if you are opening access only for a short time (only for assessment), you should be quite safe. Nevertheless consider the following: Your phpmyadmin should be configured securely: create a user for your teacher, grant him only the necessary privileges, allow him … | |
Re: Make sure that the hosting computer's firewall is not blocking http (port 80). > x.x.x.x:3306/signup.php?... and x.x.x.x:8080/signup.php? Usually http is on port 80 if you haven't changed it. 3306 is a mysql server's default port number so it should not work for http. | |
Re: You can use ajax for that (if it is worth the trouble). See [jquery ajax](http://api.jquery.com/jQuery.ajax/). | |
Re: In your foreach loop I would put applicants' data in an array and add a rank which is just a difference between an applicant's age and advertised required age (assuming that x years older and x years younger candidates rank equally). Then the array should be sorted. // this will … | |
Re: To add my 2 cents: I have been using Linux desktop at work and at home for about 4 years now. At work we switched to Fedora desktop and server after not receiving usable support from Microsoft for Windows SBS when we had problems (support was paid for). We had … | |
Re: First try to turn error_reporting to E_ALL and display_errors to on in the php.ini. Your script probably has some errors but the errors aren't displayed (just my guess). | |
Re: Many issues here: - `database` is a mysql reserved word so it is a bad idea to use it for the table name (and is missguiding also), but if you insist, enclose it in backticks - sending two queries is not necessary if you retrieve all data with the first … | |
Re: Can you post the code for the form also? | |
Re: One solution: The form with the button should be within the while loop so each row has additional column containing the form with one button. The button's name should be the ID `($row['id'])` so you get the ID in the $_GET array upon clicking (please note that it is more … | |
Re: Check first whether $_POST values exist (they usually do not on the first page load). And also it is very important to escape the values before inserting into the database. // check if values exist if(isset($_POST[firstname]) and isset($_POST[lastname])) { $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . … |
The End.