627 Posted Topics

Member Avatar for kavkazi

[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]

Member Avatar for hielo
0
70
Member Avatar for brown23

[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]

Member Avatar for hielo
0
170
Member Avatar for Cstonehouse

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__, …

Member Avatar for Stefano Mtangoo
0
149
Member Avatar for luke noob

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]

Member Avatar for luke noob
0
631
Member Avatar for ryan-t

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 …

Member Avatar for ryan-t
0
129
Member Avatar for krishx343

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 …

Member Avatar for krishx343
0
225
Member Avatar for ZethSchlenker

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]

Member Avatar for ZethSchlenker
0
110
Member Avatar for jonnypixel

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 …

Member Avatar for jonnypixel
0
704
Member Avatar for jonnypixel

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; ?> …

Member Avatar for jonnypixel
0
4K
Member Avatar for mshauny

[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 …

Member Avatar for macobex
0
137
Member Avatar for Awah Mohamed

[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 …

Member Avatar for hielo
0
77
Member Avatar for abelingaw

[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 …

Member Avatar for abelingaw
0
107
Member Avatar for jonnypixel

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]

Member Avatar for jonnypixel
0
2K
Member Avatar for chinee

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]

Member Avatar for chinee
0
378
Member Avatar for mrlol

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]

Member Avatar for Dragonbaki
0
11K
Member Avatar for heshanm

[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 …

Member Avatar for kiroshimasylvia
0
116
Member Avatar for daviddoria

[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 …

Member Avatar for hielo
0
107
Member Avatar for sedalnas

[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 …

Member Avatar for pritaeas
0
458
Member Avatar for itisnot_me

[CODE]foreach ($fields as &$value) { ${$value} = $myrow[$value]; }[/CODE]

Member Avatar for itisnot_me
0
88
Member Avatar for gunnarflax

try: [CODE]SELECT * FROM table WHERE type='cool' AND (id NOT IN(2,3,5) )[/CODE]

Member Avatar for gunnarflax
0
102
Member Avatar for alanlai

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]

Member Avatar for hielo
0
200
Member Avatar for whiteyoh

[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 …

Member Avatar for vibhaJ
0
101
Member Avatar for CEVGames

[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]

Member Avatar for CEVGames
0
77
Member Avatar for Stefano Mtangoo

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]

Member Avatar for hielo
0
226
Member Avatar for coud_ren_26

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 …

Member Avatar for Roymj
0
146
Member Avatar for cursedever

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 …

Member Avatar for hielo
0
88
Member Avatar for gunnarflax

[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]

Member Avatar for gunnarflax
0
268
Member Avatar for Sahilsahni

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]

Member Avatar for smantscheff
0
2K
Member Avatar for mini programmer

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]

Member Avatar for mini programmer
0
113
Member Avatar for jenmay92683

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 * …

Member Avatar for jenmay92683
0
66
Member Avatar for Sahilsahni

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]

Member Avatar for Sahilsahni
0
1K
Member Avatar for omaiaa0p

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]

Member Avatar for omaiaa0p
0
151
Member Avatar for jaylou
Member Avatar for murtazamzk

[QUOTE]You only need to find the keycode of the "H" key.[/QUOTE] His code already has that. 72 == H 104 == h

Member Avatar for hielo
0
102
Member Avatar for dev.vini

Refer to: [url]http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/[/url]

Member Avatar for hielo
0
60
Member Avatar for debashishnit

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) …

Member Avatar for hielo
0
408
Member Avatar for anandhikrishnan

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.

Member Avatar for hielo
0
109
Member Avatar for jpknoob

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.

Member Avatar for jpknoob
0
78
Member Avatar for furianera

Are you sure that the content sent by phpsqlajax_genxml.php is VALID XML? Did you sent the correct Content-Type?

Member Avatar for hielo
0
164
Member Avatar for pikkas

[CODE]function tr(str) { return String(str).replace(/(^\s+|\s+$)/g,''); }[/CODE]

Member Avatar for hielo
0
100
Member Avatar for LELE7

[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 …

Member Avatar for LELE7
0
126
Member Avatar for LONGWAY

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 ----------- …

Member Avatar for LONGWAY
0
120
Member Avatar for facarroll

[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.

Member Avatar for facarroll
0
410
Member Avatar for albertkao

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 …

Member Avatar for hielo
0
98
Member Avatar for showman13

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 …

Member Avatar for hielo
0
134
Member Avatar for tomccabe

[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 …

Member Avatar for hielo
0
318
Member Avatar for the_mia_team

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 …

Member Avatar for diafol
0
169
Member Avatar for himmat.m4

[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 …

Member Avatar for hielo
0
140
Member Avatar for CEVGames

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 …

Member Avatar for CEVGames
0
201
Member Avatar for matt987

there is no [iCODE]elseif[/iCODE] in javascript. You need a space between the [B]else[/B] and the [B]if[/B]!

Member Avatar for hielo
0
177

The End.