812 Posted Topics
Re: Sory for jumping in, I just have too much time right now :-). You can not use a function within double quoted string (you can use variables though). Do a concatenation: $sql = "INSERT INTO `db` (profile image) VALUES " . mysql_real_escape_string($grav_url) . " WHERE id='{$_SESSION['sessid']}'"; This should work provided … | |
Re: In the php file first check whether the form was submitted: <?php // assumming you use method=post if(isset($_POST['submit'])) { // do the insert // display thankyou message // end the script die(); } // if the form was not submitted, display it // ... ?> <form action="#" method="post"> ... | |
Re: mysql_fetch_array returns a row of the table in a form of an array. You actually are processing row by row already in the code: while($row = mysql_fetch_array($result)) Within the above while loop you can do anything with the row or the fields of the row. Can you please explain more … | |
![]() | Re: I use PEAR now and then. Mostly I use MDB2 package for abstraction of access to a database which I thimk is a pretty good collection of code and (hopefully) enable you to switch to another supported database without much changes to your code. Another package I use is Pager … ![]() |
Re: Just my guess since I am not using Ubuntu but Fedora. I think scripts and web pages should be in a directory that is defined in a webserver configuration (in Fedora and some other distros the config file is /etc/httpd/conf/httpd.conf and the web pages are in /var/www/html). The directories and … | |
Re: When you click Register button it will bring you to login.php page which I assume is the code from your second post. Does that answer your question? | |
Re: The $time might be undefined if the user does not chose any value. Make a default value (or set the selected attribute) or warn the user that the time has not been selected. if(isset($_POST['hour']) and $_POST['hour'] > 0 and $_POST['hour'] <= 24) { $time = $_POST['hour']; } else { // … | |
![]() | Re: Many developers (including myself) use Eclipse (http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliossr2). Maybe a bit complicted to install and configure but powerful. Quite many also use Netbeans (http://netbeans.org/). I use it now and then at home and find it very good also. Many text editors also provide syntax checking like Notepad++, KWrite, gedit (both Linux) … ![]() |
Re: Change line 13 to: echo "$pt, "; mysql_fetch_assoc returns an array (with only one element in above case) and implode returns a string (P1, P2, P3 etc on each iterration). | |
Re: Most common approach is to store the data from each submitted form in a database table and then create an excel file upon a request (e.g. the administrator can download the excel file by clicking a link). I hope you have database connection already set and script made to save … | |
Re: The names in the $_POST array have to be the same as the name attributes of form fileds i.e.: <input name="email" type="text" size="30" /> <?php $email = $_POST['email'];?> It is much easier if the name attribtes and the variables are the same. | |
Re: The following is my suggestion (maybe not perfect but works): // first check if the form was submitted if(isset($_POST['submit'])) { // initialize the array that will hold potential error messages $errors = array(); // initialize variables (for filling-in fields in case of errors) $name = $_POST['name']; $email = $_POST['email']; $phone … | |
Re: Multiple ANDs are legitimate and should work OK. However usually tables are joined on some matching fields so your query should also contain ON keyword. Do you get any errors running the query in phpmyadmin? | |
Re: Maybe have look at this: http://www.killerphp.com/tutorials/object-oriented-php/. Haven't checked it myself but looks like a simple introduction. | |
Re: And be aware of the difference between `||` and `or` (and also `&&` and `and` ) since they are essentially the same but do get evaluated in different order. See also the following thread: http://www.daniweb.com/web-development/php/threads/424547/-vs-and#post1814451 | |
Re: Are the two tables somehow related? If yes you can JOIN them and search for both terms. Without knowing the structure of the tables it is hard to tell more. ![]() | |
Re: I get the text displayed as H1 (Firefox 12 on Fedora 16). Maybe you should have a look at the HTML code that your browser displays and see if there are any errors elsewhere (right click on page and select View page source in Firefox). | |
Re: This is the principle: for($row=1;$row<=20; $row++){ echo "<tr>\n"; for($col=1;$col<=20; $col++) { $x=rand($min,$max); $random_array[$row][$col] = $x; if($x % 2 == 0) { $char = '*'; } else { $char = '%'; } echo"<td>$char</td>\n"; // add value to the $temp_array $temp_array[] = $x; } echo "</tr>"; } | |
Re: In the above code the variables $table and $y are undefined. What is the purpose of those? Also you should not put the `</table>` tag within the foreach loop (see line 23). I am still looking at your code so more follows. | |
Re: The following code should roughly do it: // add the first div echo '<div id="shelf" class="Magenta_div">'; // initialize the counter for the current table row $current_row = 1; while($row = mysqli_fetch_row($res)) { // echo the image data from the db table row echo "..."; // check if the current row … | |
Re: Also where do you get the $_GET['id'] from? Maybe you should test for it whether it contains a valid value like this: if(isset($_GET['id']) and is_numeric($_GET['id'])) { $id = (int)$_GET['id']; } else { die('Error, no ID passed over.'); } | |
Re: Put the following on the line 8: die($query); and post what you get. It might be that the $subject_id is empty or not set. | |
Re: Store login information in session and always check it. After logout, unset it. | |
![]() | Re: Which linux distro do you have? In Fedora (16) phpmyadmin is in the updates repository. |
Re: Add a variable that counts record and check in the loop whether is odd or even. If it is odd then you start the row and the cell, if it is even end the cell and the row of the table. function getBookSeller () { $con = mysql_connect(server , userName … | |
Re: You are missing value attributes for each radio button. The chosen value (only one) will get carried over to the abc.php page through $_POST global array. Note that you are also missing a submit button to submit the form. On abc.php start with checking if $_POST['agree'] is set which means … | |
Re: I use TCPDF for stufflike this. The following is adaption of example from tcpdf.org. Download the library, link to it and check it out. It is not perfect, you can fine tune it. <?php // some test data; you will read it from the database $TEST_LABEL_DATA = array( array( 'title' … | |
Re: Here are some hints: - when coding a form use name attributes that match column names - decide whether use post or get method (post is slightly more secure, get can be easily bookmarked or saved) - in any case clean the input before using it in a query (use … | |
Re: The following links might help: http://www.php.net/manual/en/book.ibase.php http://www.php.net/manual/en/function.ibase-connect.php | |
Re: Is the problem that the browser can not open the files with the above extensions? If that is the case you probably do not have the appropriate program to open the files (up to date MS Office version, viewer apps or LibreOffice) or browser component. What is actually the error … | |
Re: First, do not think of yourself so negatively, mate. No-one is perfect and we all have our weaknesses as far as programming (and everything else) goes. Your question is a bit unclear. What is the code that works and what is the code that does not work? Your queries above … | |
Re: You do not read any variables for values from the form on previous page in the update_ac.php. You should assign the values from the $_POST array. This should go on top of the pdate_ac.php: // check if the form was submitted if(isset($_POST['Submit'])) { // get the ID (cast it to … | |
Re: I think you should echo the $row['image_id'] value like: <a href='deleteimage.php?imgid=<?php echo $row['image_id'];?>'>Delete</a> | |
Re: Apparently you already have three thumbnails generated for each video and you can just link to them. See http://www.reelseo.com/youtube-thumbnail-image/ | |
Re: Openoffice has been in the Apache incubator for long time now. The availability of languages is very poor which to me indicates the state of the package. Most Linux distributions switched to libreoffice soon after oracle got rid of openoffice. Also many developers switched to OSF. I am not sure … | |
Re: This is just an idea (not tested) of how would I do it (I am actually using a PEAR Pager package which is excellent for this task): If your current page is $current then your first key is (floor($current/10)*10) +1 and the last key is first key + 9 (hopefuly … | |
Re: I'm not using xamp but as far as I know xamp includes phpmyadmin which you can use to export / import databases or tables. In phpmyadmin go to home icon (on the far top left) select the database to export and from the top menu in the right pane select … | |
Re: Change the name attribute to an array <input type="checkbox" name="Project[]" value="... /> and all the checked checkboxes should be in `$_POST['Project']` which will be an array, too. // e.g. you can get a list of project (a string) by imploding the array $Project = implode(', ', $_POST ['Project']); | |
Re: // assuming you use method=post in your form if(isset($_POST['SelectMake'])) { $make = mysql_real_escape_string($_POST['SelectMake']); $query = "SELECT * FROM cars WHERE make=$make"; ... } | |
Re: Is it that the FTP server is running on RedHat Linux? Have you tried connecting with an ordinary FTP client to test whether user exists and the password is set OK? Do you get a warning form PHP (frp_login should issue a warning if returns false). | |
Re: This is because mysql_query() function returns an ID for a resource, not a result. To get the result use mysql_fetch_assoc() or mysql_fetch_row(): $res = mysql_query($sql); $row = mysql_fetch_assoc($res); $PINDEX=$row['PREF']; | |
Re: There are a couple of ways of implementing this. The usual way (from my point of view) is: On the beginning you check for existence of `$_POST['submit']`, which signals that the form was submitted. Then you check if image description exists and is valid. You sanitize/escape it and send it … | |
Re: Since this function returns false in case of error you can use it this way: $post = mysql_real_escape_string($_POST['post']) or die('ERROR: ' . mysql_error()); If there is an error you will get some description about it. But as MarPlo stated above the link to the database has to be established first, … | |
Re: Which input does not print (identify it by name attribute)? The first input is the type of "hidden" and won't print which is what is expected. Other input fields show up normaly. | |
Re: Put the php block that generates required data at the top or before the form div (this won't change the appearenca of the page). | |
Re: The following is a simple example of how to build a SELECT query based on the values typed in a search form. Please note security stuff has ben omitted for clarity. Do not forget to apply security checks. See comments in the code. // check if the form was submitted … | |
Re: Are your include files OK? Are they wrapped nicely with the `<?php ?>` tags. | |
Re: The `/**` on the end is probbably the missing one from the beginning. Just move it from the last row to the first row and insert a newline immediately after it. `/**` is a beginning of a comment that can be used for documentation purposes. See http://www.phpdoc.de/ or http://phpdoc.org/ | |
Re: And before inserting them, check the values and/or escape them. $firstname = trim(mysql_real_escape_string($_POST['firstname'])); ... |
The End.