627 Posted Topics
Re: [CODE] $str = "I will go to the store with <# one/two/three #> people<# four/five/six #>."; if( preg_match_all( '![<]#([^#]+)#[>]!',$str,$matches) ) { $id=0; $prefix='place_'; foreach($matches[1] as $group=>$str) { $parts=explode('/',$str); foreach($parts as $v) { ++$id; $v=trim($v); echo PHP_EOL.'<input type="radio" id="'.$prefix.$id.'" name="'.$prefix.$group.'" value="'.$v.'" /><label for="'.$prefix.$id.'">'.ucfirst($v)."</label>"; } } } [/CODE] | |
Re: [url]http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc[/url] [CODE] echo <<<EOS Your garbled string goes here EOS; //IMPORTANT: The line above ends with a semicolon followed by newline.These are required [/CODE] | |
Re: try adding or die() to get more details about the error: [CODE] <?php $mysql_id = mysql_connect('mysql3.000webhost.com', 'a2778852_556875', 'pendolino390') or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) ); mysql_select_db('a2778852_555676', $mysql_id) or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) ); $result = mysql_query("SELECT `personalexperience`, `sex`, `age`, `sexuality` FROM `Personal_experience`") or die( sprintf('Line %d: %s',__LINE__, … | |
Re: try: [iCODE]$getid = preg_match('/\b' . $id . '\b/', $string);[/iCODE] Or if you prefer to use the double quotes (like you posted), be sure to escape the backslash: [iCODE]$getid = preg_match("/\\b$id\\b/", $string);[/iCODE] | |
Re: Your problem is because you are using $count to "control" both loops. Do NOT use [B]$count[/B] for BOTH loops. Use different variables. Try something like $outerCount and $innerCount instead. Also, they should start at zero (not one) and be "less than" (not "less than or equal to") - ex: [iCODE]for($outerCount … | |
Re: If you think in terms of change: "house" to "student" "votes" to "quizzes" "rate" to "grade" then it should be clear that the average you are computing is correct. You are confused due to the results/rating you are seeing. This is because you really can't quantify beauty. What I may … | |
![]() | Re: assuming that id is an AUTO_NUMBER and title & content are of text data type, try: [CODE]$sql = "INSERT INTO updates (id, title, date_posted, content) VALUES ( NULL, '".$title."', Now(), '".$content."'";[/CODE] ![]() |
Re: modify/update process.php so that it returns/prints/echoes: "OK" when tag is inserted "!OK" when tag already exists [CODE] <script type="text/javascript"> $('#i1').hide(); // this is my div that says tag inserted! $('#i2').hide(); // this is my div that says tag already exists $("#keyword").click(function() { $('#i1').hide(); // this is my div that says … | |
Re: process.php [CODE] <?php //here you need to connect to the db first //... $tagname = mysql_real_escape_string($_POST['tag']); $sqll = "SELECT COUNT(tag_name) as total FROM Tags WHERE tag_name = '$tagname'"; $result = mysql_query($sqll) or die(mysql_error()); $status = mysql_fetch_assoc($result); if($status['total'] > 0) { echo 'OK'; } else { echo '!OK'; } exit; ?> … | |
Re: [QUOTE]do i need to include the file that has the class in my new file?[/QUOTE] Yes, of course. Otherwise file 2 won't know what [iCODE]new foo()[/iCODE] means. You have to provide the implementation of foo. [QUOTE]with an include statement?[/QUOTE] You can use either include OR require. I prefer to use … | |
Re: [iCODE] <?php if(isset($_POST['post'])) { $title = $_POST['title']; $post = $_POST['post']; $time = date([COLOR="Red"]"d-m-y"[/COLOR]); mysql_connect('localhost','awah_awah','awah') or die("cant connect to the server"[COLOR="red"].mysql_error()[/COLOR] ); mysql_select_db("awah_admin") or die("can't select hte database " [COLOR="red"].mysql_error()[/color] ); $sql = mysql_query("INSERT INTO blog ('title','post','datetime') VALUES ('$title','$post','$time')"); if(!$sql) { echo "error: can't insert the values --> ".mysql_error(); } else … | |
Re: [QUOTE]Now my problem is the misplacement of records on my fields. Records that suppose to be in the Region field now displays at the Name field. Records that should be on the Zipcode field now at the Age field. Records that should be on CPnumber field now displays at the … | |
Re: In case you are wondering, the problem in your ORIGINAL code is in line 16. You check for equality with TWO consecutive equal signs: [iCODE]if( $existingTags [COLOR="Green"][B]==[/B][/COLOR] $tagname )[/iCODE] | |
Re: If all you have in your HTML is [iCODE]<p>[/iCODE] then your css should NOT have that leading period in front of the "p". If your markup is [iCODE]<p class="p">[/iCODE] THEN it is OK to have [iCODE].p{---}[/iCODE] | |
Re: You need to convert your date STRINGS to an actual date first - Try: [CODE]/* http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date */ $startDate='12-10-2010'; $endDate='15-12-2010'; $sql= "SELECT * FROM `tblPerson` WHERE `subscriptionDate` BETWEEN STR_TO_DATE('$startDate','%d-%m-%Y') AND STR_TO_DATE('$endDate','%d-%m-%Y')"; [/CODE] | |
Re: [QUOTE]The amount is credited and the balance is updated very well. But interest should be added daily.[/QUOTE] OK, then if the queries are working fine, then your problem is NOT really about "adding interest rates to your account tables", but rather, "how to auto-execute queries on a daily basis". If … | |
Re: [QUOTE]At the top of each page, will it lose any function? [/QUOTE] No [QUOTE] I.e. will the search engines that are looking for meta tags still see them?[/QUOTE] Yes. Ultimately if you have index.php and within index.php you put [iCODE]include 'meta.php';[/iCODE] the browser will ultimately receive the HTML in meta.php … | |
Re: [QUOTE]can i use the mysql_fetch_array twice in different places in my code [/QUOTE] Yes [QUOTE]Probably the easiest solution is to build a complete unique array in the first loop, and use that[/QUOTE] My suggestion would be to reset the pointer to the query result. IMMEDIATELY BEFORE the SECOND while put … | |
Re: [CODE]foreach ($fields as &$value) { ${$value} = $myrow[$value]; }[/CODE] | |
Re: try: [CODE]SELECT * FROM table WHERE type='cool' AND (id NOT IN(2,3,5) )[/CODE] | |
Re: download simple_html_dom.php: [url]http://simplehtmldom.sourceforge.net/[/url] then try: [CODE]<?php include("simple_html_dom.php"); $html=file_get_html("http://http://finance.yahoo.com/q/ta?s=4707.KL+Basic+Tech.+Analysis&t=3m"); $rows=$html->find('div[id=yfi_quote_summary_data] table tr'); $result=array(); foreach($rows as $row){ preg_match('#([^:]+):(.+)#',strip_tags($row),$m); $result[]=array("label"=>$m[1],"value"=>$m[2]); } print_r($result); ?>[/CODE] | |
Re: [QUOTE]Im trying to get the following example to update without the need to click [/QUOTE] You need to call the function somehow. If you want to do this upon page load then try: [CODE] <script type="text/javascript">> //the stuff you currently have goes here //... //then right BEFORE you close the … | |
Re: [QUOTE] it simply displays: Resource id #3[/QUOTE] That's because mysql_query() returns exactly that - a resource, NOT the direct value. You have to extract the value explicitly: [CODE] $result = mysql_query("SELECT total FROM usersystem WHERE username = '$username'") or die( mysql_error() ); $row=mysql_fetch_assoc($result); $total = $row['total']; ... [/CODE] | |
Re: can't you just install any of those packages (the one you prefer) and then reverse-engineer the db design since that is all you want. You should be able to generate a diagram using MySQL workbench: [url]http://dev.mysql.com/downloads/workbench/[/url] | |
Re: if your server supporst PHP, you can use the php's include() to "import" that file into your pages. You would just save the menu bar as an independent file (let's call it menu.inc.php - even if you have just "plain" html in it). Then you would need to rename index.html … | |
Re: Look the source code of the page you are interested in. Let's say that the DIV you are interested in is the THIRD in the page's HTML source code (but it has no attributes - id, class, etc). Since you know it is the third, then you can get it … | |
Re: [CODE]//you can use an associative array and retrieve $args['foo'] $args['lorem'] within the function $a=array("foo"=>'bar', "lorem"=>'ipsum'); example( $a ); //OR you can cast it to a "generic" object and access it at $args->foo and $args->lorem $a= (object) array("foo"=>'bar', "lorem"=>'ipsum'); example( $a ); [/CODE] | |
Re: The first place to look is the Date/Time functions in the manual page: [url]http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-sub[/url] [iCODE]SELECT * FROM forms WHERE today >= DATE_SUB( CURDATE(), INTERVAL 30 DAYS)[/iCODE] | |
Re: try: [iCODE]<form [COLOR="Green"][B]id[/B][/COLOR]="myForm" action = ""> [/iCODE] AND [iCODE]var temperatureValue = [COLOR="green"][B]document.getElementById('myForm')[/B][/COLOR].TemperatureField.value;[/iCODE] | |
Re: My guess is you defined your Number field/column as Text data time instead of INT. So it is doing ascii comparisons. In the ascii table the '1' comes before the '2'. You need to change the data type of the column to INT or cast the Number: [url]http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html[/url] [iCODE]SELECT * … | |
Re: Read the available Date/Time functions in the manual: [url]http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_curdate[/url] [CODE]SELECT * FROM TABLE WHERE dateField > DATE_SUB(CURDATE(), INTERVAL 3 DAYS) SELECT * FROM TABLE WHERE dateField > DATE_SUB(CURDATE(), INTERVAL 6 MONTHS)[/CODE] | |
Re: assuming you are using ASP AND the value stored in the session is a string, then WRAP the value you are assigning to the javascript variable in apostrophes: [CODE] <% Session("MySession")="Hello" %> <script> var MyClientSideVar =[COLOR="Red"][COLOR="red"]'[/COLOR][/COLOR]<%= Session("MySessionVar")%>[COLOR="Red"][B]'[/B][/COLOR]; alert(MyClientSideVar); </script> [/CODE] | |
Re: Change the "bullet;" with "#9632;" (leave the & alone). | |
Re: [QUOTE]You only need to find the keycode of the "H" key.[/QUOTE] His code already has that. 72 == H 104 == h | |
Re: Refer to: [url]http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/[/url] | |
Re: try: [CODE] <script type="text/javascript"> function callAjax(type,method) { method = (String(method).toUpperCase()=="POST") ? "POST" : "GET"; var xmlHttpReq = false; try { // Opera 8.0+, Firefox, Safari //ajaxRequest = new XMLHttpRequest(); xmlHttpReq = new XMLHttpRequest(); } catch (e) { // Internet Explorer Browsers try { xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) … | |
Re: This: [iCODE]onunload=db_refreshfeed[COLOR="Red"][B]()[/B][/COLOR][/icODE] should NOT have the parenthesis. You need to assign a function reference, NOT call the function since your function is NOT returning a function. Also try using onbeforeunload instead. Lastly, be sure both pages are on the same domain. | |
![]() | Re: Load you page via the browser. Now look at the browser's source code. Are you seeing all the expected item ids? How are you sending/printing your first block of code. It looks incomplete, so I am wondering if you are using an echo (or print) WITH double quote delimiters. ![]() |
Re: Are you sure that the content sent by phpsqlajax_genxml.php is VALID XML? Did you sent the correct Content-Type? | |
Re: [CODE]function tr(str) { return String(str).replace(/(^\s+|\s+$)/g,''); }[/CODE] | |
Re: [QUOTE]I have an upload form where the uploaded picture is displayed.[/QUOTE] Once you upload the picture, what code are you exactly executing? Are you: a. emitting an [iCODE]<IMG>[/iCODE] tag with the path to the newly uploaded image b. redirecting to the newly uploaded image c. Other??? If you are doing … | |
Re: If I understand you correctly, this is what you currently have: [CODE] -------- |Author| 1---------------+ -------- | id | name * second name -------- -------- year | Book | 1---------1 | Info | -------- -------- * id id | bookname type ----------- | Author_id year |Publisher| 1---------------+ Publisher_id author ----------- … | |
Re: [QUOTE]Dumping data for table `sec_tblusers`[/QUOTE] Is the data shown on that dump already encrypted? If yes, what code did you use to encode it? It would help to see the definition of DataLayer and Password Classes to see what methods they have available and what they are actually doing. | |
Re: I think this is what you are after: [CODE] select cfp_Id, P.proposal_id, P.institution_Name, sum(P.Task_Good_Idea + P.Task_Involve_Youth + P.Task_Involve_Partnerships + P.Task_Exploit_Digital_Medium + P.Task_Value_For_Money + P.Task_Theme + P.Task_Skills_Development + P.Task_LOC_Curriculum) as Task_Good_Idea from proposals P [COLOR="Red"]WHERE P.proposal_ID >=931[/COLOR] group by P.proposal_ID having (Task_Good_Idea >= 25) and (cfp_Id = 22) order by P.proposal_id … | |
Re: Instead of [iCODE]...VALUES('9/30/2010',...)[/iCODE] use [iCODE]...VALUES(STR_TO_DATE('9/30/2010','%m/%d/%Y'),....)[/iCODE] MySQL will save the date in yyyy-mm-dd format. So when you retrieve the date you will need to use DATE_FORMAT to change it back to mm/dd/yyyy [iCODE]SELECT DATE_FORMAT(`date`,'%m/%d/%Y') as `date` FROM Table...[/iCODE] As for your other problem, it sounds like you are using an integer … | |
Re: [QUOTE]. I have been able to pull the content out of the CDATA field with[/QUOTE] How do you know which banner you are editing at any given time? I was expecting to see each banner node with a unique id attribute so that when you edit, you would know which … | |
Re: Try: [CODE] <?php if( isset($_POST['selectedBox']) && !empty($_POST['selectedBox']) ) { $total=0; foreach($_POST['selectedBox'] as $index=>$value) { echo 'Checked Item '. $index; $total += $value; } if( 3==count($_POST['selectedBox']) ) { echo 'you get 75 bonus points for selecting all'; $total +=75; } echo 'Your total is' . $total; } ?> <form method="POST" action="<?php … ![]() | |
Re: [QUOTE]My issue is this code work properly on my pc but whenever copied on other pc its not working.[/QUOTE] On your working pc, when you load your page, what URL are you entering in the address bar? IF you are entering "http://localhost/...", then the problem is that when you go … | |
Re: On line 18 of your FIRST block of code you have: [iCODE]$_SESSION['[COLOR="Red"]sername[/COLOR]'] = $username; [/iCODE] I suspect you meant: [iCODE]$_SESSION['[COLOR="Green"]u[/COLOR]sername'] = $username; [/iCODE] On line 9 of your FIRST block of code You need to use the values stored in the VARIABLES $email and $password. You incorrectly have a literal … | |
Re: there is no [iCODE]elseif[/iCODE] in javascript. You need a space between the [B]else[/B] and the [B]if[/B]! |
The End.