492 Posted Topics
Re: First, php.net is a great place to start to learn about the functions and can be alot quicker than asking here ;) One thing i will say, is never, ever use $_POST, $_GET, $_QUERY...etc directly in SQL queries or the like (you're asking for trouble if you do), always sanitize … | |
Re: I had a quick look at your script, the first thing I noticed was that these lines: [code=php] //get parts of records $get_list = "select emp_no, concat_ws(', ', lname, fname) as display_name from employee order by lname, fname"; $get_list_res = mysql_query($get_list) or die(mysql_error()); [/code] were within the IF statement so … | |
Re: Do you have the php_mysql.dll in the correct place and have you changed the line [code] ;extension=php_mysql.dll [/code] to [code] extension=php_mysql.dll [/code] in your php.ini file? | |
Re: The suggestions einfoway made are correct, however there are other factors to take into account, for example some people do not have JavaScript enabled so the Javascript validation and AJAX will not work for this so it would not be a good idea to rely on this. It would be … | |
Re: The rewrites will be the easy part as these are just REGEX in your .htaccess file. The rest of the work would be a huge task, all your links on all pages would need to be updated to the new format. Take a look at [url]http://www.workingwith.me.uk/articles/scripting/mod_rewrite[/url] for rewrite descriptions and … | |
Re: Try to use some standard in your coding, rather than some caps and some lower case, for example SQL commands in caps and value in lower case, makes it easier to read You would do well to add an error handle to the end of the SQL query to see … | |
Re: You would be looking at AJAX(JavaScript) to don this without the page reloading and a database to store the image locations in and populate the lists in order to do this. | |
Re: This will require some server-side scripting to achieve what you are looking for, PHP is a popular choice for similar solutions. Check what your webserver can support and search the internet, there are many packages available which fit what you describe. | |
Re: Please use the code tags to put code on here. From the information you provided it would not be possible to tell you what the issue is: 1. You have not said what is and what is not working 2. In the code you have posted you are using objects/variables … | |
Re: If you want to do this without reloading the page, you will need to look into JavaScript (specifically, AJAX if this is connected to a database) If you are happy to reload the page, you would need to employ some kind of session or cookies to keep track of rows … | |
Re: Make sure you put your code in code tags. [code=php] if (($_SERVER['REQUEST_METHOD'] == "POST") || ($_SERVER['Submit7'] == "Next")) { $eventdate = $_POST['eventdate']; $stime = $_POST['stime']; $location = $_POST['locate']; $mdescription = $_POST['description']; header('location:next.php'); exit(); }[/code] Would it not be better to replace the IF statement with [code=php] if (isset($_POST['Submit7'])) { [/code] … | |
Re: A quick web search will bring up the answer you are looking for, the option is called [icode]Indexes[/icode] in the Options within the htaccess file add [icode]Options -Indexes[/icode] (if you already have some Options listed, add the -Indexes to the end. Further reading: [url]http://www.clockwatchers.com/htaccess_dir.html[/url] | |
Re: Are you storing this in the database as a timestamp, date, or string? One way to convert it is when you fetch the date from the table convert it to the correct format: [code=php] $split_date=explode("/", $date_var); $date=$split_date[2] . "/" . $split_date[1] . "/" . $split_date[0]; [/code] Depending on which format … | |
Re: I would suggest doing something like the following: Create a new page (such as process.php) and put the following code into it: [code=php] <? session_start(); //Store the POST and GET data into the session $_SESSION['post_data'] = $_POST['test']; $_SESSION['get_data'] = $_GET['test']; //Redirect to the correct page header("Location: index.php?test=hi"); ?>[/code] This will … | |
Re: If I am understanding you correctly, the following should work: In the script containing the <head> add something like this inside the <head></head> tags: [code=php] <? $currentFile = $_SERVER["SCRIPT_NAME"]; $parts = Explode('/', $currentFile); $currentFile = $parts[count($parts) - 1]; if($currentFile == 'admin.php') { //put JS code here } ?> [/code] This … | |
Re: Personally I would not use the second example-saving images into the Database, there is no need. The filesystem was designed to do this job so why re-invent the wheel? I have yet to come across a scenario where storing images in the database is better than the filesystem. | |
Re: One way to do this would be to include an if statement and a counter for example, [code=php] $counter=0 while(sql_statement) { $id=$row['id']; $date=$row['date']; $sentby=$row['sender']; $comment=$row[comment]; if($counter==4) { echo "<br />"; // reset the counter $counter = 0; } echo"sent by: $sentby Comment:$comment date sent:$date"; $counter++; } [/code] | |
Re: This is fairly simple, use the RAND function in the SQL query: [code=php] $sql = "SELECT * FROM tablename WHERE somefield='something' ORDER BY RAND() LIMIT 10"; [/code] | |
Re: Simply use the HTML a tag to make it a hyperlink [code=php]<a title="link_title" href="link_here"><? echo $rows['topic'];?></a>[/code] In the database you also need to have the unique identifier for the row and make the link something like mypage.php?topicid=ID where ID is the identifier. | |
Re: There is no way to hide HTML or JavaScript code from the user, these are client-side scripts and will need to be processed by the client browser, as such the code will need to be sent and can be viewed. The PHP code cannot alter this since it is a … | |
Re: As far as I am aware this can only be done with the ID3 library (unless you name the MP3's in a standard format such as Artist-Genre-Song.mp3) If ID3 already exists and is the standard why would you want to make your own methods? I know you said without ID3 … | |
Re: I would have thought this goes in the HTML/CSS forum [url=http://www.daniweb.com/forums/forum143.html]here[/url] Although I would suggest running the page through a validator ([url]http://validator.w3.org/[/url]) first since there are multiple problems on all pages. | |
Re: Have you cheked where the server is looking for the font and that the ttf file is in the correct directory on the server? | |
Re: [QUOTE=pzuurveen;696597] [B]at the start of search-exec.php[/B][/QUOTE] Follow that ^ | |
Re: 1. Lookup the update statement on the internet, the syntax for it is not correct, you can't simply replace INSERT with UPDATE, you need to completely re-write it, basics below: [code=php]mysql_query("UPDATE table_name SET row_name = value, rowname = value WHERE row_name = 'value'"); [/code] 2. Are there any unescaped quotes … | |
I have upgraded to Firefox 2.0.0.14 on openSuse 10.3 and then downloaded Java 6u6 and installed that, created a symbolic link to java plugin for firefox but whenever I try to load a Java applet it will not show anything, not even the jigsaw piece saying Java is not installed. … | |
![]() | Re: In the httpd.conf file you should have a line similar to [icode] DirectoryIndex index.html[/icode] Change this to [icode] DirectoryIndex index.php[/icode] ![]() |
Re: The best way to do this would probably be an array: [code] $abc=array("value1","value2"); for($i = 0; $i < 2; $i++) { echo $abc[$i]; } [/code] | |
Re: If you mean the popup window that appears in your browser asking for a username and password, this relies on the htaccess and htpasswd files, was it this you are looking for or another type of login box? | |
Re: add this before the while(): [CODE] if(mysql_num_rows($result)<1) { echo 'No Results'; } else { // while statement here } [/CODE] This will determine if the query is returning a result | |
Re: Before the form you will need to generate the random number, also you have specified no value for the hidden field, change method= to value=. To generate the random number do something like this: [code] <? // mt_rand(min value, max value) $rand = mt_rand(); ?> [/code] | |
Re: We need a little more information on what you want to do; Do you have passwords in a database, htpasswd file, or other means? Do you have any code at the moment and what does it do? are the passwords encrypted or plain text? | |
Re: If you make a single page (for example index.php) and include the language file depending on which language is wanted, this is a perfectly acceptable use of the define() function. as it will standardize the scripts. | |
Re: Using just PHP and JavaScript, you would be limited on what you can do, your pages would be unformatted, lines of text. HTML is essentially a prerequisite to PHP and Javascript. PHP is a server-side language and will send plain text to the user and JavaScript, although a client-side scripting … | |
Re: The only way to do this would be to have the header() at the top, before any output on the page. What exactly are you trying to do? | |
Re: comment the $set and $row_set lines and add this: echo($setSQL); and post the result here. | |
Re: You can pass data between pages either using sessions or cookies, In the database you would need to have another column along with the username and password for the user level or status. The simplest way to have user level restrictions would be to have tiers, for example, photographers are … | |
Re: If you type this into a text editor with a line break and then copy/paste it into the database, this will also be moved into the SQL field and PHP will echo a new line as well as the code. Another thing, when getting HTML from the db, you will … | |
Re: There are alot of artices on this subject from a quick google search for' javascript popup reload parent' (remember, Google is a friend) What you need to do is on the popup have a function to close the window and reload the parent ( window.opener.location.reload(true); ) at the same time. … | |
Re: The header function must be used before any output is printed, i.e before the opening HTML tag, make sure there is no HTML code or echo/print functions before the header one. | |
Re: It is the mysql_free_result function you would use, example below: [CODE] $connect = mysql_connect("server", "username", "password"); if (!$connect) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbName",$connect); $sqlQuery = "SELECT * from table"; $result = mysql_query($sqlQuery,$connect); // Do something with the result // Free result mysql_free_result($result); [/CODE] What error (if … | |
Re: Using the back button to go to a page form data was submitted to will cause this, to solve it, once the login script has been run either use a header redirect or a meta redirect to clear the POST data. |
The End.