627 Posted Topics
Re: try: [CODE] <?php $ndnews = file_get_contents('http://www.naughtydog.com/index.php/site/tickerData'); preg_match_all("/<div class=\"message\">\n(.+?)\n<\/d/", $ndnews, $news); foreach($news[1] as $item) { $Items = explode(" ", $item); echo "<span class=\"message\">" . preg_replace('#0(\d)/#','$1/',$Items[0]) . " - " . $Items[1] . "</span><br />\n"; } ?>[/CODE] | |
Re: on line 16, [iCODE]$query[/iCODE] is NOT an sql command (You already have a result set in [iCODE]$query[/iCODE] from the executed sql command on line 5), so it is essentially erroring out before it can emit those other options (look at the browser source code). On what you posted, I don't … | |
Re: [QUOTE] I never worked with PHP before though, and the question is how are the vars in URLs called?[/QUOTE] When someone visits your page and the url to your page contains variables like [iCODE]site.com/test.php?f=17&s=23[/iCODE], the PHP engine automatically creates a global array named [iCODE]$_GET[/iCODE] which gets "stuffed" with the url … | |
Re: Are you sure all those variables are properly initialized? Before line 6, add the following: [iCODE]echo $query;[/iCODE] What do you get? | |
Re: you need to make sure that $_POST['licenses'] is an array. When none of the options is selected, then there is NO such thing as $_POST['licences']!!! [CODE] if( is_array($_POST['licences']) ) { $temp = implode(",<br />", $_POST['licences']); }[/CODE] | |
![]() | Re: try the ajaxSend() [url]http://api.jquery.com/ajaxSend[/url] Look at the example right [B]before[/B] the section titled "Example". By looking at the settings.url (or perhaps settings.data) you will be able to know which field is triggering the request ) |
Re: on line 6 you have [iCODE]$result= mysql_query("select * from oocust")[/iCODE]. For the [iCODE]while[/iCODE] construct to finish (line 7 on your code), [iCODE]mysql_fetch_array($result)[/iCODE] needs to return false. However, within the loop you, on EVERY iteration you execute ANOTHER query (line 14) that "refreshes" $result. So it will never run out of … | |
Re: Let's say the code you posted above is on a file named 'test.php' and that the URL to that file (which you are currently executing) is [url]http://yoursite.com/somefolder/test.php[/url] [iCODE]$PHP_SELF[/iCODE] then equals [B]"/somefolder/test.php"[/B]. In your [iCODE]printf()[/iCODE] function you have: [iCODE]<a href="%s"...>[/iCODE] that first [iCODE]%s[/iCODE] is replaced with the value of [iCODE]$PHP_SELF[/iCODE] | |
Re: Is LOAD DATA LOCAL enabled on your server? If not (or are not sure) refer to: [url]http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html[/url] specifically: [QUOTE] For the mysql command-line client, enable LOAD DATA LOCAL by specifying the --local-infile[=1] option, or disable it with the --local-infile=0 option. For mysqlimport, local data file loading is off by default; … | |
Re: if [iCODE]keyup[/iCODE] does not work, try [iCODE]keypress[/iCODE]: [CODE] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>hielo</title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(function(){ $('#description').bind('keyup',function(){ var val=this.value; $('input[name=fruit]').each(function(){ this.checked=val.indexOf(this.value)>-1; }); }); }); </script> </head> <body> <div><input type="checkbox" name="fruit" value="orange"/>Oranges</div> <div><input type="checkbox" name="fruit" value="apple"/>Apple</div> <div><textarea name="description" id="description" … | |
Re: try: [CODE] <?php include 'dbconn.php'; include 'Header.php'; if(isset($_COOKIE['Author'])) { echo "<div id='Display'>"; echo "You already have an account!</div>"; } else { echo "<form name='frmRegisteration' action='Register.php' method='post' onSubmit='return DataValidator()'>"; $name = mysql_real_escape_string($_POST['txtname']); $password = mysql_real_escape_string($_POST['txtpasswd']); $email = mysql_real_escape_string($_POST['txtemail']); if(isset($name,$password,$email)) { $qry_insertauthor = "INSERT INTO author (user_name,passwd,email) VALUES ('".$name."','".$password."','".$email."')"; $arr_insertauthor = mysql_query($qry_insertauthor); … | |
Re: let's say your page is named test.php. When you first load [url]http://yoursite.com/test.php[/url] NOTHING has been "submitted", so [iCODE]$_GET['fname'][/iCODE] does not exist yet. You need to first check to see if it has been submitted. [CODE] <html> <head> <h1>Welcome</h1> <h2>back</h2> <form action='get.php' method='GET'> Name: <input type='text' name='fname' /><br> Age: <input type='text' … | |
Re: you have to return false when there is an error. Since you are NOT doing that, the form gets submitted and quickly reloaded (hence the "flash"). Try: [CODE] function validate() { var ok=true; ok=ok && firstname(); ok=ok && lastname(); return ok; } function firstname() { var x=document.forms["signup"]["firstname"].value; if (x==null || … | |
Re: try: [CODE]<?php $connect = mysql_connect("localhost","root","") or die ("connection failed!"); mysql_select_db("users") or die (mysql_error()); echo "connected!" $recordset = mysql_query("select * from member order by id ASC") or die( mysql_error()); $row=mysql_fetch_assoc($recordset); extract( $row ); ?>[/CODE] | |
![]() | Re: try: [CODE] ... success: function(msg) { isSuccess = !/TRUE/.test(msg); } ... [/CODE] ![]() |
Re: Yes, your first post is correct. On the second block of code you posted, upon first visit of the page that contains said code, pgv_pvid is set to some value and ssid gets that same value but prefixed with an "s". However, upon subsequent visits, the value is obtained from … | |
Re: when you click the submit button, a [iCODE]$.post()[/iCODE] is emitted. This in turn sends/POSTs [iCODE]contentvar[/iCODE] and [iCODE]inputvar[/iCODE] to crud.php which ends up updating the db. After the php script is done executing all php variables are "obliterated" - they cease to exist on the SERVER. THEN lines 15-22 execute on … | |
Re: To understand that, you need to realize that your [iCODE]doSearch()[/iCODE] has the following: [iCODE]window.location.href = submitto;[/iCODE] That line basically will change the browser's url to whatever is in the [iCODE]submitto[/iCODE] variable. Essentially that line is emitting a search request using [iCODE]method="get"[/iCODE], since all the search parameters are already included in … | |
Re: Prepared Statements are a mechanism/feature to prevent sql injection. PDO, mysql, mysqli are "software layers" that allow you to interact with the db server, but not all of them support prepared statements. -only PDO and mysqli support prepared statements. -mysql and mysqli can be used only with mysql database server … | |
Re: try: [CODE] <?xml version="1.0" encoding="ISO-8859-1"?> <internal_guides> <% While (Not guides.EOF) %> <guide> <id><![CDATA[<%=(guides.Fields.Item("ID").Value)%>]]></id> <title><![CDATA[<%=(guides.Fields.Item("Title").Value)%>]]></title> <% If NOT steps.EOF Then steps.moveFirst() While (NOT steps.EOF) If (steps.Fields.Item("GuideID").Value) = (guides.Fields.Item("ID").Value) Then %> <step><![CDATA[<%=(steps.Fields.Item("Info").Value)%>]]></step> <% End If steps.moveNext() Wend End If %> </guide> <% guides.MoveNext() Wend %> </internal_guides> <% guides.Close() Set guides= Nothing steps.Close() … | |
Re: try returning false so that the browser does not navigate away when the link is clicked: [CODE] $('ul li a').click(function (e){ checkURL(this.hash); return false; }); [/CODE] | |
Re: add [icode]dataType:'json'[/icode] to your [icode]$.ajax()[/icode] options. Also, make sure that your PHP file does NOT return anything after that json_encode statement - try: [code=php] <?php $propName="test"; $title = array("title" => "$propName"); json_encode($title); exit; ?> [/code] | |
Re: You can only use [icode]document.write()[/icode] WHILE the page is loading. If you use it AFTER the page has loaded, it will "erase" EVERYTHING that was already there and then write whatever new content you specify in the argument that you pass to [icode]document.write()[/icode]. What you need is to NOT use … | |
Re: first of all, fix line 41 so that you comment only the [icode]img[/icode] tag, NOT that [icode]<a>[/icode] tag. then check the value of $Isbn. If it IS an empty string, then the if clause will not execute and your php code will not generate that link, which means that the … | |
Re: try: [CODE] preg_replace('/href=\s*([\x22\x27]?)([^\.]+\.css)/i', 'href=$1'.$dir.$template.'$2', $content); [/CODE] | |
Re: instead of: [CODE]echo "\t"."Confirmation Page<br/>";[/CODE] try: [CODE]echo "<div style='padding-left:10px;'>Confirmation Page</div>";[/CODE] ![]() | |
Re: currently I see the following on line 148: [iCODE]$to = $_POST['email'];[/iCODE] but on line 33 you have: [iCODE]<input type="text" name="[COLOR="Red"]v[/COLOR]email" >[/iCODE] Notice that the name of the input text box does NOT match the key in the $_POST array. If you fix the name of the input field (get rid … | |
Re: Refer to: [url]https://github.com/douglascrockford/JSON-js/blob/master/json2.js[/url] You will need to "import" that js script into your page, then call [iCODE]JSON.stringify( obj ) [/iCODE]-ex: [CODE] <script type="text/javascript" src="/javascript/json2.js"></script> <script type="text/javascript"> var settings={"username":"xxx","password":"secret"}; alert( JSON.stringify( settings ) ); </script> [/CODE] | |
Re: try: [CODE] <?php $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die("Unable to connect to the db server"); $parent_id = mysqli_real_escape_string($dbc, $_GET['parent_id']); $comment_query = "SELECT comment_id,poster_id,comment_text,post_time FROM comments WHERE parent_id = '$parent_id' ORDER BY post_time ASC"; $comment_data = mysqli_query($dbc, $comment_query); $xmlOutput = '<?xml version="1.0"?>'; $xmlOutput .= '<comments>'; while( $comment_rows = mysqli_fetch_assoc($comment_data) … | |
Re: It seems that [iCODE]$row[0][/iCODE] and [iCODE]$row[1][/iCODE] contain Arrays, NOT the numeric value you think they have. Try using: assuming they are INDEXED arrays, try [iCODE]$row[0][0][/iCODE] and [iCODE]$row[1][0][/iCODE] instead. | |
Re: try using the following html parser: [url]http://simplehtmldom.sourceforge.net/[/url] | |
Re: [CODE] //print_r() is to print an array. Preview is NOT an array. //You can print the entire $_REQUEST array: print_r($_REQUEST); //OR just the Preview item: echo $_REQUEST['Preview']; [/CODE] Also, make sure the button is WITHIN the form. Lastly, if there is more than one form on the page, the first … | |
Re: It would help if you actually post the HTML you are using. As for: [CODE] //element.style.visibility = 'hidden' and 'block' element.style.visibility ==> visible OR hidden element.style.display ==> none OR block OR inline So if you have an input and next to is is the element you want to display (like … | |
Re: You can save it onto a $_SESSION variable. Assuming that on page1.php you are submitting a POST request (as opposed to a get), then on page2.php: [CODE=php] <?php session_start(); foreach($_POST as $fieldName=>$value){ $_SESSION[$fieldName]=$value; } ?> [/CODE] Then on page3.php [CODE]<?php session_start(); //for the sake of clarity, let's say that on … | |
Re: document.layers? Seriously? For your reference: [url]http://www.webconcerns.co.uk/javascript/dhtml/dhtml_page.asp[/url] Try: [CODE] <style type="text/css"> a { text-decoration: none; } .title { position: absolute; width: 150px; height: 20px; left: 10=px; z-index: 10; font-family: verdana, helvetica, sans-serif; font-weight: bold; font-size: 12px; } .submenu { position: absolute; left: 25px; width: 120px; border: 0px solid black; background-color: white; … | |
Re: [CODE] <script type="text/javascript"> function trim(str){ return String(str).replace(/^\s+|\s+$/g,''); } function checkForm(formobj) { //name var formOK = true; if (formobj.name.value == "") { window.alert("You have to enter value for name."); formobj.focus(); formOK = false; } //surname if (formobj.surname.value == "") { window.alert("You have to enter a value for surname."); formobj.focus(); formOK = … | |
Re: There are "plugins" for this already. I suggest you look at: [url]http://bassistance.de/jquery-plugins/jquery-plugin-treeview/[/url] Click on the demos link. It shows you MULTIPLE trees on a single page. If you want to see a demo with a single tree, then click on any of the links at the top of the demo … | |
Re: [QUOTE]...also tried xmlDoc.documentElement.[COLOR="Red"]N[/COLOR]odeName.[/QUOTE] Try lowercase "N" for Node xmlDoc.documentElement.[COLOR="Red"]n[/COLOR]odeName. If the problem persists, verify that the document loaded correctly - on line 4 put: [iCODE]Response.Write(xmlDoc.xml);[/iCODE] If you do not see the xml document, then it was not retrieved. | |
Re: [CODE] function makeUppercase(field) { field.value = field.value.replace(/(, [a-z])/g,function(){return arguments[1].toUpperCase()}); } [/CODE] | |
Re: [QUOTE]when the pound and pence fields on the form are blank, but the name is filled in[/QUOTE] Not from what you coded. The problem is that when the pound is left blank, this condition is true: [CODE] if(cpound.value == '') { cpound == 0 }[/CODE] and the rest of your … | |
Re: at the end of line 7 of your second code block you have: [iCODE]function(dat[COLOR="Red"]a{[/COLOR][/iCODE] It is missing a closing parenthesis. Try: [CODE] $(document).ready(function(){ $("#env").click(function(e) { e.preventDefault(); // do both $.getJSON("generator.php?", {act: 'char_con', bc: '1'}, function(data){ $(".quote").html(data); }); $.get("char_con.php?", {act: 'char_con'}, function(data){ $(".q").html(data); }); $(".q").html(data); }); }); }); [/CODE] | |
Re: [iCODE]<input Fahrenheit = "Fahrenheit" ..>[/iCODE] should be: [iCODE]<input [COLOR="Green"][B]id[/B][/COLOR] = "Fahrenheit" ..>[/iCODE] The same goes for the other input. Also, this is wrong: answer2 = (9.0/5.0) * (temp2 + 32); You need to add 32 AFTER the multiplication. Lastly, if you are executing convertC() simply returning the result is useless … | |
Re: [iCODE] <?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>[/iCODE] should appear only ONCE in the document. Currently you are appending that within your WHILE construct, so you are generating that multiple times. Move it OUTSIDE you while construct so that it is BEFORE the root/top-most element (basically between lines 8 and 9 in your markup). | |
Re: Try doing a UNION query and insert a "priority" field depending on which one it is: [CODE] NOTE: on the example below, $term represents the value you are searching for SELECT locationID, locationName, 1 as priority FROM locations WHERE locationName LIKE '$term%' UNION ALL SELECT locationID, alternateName, 2 as priority … | |
Re: you created TWO DIFFERENT objects. One is a Father object. The other is a Son object. The Son object: a. Sets the value of car and ... b. inherits from the Father So try: [iCODE]$obj1->inherited();[/iCODE] to see the value of car. Maybe this will clear things up for you: [CODE] … | |
![]() | Re: WRONG: [CODE] xmlhttp.send("username=" + username.value); xmlhttp.send("password=" + password.value); [/CODE] You cannot call send() multiple times. You must call it exactly once. To pass multiple parameters you must separate each value with an ampersand and you should encode each value: [CODE] xmlhttp.send("username=" + encodeURIComponent(username.value) + "&password=" + encodeURIComponent(password.value) ); [/CODE] |
Re: on EVERY page where you are using $_SESSION, you MUST call [iCODE]session_start()[/iCODE] first. So, at the very top of your pages, BEGIN with: [CODE] <?php session_start(); //rest of your code follows ... ?> [/CODE] | |
Re: On line 15 of the code you posted, you forgot a semicolon at the end of the line. | |
Re: a comma separated list of email addresses is OK. It is even shown in example 4 on the manual: [url]http://php.net/manual/en/function.mail.php[/url] | |
Re: use the [iCODE]bind_param()[/iCODE] method to extract the values. See Example 1: [url]http://us.php.net/manual/en/mysqli.prepare.php[/url] |
The End.