627 Posted Topics
Re: assuming [iCODE][0-9a-zA-Z_-][/iCODE] represents the set of allowed characters, and that $url contains the hyperlink you want to "clean", then try: [CODE]$url = preg_replace('#[^0-9a-zA-Z_-]#','',$url);[/CODE] | |
Re: [QUOTE]I'm suppose to select any row from my database...[/QUOTE] Where are you specifying which row/record to delete? I don't see you supplying an input field to supply the initial MatricNo to search for. For it to delete, first it needs to search, and for it to enter the "search" if … | |
Re: On lines 232 AND 236 you have: [iCODE]<a href="<?php $_SERVER['PHP_SELF']?>index.php...[/iCODE] change them to: [iCODE]<a href="<?php [COLOR="Red"][B]echo [/B][/COLOR]$_SERVER['PHP_SELF'][COLOR="Red"][B];[/B][/COLOR]?>index.php...[/iCODE] | |
Re: [QUOTE]but the previous, next and the page number links are not there at all[/QUOTE] Have you verified that your query actually returns MORE than 10 records? For purposes of testing, change: [iCODE]$display=10; //setting the number of records to display per page[/iCODE] to: [iCODE]$display=5; //setting the number of records to display … | |
Re: [iCODE]elseif[/iCODE] should be [CODE]else if[/CODE] (you need a space in between). Also, in your HTML, your [iCODE]<OPTION>[/iCODE] tags need to have those values as well and don't forget that js is case sensitive: [CODE] <option value="institutional memberhip">Institutional Memberhip</option> <option value="individual membership">Individual Membership</option> [/CODE] | |
Re: on the last value you are inserting you have: [iCODE][COLOR="Red"]'[/COLOR]null[COLOR="Red"]'[/COLOR][/iCODE] Get rid of those apostrophes. It should be just NULL. Also, I suggest you list the fields you are inserting the data into: [iCODE]$query1="INSERT INTO `class`(`field1`,`field2`,`field3`,`field4`) VALUES(NULL,'$a','$grade', NULL)";[/iCODE] Replace the field# with the actual names of the fields in your … | |
Re: change: [iCODE]GetSQLValueString $_POST['software[]'], "text")[/iCODE] to: [iCODE]GetSQLValueString( implode(',', $_POST['software']), "text")[/iCODE] | |
Re: if you want to use just files, from what you posted earlier, try using this as your topics.php (just add more topics to the [iCODE]$topics[/iCODE] array) [CODE] <?php //FYI: the 234 and the 745 are meant to be "random". In other words, you can assign whatever numbers you want. $topics=array( … | |
Re: try: [CODE] <?php $filename = "http://www.empowergroupusa.com/cambiolabs/extension/catalog/files/inspection_886.pdf"; if (file_exists($filename)) { echo '<a href="http://www.empowergroupusa.com/cambiolabs/extension/catalog/files/inspection_886.pdf">PDF</a>'; } else { echo "The file $filename does not exist"; } ?> [/CODE] | |
Re: change: $result = [iCODE][COLOR="Red"]"[/COLOR]mysql_query($query)[COLOR="Red"]"[/COLOR];[/iCODE] to: $result = mysql_query($query) or die( mysql_error() ); | |
Re: should be [iCODE]created < DATE_SUB(NOW(), INTERVAL 30 DAY)[/iCODE] ( no '<=', simply use'<' ) as for the deletion, the function is named unlink() [URL="http://us3.php.net/manual/en/function.unlink.php"]http://us3.php.net/manual/en/function.unlink.php[/URL] | |
Re: assuming you are NOT saving the value in [iCODE] $_SESSION['jobProfile'][/iCODE] to the DB (just using if to display on browser), then instead of: [iCODE]$_SESSION['jobProfile'] = $jobDesc;[/iCODE] try: [iCODE]$_SESSION['jobProfile'] = nl2br($trimmed['txtJobProfile']);[/iCODE] | |
Re: [QUOTE] <option><?php if([COLOR="Red"]$day == 32[/COLOR]){$day = 1; echo $day;}else{ echo $day;} ?></option> <!--problem--> [/QUOTE] Where did you initialize [iCODE]$day[/iCODE]? BEFORE the if clause you should have: [CODE]$day = isset($_POST['daysOfMonth']) && !empty($_POST['daysOfMonth']) ? $_POST['daysOfMonth'] : 1;[/CODE] | |
Re: which part are you having trouble with? I suggest you post what you have thus far and provide more details regarding your problem. | |
Re: > The trouble I am having is that the variable $i in the for loop is only recognized as 0 inside of the while, but it shows as the number it is supposed to outside the while. On the first iteration (when `$i` equals zero) BEFORE the `while()` you have … | |
Re: [QUOTE]however, when I use a refresh on my div it does refresh but does not change the image...[/QUOTE] That's because that auto_refresh is NOT making an ajax call to the server. You should INITIALLY have an empty DIV: [iCODE]<div id="update"></div>[/iCODE] Then when you make your ajax call, upon completion you … | |
Re: In your ORIGINAL code, instead of [icODE]document.quiz[/iCODE], try using [iCODE]document.[color="Green"][B]forms.[/B][/color]quiz[/iCODE] (since you have [iCODE]<form id="quiz"...>[/iCODE]) | |
Re: at the end of your first regex you have: [iCODE]...(\#[-a-z![COLOR="Red"]//[/COLOR]\d_]*)?$/i[/iCODE] Try escaping those slashes: [iCODE]...(\#[-a-z![COLOR="Red"]\/\/[/COLOR]\d_]*)?$/i[/iCODE] ALSO, instead of: $valid_url=[color="Red"]"[/color]...[color="Red"]"[/color]; try using apostrophes: $valid_url=[color="Red"]'[/color]...[color="Red"]'[/color]; | |
![]() | Re: tab is already an array. If you want to see everything as a single string then you need implode() not explode() |
Re: It's because your SELECT query failed. Instead of: [iCODE]$sql_query = mysql_query("SELECT * FROM blog WHERE MATCH(title,post) AGAINST('$search_term')");[/iCODE] try using the following you you can find out WHY the error ocurred: [iCODE] $sql_query = mysql_query("SELECT * FROM blog WHERE MATCH(title,post) AGAINST('$search_term')")[COLOR="Green"][B] or die(mysql_error())[/B][/COLOR] ;[/iCODE] | |
Re: You need to put quote around strings - words that are NOT PHP keywords - ex: [iCODE]$remark=[COLOR="Green"]"[/COLOR]Excellent[COLOR="Green"]"[/COLOR]; [/iCODE] because [B]Excellent[/B] is NOT a php keyword. The same goes for the other remarks. also, totalg IS a variable, so you MUST prefix it with a dollar sign in every instance of … | |
Re: after this is executed: [CODE]$r = mysql_query("select userid from dept_user where dept_id=$dept LIMIT 0, 30 ");[/CODE] $r does NOT have the userid. It "points" to "something" (a resource) which contains the actual data from the result set (assuming some result was actually returned). What you need to do is EXTRACT … | |
Re: If your page contains a frame, and THAT frame contains and EXTERNAL/REMOTE page that contains the javascript that is "listening" for the "H" keypress, then you will NOT be able to rebind the event. In other words, what you are trying to do is not possible. The security restrictions imposed … | |
Re: try: [CODE] <?php if ( isset($_POST['seo']) && $_POST['seo'] == 'Save' ) { foreach($_POST['title'] as $index=>$value) { $title = mysql_real_escape_string(trim($_POST['title'][$index])); $description = mysql_real_escape_string(trim($_POST['description'][$index])); $keywords = mysql_real_escape_string(trim($_POST['keywords'][$index])); $res = mysql_query("UPDATE `content_en` SET `title`='$title',`description`='$description',`keywords`='$keywords' WHERE `id`=1"); if (!$res) die("Error saving the record! Mysql said: ".mysql_error()); header("Location: home.php"); exit; } } $query = mysql_query("SELECT … | |
Re: [iCODE]...SET Fname='$a' [COLOR="Red"]AND[/COLOR] Lname='$b'[/iCODE] you need to get rid of AND. To update multiple fields, you need to separate them with a comma, NOT with the keyword [COLOR="Red"]AND[/COLOR]. Try the following: [CODE=php] <?php if( isset($_POST) && !empty($_POST) ) { mysql_connect("localhost","*****","****") or die('Could not connect:<br />' . mysql_error()); mysql_select_db("*****", $con) or … | |
Re: when you use [iCODE]var[/iCODE] BEFORE your variable, it make that variable "private". In other words, it will NOT be visible outside your function. Thus, the variable [iCODE]allSelect[/iCODE] in line 4 is NOT the same as the one in line 8. The [iCODE]allSelect[/iCODE] variable declared in line 8 exists ONLY WITHIN … | |
Re: [QUOTE]My question is whether there is any possibility for an user to override my validation and get away with an invalid entry ?[/QUOTE] No. The expression allows exactly 10 characters, of which the first MUST be a zero and the remaining nine may be any of 1...9. | |
Re: On lines 37-64, you cannot have [iCODE]$DetailsRow[/iCODE] because you have NOT queried the db. It looks like what you need is the data that was just [B]POST[/B]ed. So change [iCODE]$DetailsRow[/iCODE] to [iCODE]$_POST[/iCODE] | |
Re: [QUOTE] ...the down side is that I have to browse to each and every picture to select it.[/QUOTE] if you rephrase that sentence to "the down side is that I have to manually select each and every picture..." then clearly you are looking for a way to select the pictures … | |
Re: [iCODE]...var req = new Request.JSON[/iCODE] where did you define the Request object? It looks like you forgot to "include/import/ling to" a javascript file! | |
Re: [QUOTE]Works fine but I cant upload more than 3MB files using this script[/QUOTE] refer to the following: [url]http://us2.php.net/manual/en/features.file-upload.post-method.php[/url] specifically, [QUOTE]...The MAX_FILE_SIZE hidden field (measured in bytes) must precede the file input field, and its value is the maximum filesize accepted by PHP...[/QUOTE] alternatively, if you have access to your php.ini … | |
Re: [iCODE]...echo '<a href="deleted.php?id='.[COLOR="Red"]$row['id'][/COLOR].'">Delete</a>';[/iCODE] where did [COLOR="red"]$row['id'][/COLOR] come from? a. An INSERT query does NOT return any records - NOT even the auto id of the new record. b. Even [B]IF[/B] it returned records, you would still need to retrieve the actual columns with statement such as: [CODE]<?php $row=mysql_fetch_assoc($results); ?> [/CODE] … | |
Re: Try: [CODE]SELECT Country, COUNT(*) as total FROM TABLENAME GROUP BY Country[/CODE] | |
Re: instead of: [CODE]for (item in content) [/CODE] try: [CODE] for (var item=0,limit=content.length; item < limit; ++item) [/CODE] | |
Re: The name of a database, table and/or field/column, needs to be enclosed in backticks (`), NOT apostrophes('). You incorrectly used apostrophes. Try: $select_query="SELECT * FROM `deed_records` WHERE `".$_REQUEST['select']."`='".$_REQUEST['value']."' "; Also, use [iCODE][B][color=blue]... or die( mysql_error() );[/color][/B][/iCODE] whenever you execute a query so you get details about the error (if any). … | |
Re: let's say that the code you posted is for a file named getImage.php. Now on page1.php you need to show the image with id=23. All you have to do in page1.php is to put this: [CODE]<img src="http://yoursite.com/imageFetcher.php?id=23" />[/CODE] Also, since you only need the `data` field, then use [iCODE]SELECT data … | |
Re: Let's say that page1.php includes page2.php, but you want page2.php to NOT be accessed directly. So on page1.php you define the constant: [CODE] <?php //page1.php define('RESTRICTED',1); include('page2.php'); ... ?> [/CODE] Then in page 2 you simple check to see if the constant is defined: [CODE] <?php //page2.php if(!defined('RESTRICTED'))exit('No direct script … | |
Re: you need to add '~' as the third argument to fgetcsv(): [CODE]<?php $namefile = 'pilots.txt'; $OUTFILE = fopen($namefile, 'r') or die("Can't open $namefile for read"); $name = fgets($OUTFILE,4096); if($OUTFILE) { while (!feof($OUTFILE)) { $row=fgetcsv($OUTFILE,1024,'~'); echo sprintf('%s %s', $row[0], $row[4]); } fclose ($OUTFILE); } ?>[/CODE] | |
Re: [QUOTE] only to find the CSS "hover" is NOT available in IE8. I've found the hover to be very useful in calling attention to links by changing their color.[/QUOTE] Are you sure about that? The code below works fine for me. If anything, the lack of support would be in … | |
Re: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <head> <title>Search the Database</title> <style type="text/css"> <!-- .inactive{visibility:hidden;display:none;} --> </style> <script type="text/javascript"> <!-- function toggleOptions(sel) { if(1*sel.value==2) { document.getElementById('termSearch').className='inactive'; document.getElementById('dateSearch').className=''; } else { document.getElementById('dateSearch').className='inactive'; document.getElementById('termSearch').className=''; } } //--> </script> </head> <body> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Search: … | |
Re: it's called [B]autocomplete[/B]: [iCODE]<input type="text" [COLOR="Green"]autocomplete="off"[/COLOR] .../>[/iCODE] [url]http://www.htmlcodetutorial.com/forms/_INPUT_AUTOCOMPLETE.html[/url] | |
![]() | Re: perhaps the parent element of the table has the relevant setting - ex: [CODE] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <style type="text/css"> <!-- #envelope{border-bottom:1px dotted black;} --> </style> </head> <body> <div id="envelope"> <table summary=""> <tr> <td>x</td> </tr> </table> </div> </body> </html> [/CODE] |
Re: [QUOTE]Is anything wrong in that syntax?[/QUOTE] That depends on your php configuration file. When short_open_tag is On, then [CODE=php] <? ... ?> [/CODE] is NOT a problem, but if it is Off, then you would get runtime errors. Simply add [COLOR="Green"]php[/COLOR] to the opening tag: [CODE=php] <?php ... ?> [/CODE] | |
Re: your submit button has name="submit", so you should be using that in $_POST, NOT 'Calculate'. You must use the NAME of the field: WRONG: [CODE] $calculate=$_POST['Calculate']; if (isset($_POST['Calculate'])) [/CODE] CORRECT: [CODE] /* after this, $calculate should be set whatever the VALUE attribute is set to. In this case Calculate */ … | |
Re: try using [iCODE]urlencode()[/iCODE], NOT [iCODE]htmlentities()[/iCODE]. | |
Re: If your editor supports different fonts, then change your font-family to Verdana. Otherwise copy and paste your code onto a text editor (like MS Word); highlight it all then change the font-family to Verdana. Do you see the now that p1 (p followed by number one) is NOT the same … | |
Re: [QUOTE]...for some reason it is not reflected in the url[/QUOTE] ajax requests do NOT change the url that is currently loaded/displayed in the address bar. The requests occurs "in the background". Hence the url in address bar remains unchanged. IF it did so, then the whole page/window would reload, which … | |
Re: put a % symbol BEFORE and AFTER the variable name: [CODE]"SELECT * FROM members WHERE name LIKE '%$searchKey%';"[/CODE] | |
Re: Assuming you are using PHP to process your form, when you create your form give all your checkboxes the same name BUT add the following suffix "[]" -ex: [CODE=html] <form method="post" ...> <input type="checkbox" name="hobbies[]" value="Reading"/> <input type="checkbox" name="hobbies[]" value="Biking"/> <input type="checkbox" name="hobbies[]" value="Traveling"/> ... </form> [/CODE] Then when you … | |
Re: [CODE] <HEAD> <script type="text/javascript"> function toggleElement(sel1, element1) { element1 = document.frm1.elements[element1]; //alert(element1.value); if (sel1.value == 'others') { element1.style.display = 'inline'; } else { element1.value = ''; // input text will be empty element1.style.display = 'none'; // hide text element } return; } window.onload=function(){ toggleElement(document.getElementById('city'), 'txt1') } </script> </HEAD> <BODY> <form … |
The End.