812 Posted Topics
![]() | Re: Try if apache web server is running. Go to your web root directory and create a simple index.htm file with the following contents: <html><head>HTML test</head><body><p>Hello html world</p></body></html> Open it in your browser and check if web server is running OK. Next you can test if PHP works. Create a test.php … |
Re: If they are numeric check if they are equal: if(is_numeric($lastfour) && is_numeric($cnumber) && ($lastfour != $cnumber)) { // they are not equal } elseif(strcmp($lastfour, $cnumber) != 0) { // they are not equal } else { // they might be equal } | |
Re: To use session mechanism start each script with: session_start(); Store the link in the $_SESSION array from the while loop this way: $_SESSION['link'][] = "<a href=test.php>$pid</a>"; You can also use $pid as an index for the array: $_SESSION['link'][$pid] = "<a href=test.php>$pid</a>"; Then in the test.php page just use the array … | |
Re: According to the PHP manual the only difference between && and AND is that && is higher in precedence and gets evaluated before AND, otherwise hey do the same thing (logical comparison). This should not affect your example since you use parentheses and ! has higher precedence anyway. Can you … | |
Re: You have a problem with the browsing history not the cache (the cache just speeds up loading of pages by saving what you visited). My opinion is that it is not a good idea to change the behaviour of browser back and forward buttons since user expects clicking on them … | |
Re: You could use return statement to return true on success and false on failure. This way you can test the method when calling it from somewhere else like: $we = new Whatever; if($we->say_hello('Jack')) { // do something like log success // ... } else { // do something else like … | |
Re: > header('Location: http://www.mysite.in/index.php'); I don't think you need the second redirection (to the index.php) at all. If the visitor is from the banned country (such as 'PK') they will be redirected by first redirection. other visitors will just stay at the index.php. | |
Re: Two things come to my mind: Check if the allow_url_fopen in php.ini is set (see http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen). If you are on Windows make sure backslashes are escaped or use forward slashes (see http://php.net/manual/en/function.fopen.php). | |
Re: Syntacticaly code is OK. What error do you get? What do you want to achieve? | |
Re: You can also save the original search query (or results) into the session ($_SESSION array) and use the values in the other script. See http://www.php.net/manual/en/book.session.php | |
Re: Is there any HTML code before your php tag? No html or any other output can be sent before header() function (not even a space - check for those). | |
![]() | Re: If I understand correctly: you want to construct an SQL statement depending on a field to be sorted on and the sort direction (ASC, DESC)? If the above is true then the simplest option is to have the field to be sorted on and the sort direction in a querystring … ![]() |
Re: http://www.w3schools.com/ says on their front page: Learn to create websites. It is a good starting point. You will have to learn at least: HTML: http://www.w3schools.com/html/default.asp CSS: http://www.w3schools.com/css/default.asp In addition to that it is good to know: Server scripting, like PHP: http://www.w3schools.com/php/default.asp Client scripting, like Javascript: http://www.w3schools.com/js/default.asp Databases and SQL: http://www.w3schools.com/sql/default.asp … | |
Re: The code has errors. You are missing quotes arround strings in lines 6 and 7: echo "<td>" . '<input name="txtf1" type="text" />' . "</td>"; echo "<td>" . '<input name="txtf2" type="text" />' . "</td>"; Since you do not know whether you are getting all the fields from the database as you … | |
Re: Try to find out whether the findcity.php, which is supposed to return HTML code for a select element, works OK. I would put the following on the line 10 of the findcity.php: die($query); which will display the query instead of the select element. Now you can test the query in … | |
Re: I am not sure whether I am on the same line but number of simultaneous connections probaly depends on the web server you are using and how it is configured. If you are using Apache maybe this is the starting point: http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients Interestingly there is a Web socket protocol but … | |
Re: My advice is to use TCPDF library for converting to PDF. There are plenty of excelent examples on their website which is www.tcpdf.org. The library is open source and maintained. | |
Re: Use mysql_real_escape_string (provided that you use mySql): $safe_short_description = mysql_real_escape_string("PG for Girls/Ladies/Women in Kasmiri Rd, heart of the Agra city with fully furnished, 2/3 times homely food and all basic amenities."); $safe_long_description = mysql_real_escape_string("PG's for Girls/Ladies/Women in Kasmiri Rd, heart of the Agra city - Neat, clean & beautiful, PG's … | |
Re: I have not tried this but I think text fields should be put within text delimiters (usualy double quotes). Try changing your code this way: $csv_output .= '"$row['misRefId']"' . ", "; ... This way commas will be within double quotes as part of the text and wont be treated as … | |
Re: You have two else statements for one if statement which is syntactically incorrect: if(($_SESSION['id']) && ($_SESSION['access_level'] == 1)) { } else { } else { // this second else on line 383 is incorrect } You can use elseif(another condition) if that is what you require. | |
Hi all I would like to display several charts on a webpage. I have designed a class that would draw each chart using GD and based on data set by a public method. Unfortunately instead of charts being drawn I get an error message: The image ... cannot be displayed … | |
Re: A general answer: 1. read the record that the user is about to change 2. put each field value as a value of a html form field 3. for select html elements (drop down as you call it) put a set of option in an array, loop through that array … | |
Re: Try this query: SELECT DISTINCT date FROM product_data. ![]() | |
Re: in_array function actualy works if you pass it an array as a needle (PHP 4.2 and above) : $test_arr = array( 0 => array('StudentID' => 123456789), 1 => array('StudentID' => 001122334), 2 => array('StudentID' => 010203040), 3 => array('StudentID' => 987654321)); if(in_array(array('StudentID' => 123456789), $test_arr)) { echo 'Found'; } else … | |
Re: You will have to use the correct type of joins (LEFT JOIN, RIGHT JOIN) to retrieve records with empty values. Which type of JOIN depends on the structure of tables and where the empty values are. See this tutorial: http://www.tizag.com/mysqlTutorial/mysqlleftjoin.php ![]() | |
Re: Insert this code between lines 8 and 9 and post what is displayed: echo('<pre>' . print_r($row, 1) . '</pre>'); This will display and array of values for each row. <pre> tags are just for nicer formatting. If each row is an array of expected values then your table should print … | |
Re: You are probably missing an assignment to a variable $doc_id (put it on line 22) just before you construct $searchById, like: $doc_id = $_POST['searchID'] And if $doc_id is a number (integer) you could use = instead of LIKE in your query. | |
Re: If you have only drop down boxes (select elements in HTML terms) in your table, you can assign this function to the checkbox's onclick event: function selectAll { // read all select elements var selectArray = document.getElementsByTagname('select'); // loop thorugh the select elements array for(var oneSelect in selectArray) { // … | |
Re: I think you do not need any php nor javascript code in the html document according to the instructions. If required fields are missing, you will handle an error message in the process.php. In the process.php file first check whether the required fields are there (use isset() and empty() functions … | |
Re: Do you get any error messages? If yes post them here. Also display the query and check it in phpmyadmin (or post it here). Change your code to something like: $query = "SELECT * FROM books where Code='$code'"; // this will display the query so you can check it die($query); … | |
Re: jQuery you use also supports ajax. See http://api.jquery.com/jQuery.ajax/. That's the most I can suggest since I am not too familiar with jQuery. | |
Re: Do the classic trick: insert `die(query)` after the `$query = mysql_query("INSERT INTO grades ...` statement and inspect whether the query is OK. Test it in phpmyadmin (or post it here). | |
Re: This is because you have a return statement within a foreach loop so the loop gets executed only once. Try this way: function t6($table) { $rows = ''; foreach ($table as $key => $value) { $rows .= "<tr><td>$key</td><td>$value</td></tr>\n"; } return $rows; } | |
Re: I copied your code and the value of gender displays OK (if you chose one). Put a break after it in php file to make it more visible echo "You are: $genderRadio<br />"; If the gender still does not get displayed print the whole $_POST array and see what it … | |
Re: I suggest you echo the query to see whether it is what you are expecting. Modifiy the part where you construct the query like this: // put the query in a variable $q = "UPDATE books SET Title ='$title_save', Price ='$price_save', Stock='$stock_save' WHERE Code= '$code'"; // submit query using the … | |
Re: To keep a lang setting in a session seems OK for a session duration, to store it as a preference, put it into a database or a file. But back to your problem: do you have anywhere in your script(s) the session_start() command? It is required on every page for … | |
Re: In the included file check whether the data (and database) exist and if not add records (otherwise do nothing). Or in your primary fle check whether the data exists and if not then include the file. | |
Re: First move the beginning form tag (line 30) out of the while loop. It should be before the `<table>` tag, just after line 12. The rest is similar to your previous post. If show_others_0.php script is another page (not this one) then you will process POST data there. First check … | |
Re: This is i.e enter_name.html with a form containing a text input element and a submit button ... <form method="post" action="show_name.php"> <input type="text" name="entered_name" /> <input type="submit" name="submit" value="submit"> </form> ... This is show_name.php that receives the post data and displays it; specific file is in the action of the form, … | |
Re: Basicaly what you do you add a ceckbox to each row in the table, wrap the table in `<form></form>` tags, add hidden fields which hold the topics and add a submit button. Then you first check if the form has been submitted. If yes you process it (do the insert) … | |
Re: Maybe you shoud put the update block first, so the script check whether POST data exists and writes changes to the DB (I presume action is set to open the same script). if (isset ($_POST['update1'])) { //$row["title"] = "title"; //$row["id"] = "id"; $update = "UPDATE home SET title = '".$_POST['title']."' … | |
Re: The problem is in lines 7 and 8 of the html file. You are missing '=' sign when assigning name attributes to input elements. This is the correct code: value one: <input type="text" name="val1" size=10 /><br /> value two: <input type="text" name="val2" size=10 /><br /> | |
Re: Hopefuly you are using CSS for layout. If yes, you can use different media types and rules: @media screen for normal screen, @media handheld for smaller screens on handeld devices. See: [url]http://www.w3.org/TR/CSS2/media.html[/url] | |
Re: What is the error message (if any) that you get? Have you checked if the update query gets constructed as expected? Place the following code on line 97 in grade.php: [CODE]die($sql);[/CODE]. It will stop the script at the point where the query is constructed and echo the query. You can … | |
Re: I do not know whether this is the cause for your trouble but there are two issues: 1. you start a table row within a list item (<li>) and end it outside the list item; html tags should be nested appropriately 2. putting a table (even if properly nested) within … | |
Re: Let's start with basic questions: have you started servers (there should be an icon on the desktop i guess)? Is at least one of the index pages existing (index.htm, index.html, index.php)? | |
Re: Line 8 will never get executed, but that is not the problem anyway. The code seems OK. What actually is not working? Please describe (error messages, what is supposed to happen but it does not...). | |
Re: You can use nowdoc syntax (requires PHP 5.3): [url]http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc[/url] Please note that variables will not get parsed. You could also use a heredoc syntax but I am really not sure whether function keyword gets parsed or not. | |
Re: Hopefuly you have the URL for each bookmark in the table (bookmark_url and bookmark_text fields as an example below). [CODE]// echo table rows while($row2 = mysql_fetch_row($data)) { $bookmark_url = $row2['bookmark_url']; $bookmark_text = $row2['bookmark_text'] echo "<tr><td><a href=\"$bookmark_url\">$bookmark_text</a></td></tr>"; } [/CODE] | |
Re: It is a good idea to plan ahead as much as possible. The higher the access rights are the higher the role value. As veedeoo suggested it pays if you use values that have enough free values between them so you can always add a new role which fits between … |
The End.