627 Posted Topics
Re: A. at the end of line 17 you have [iCODE]horizontal[fishPos[fishNumber] [/iCODE]. That's a syntax error. You are missing a closing bracket after [iCODE]fishNumber[/iCODE]. B. On line 24 you have [iCODE]setInterval(fish1Swim, 100);[/iCODE], but there is no such thing as [iCODE]function fish1Swin(){...}[/iCODE] declared anywhere, so I don't see how you can claim … | |
Re: try: [CODE=html] <!-- make sure you put the [] at the end of the name --> <input name="searchterm[]" /> <input name="searchterm[]" /> <input name="searchterm[]" /> [/CODE] then try: [CODE=php] <?php //connect to the db first $conn=mysql_connect('...', '...', '...') or die(mysql_error()); mysql_select_db('...') or die(mysql_error()); foreach($_POST['searchterm'] as $i=>$v) { if(preg_match('#\w#',$v)) { $_POST['searchterm'][$i]=mysql_real_escape_string($v); … | |
Re: Load the page in your browser. Then view the source code. Within the source code look for: #D50512 That is the "red" color that you are seeing. | |
Re: If the XML file you are retrieving has invalid markup, then on line 20 [iCODE]xmlDoc[/iCODE] will be set to null. If that is the case, then [iCODE]xmlDoc.getElementsByTagName()[/iCODE] will give you the error you are describing. So, you need to make sure that the responseXML is not null. On your XML … | |
Re: before you begin the delay, try "capturing/recording" a reference to "[iCODE]this[/iCODE]" in some variable so that your delayed function actually knows what "[iCODE]this[/iCODE]" means: [CODE=javascript] $(".tabButton").click(function() { var self=this; $(self).css("background-color", "white").delay(500, function() { $(self).css("background-color", "black"); }) }); </script> [/CODE] | |
Re: try: [CODE=php] $result = mysql_query("SELECT * FROM comments") or die(mysql_error()); while( $row = mysql_fetch_assoc($result) ) { echo $row['alias'], ': ', $row['comment'], '<br />', PHP_EOL; } [/CODE] ![]() | |
Re: `<input name="name"... />` should be `name="username"... />`. You your comment: `// Set cookie / Start Session / Start Download etc...` is inaccurate. You need to start the session BEFORE you even begin sending any output. That means that you cannot start the session after you have send `<html>...` Try the … | |
Re: Check your file case. In other words, if your folder/file is named Style (uppercase "S"), make sure you are not using `< (...) href="../style/style.css">` (lowercase "S") | |
Re: try: [CODE=php] <?php session_start(); $redirectTo='http://yoursite.com/page.php'; $DEBUG=true; $SELF=basename(__FILE__); $err=''; $match=0; if(isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) { $link = mysql_connect('localhost', 'username', 'password') or die('Could not connect: ' . mysql_error()); mysql_select_db('database') or die(mysql_error()); $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $sql="SELECT `active` FROM `users` WHERE `username`='".$username."' AND `password`='".$password."'"; $search = mysql_query($sql) or … | |
Re: try: [CODE] <?php $datearray=explode('-','1980-09-28'); $days=str_replace('>'.$datearray[2],' selected="selected">'.$datearray[2],preg_replace('#option>(\d+)#','option value="$1">$1','<option>'.implode('</option><option>',range(1,31)).'</option>')); echo '<select name="day">'.$days.'</select>'; ?> [/CODE] | |
Re: try: [CODE=php] <?php session_start(); error_reporting (E_ALL ); //connect to db $connect = mysql_connect("*******","*****","*******") or die( mysql_error() ); mysql_select_db("******") or die( mysql_error() ); $get = mysql_query("SELECT * FROM `users` WHERE `username`='".$_SESSION['username']."'") or die(mysql_error()); while($row = mysql_fetch_array($get)) { $admin = $row['user_level']; if ($admin == 0) { header("Location: index.php"); exit; } elseif ($admin … | |
Re: try changing: [CODE]<input type="button" value="SAVE" onclick="submit();" />[/CODE] to: [CODE]<input type="submit" value="SAVE" />[/CODE] | |
Re: try: [CODE=php] <?php header('Content-Type: application/json'); $a = array('data' => 'Hello'); echo json_encode($a); exit; ?> [/CODE] | |
Re: Do you actually see the message "Your password has been changed..."? If yes, then try adding a "To" header as well: [CODE] ... if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. $headers=""; $headers.="From: northherner@hotmail.com".PHP_EOL; $headers.="To: ".$_POST['email'].PHP_EOL; // Send an email: $body = "Your password to log into <whatever … | |
Re: That error typically indicates that your query did NOT succeed. To find out what was any error, change `$sql = mysql_query ("SELECT * FROM 'Product'");` to `$sql = mysql_query ("SELECT * FROM 'Product'") or die(mysql_error());` On the code you posted, the query is wrong. It should be `Product` (using backticks … | |
Re: try: [CODE=javascript] function checkpostal(){ var re=/^[a-zA-Z]+$/; var result=re.test(myform.myinput.value); if( result ) { alert("Good") }else{ alert("Bad") } return result; } [/CODE] | |
Re: When an AJAX request is complete, the connection between the script and the server is closed. The communication dynamics is just like that between the browser and the server. Once the connection is closed, the server does not know who just asked for whatever resource, so it cannot notify any … | |
Re: [CODE] <script> var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec']; function populatedropdown(dayfield, monthfield, yearfield){ var today=new Date() var dayfield=document.getElementById(dayfield); var monthfield=document.getElementById(monthfield); var yearfield=document.getElementById(yearfield); for (var i=0; i<31; i++) dayfield.options[i]=new Option(i+1, i+1) dayfield.options[today.getDate()-1].selected=true; for (var m=0; m<12; m++) monthfield.options[m]=new Option(monthtext[m], monthtext[m]) monthfield.options[today.getMonth()].selected=true; var thisyear=today.getFullYear() for (var y=0; y<20; y++){ yearfield.options[y]=new Option(thisyear, thisyear) thisyear+=1 } yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), … | |
Re: Read comments in code: [CODE=vbscript] Dim strSQL Set objConn = Server.CreateObject("ADODB.Connection") Set objRS = Server.CreateObject("ADODB.Recordset") objConn.ConnectionString = "Provider={SQL Server};Server=server;Database=db;User ID=id;Pwd=pw" strSQL = "SELECT * FROM table" 'open connection first objConn.open 'execute the sql on the Recordset object objRS.Open strSQL, objConn, 1,3 If Not objRS.EOF Then 'iterate through records here Else … | |
Re: I think you meant [iCODE]nextSibling()[/iCODE], not [iCODE]next_sibling()[/iCODE]: [url]http://www.php.net/manual/en/class.domnode.php[/url] | |
Re: [CODE] //connect to db first ... $expdat='July 20, 2012'; $theValue='<span style="background-color:yellow">Expires ' . $expdat . '. </span>'; //escape the value you are about to insert into the table: $theValue = mysql_real_escape_string($theValue); //provide the correct name for your table and your field mysql_query( "INSERT INTO `tableName`(`fieldName`) VALUES('" . $theValue . "')" … | |
Re: try: [CODE] $sql = mysql_query("UPDATE joke SET joketext='$text' WHERE id='$id'") or die( mysql_error() ); [/CODE] notice the apostrophes around the value of [iCODE]$id[/iCODE] | |
Re: [CODE=xsl] ... <a href="http://{target}"><xsl:value-of select="name" /></a><br /> ... [/CODE] | |
Re: if you are going to use [iCODE]mysql_real_escape_string()[/iCODE], then [iCODE]stripslahses()[/iCODE] first since magic_quotes are enabled - ex: [CODE]$search = "q test'yes"; $search = mysql_real_escape_string( stripslashes($search) ); mysql_query("SELECT * FROM block WHERE name LIKE '%$search%' ORDER BY `id` DESC",$this->connect);[/CODE] | |
Re: >>I was able to do some of this Using what exactly VBSCRIPT, PHP, XSL? Post what you have thus far. | |
Re: if [iCODE]$email[/iCODE] equals 'joe@gmail.com' and [iCODE]$level[/iCODE] equals 1, Then if you are TRYING to set: [iCODE]$_SESSION['joe@gmail.com.1']='...'[/iCODE], then the above will not work. You need to use DOUBLE quotes so that the variables are evaluated: [iCODE]$_SESSION["$email.$level"][/iCODE] Perhaps what you are after is something like: [CODE] $_SESSION['email_level']=$email.PHP_EOL.$level; Then later on if you … | |
Re: [QUOTE]toggle(this)[/QUOTE] [B]this[/B] [U]IS[/U] the [B]<a>[/B] tag so you do NOT need: var ele = document.getElementById(int); all you need is: [CODE] <script language="javascript"> //function toggle(int) { //var ele = document.getElementById(int); function toggle(ele){ if(ele.style.display == "block") { ele.style.display = "inline"; } else { ele.style.display = "block"; text.innerHTML = "hide"; } } </script> … | |
Re: provid the protocol in the url as well: [iCODE]$url="[B]http://[/B]abksms.com...";[/iCODE] | |
Re: are you having trouble sending/submitting all the fields? If so, try: [CODE] $('#contactform').submit(function(){ var action = $(this).attr('action'); $("#message").slideUp(750,function() { $('#message').hide(); // http://api.jquery.com/serialize/ $.post(action, $('#contactform').serialize(), function(data){ document.getElementById('message').innerHTML = data; $('#message').slideDown('slow'); $('#contactform img.loader').fadeOut('fast',function(){$(this).remove()}); if(data.match('success') != null) $('#contactform').slideUp('slow'); } ); }); return false; }); [/CODE] | |
Re: change: [iCODE]$mark = mysql_query("select * from product order by product_id DESC");[/iCODE] to: [iCODE]$mark = mysql_query("select * from product order by product_id DESC") or die( mysql_error() );[/iCODE] It should tell you WHY the query is failing. | |
Re: well, I see three function calls bolded, but what you need to do is call just ONE function and from that function you do your first ajax call. On that first ajax call, you should have a callback function - the function that executes upon completion of the ajax request. … ![]() | |
Re: [CODE=sql] Part id autonumber name varchar Supplier id autonumber name varchar SupplierPart Supplier_id int Part_id int quantity int [/CODE] | |
Re: [CODE] function toSeconds(str){ str=str.split(':'); switch( str.length ) { case 2: return str[0]*60 + str[1]*1; case 3: return str[0]*3600 + str[1]*60 + str[2]*1; } } alert( toSeconds("2:15") ) [/CODE] | |
Re: [CODE] $sql=mysql_query("SELECT * FROM `expense` WHERE `date` BETWEEN '2011-04-26' AND '2011-04-28'") or die(mysql_error()); $r=mysql_fetch_assoc($sql); //SELECT * ... assuming that the * includes some field named `id`, then the following //will print it's contents: echo $r['id']; //if you want to see everything at once, use: print_r($r); [/CODE] | |
Re: Point the link to the XML file (not the XSL). The top of the XML should look SIMILAR to the following (you need to provide the correct path to your file): [iCODE]<?xml version="1.0" encoding="ISO-8859-1"?>[/iCODE] [iCODE][COLOR="Red"]<?xml-stylesheet type="text/xsl" href="[COLOR="Green"]Catalog.xsl[/COLOR]"?>[/COLOR][/iCODE] Also, at the top of the [B]XSL[/B] file make sure you declare the … | |
Re: assuming the field you inserted the data into is named info, then instead of something like: [iCODE]echo $row['info'];[/iCODE] try: [iCODE]echo '<div style="white-space:pre">' . htmlentities($row['info'],ENT_QUOTES) . '</div>';[/iCODE] OR: [iCODE]echo '<pre>' . htmlentities($row['info'],ENT_QUOTES) . '</pre>';[/iCODE] | |
![]() | Re: since you seem to be passing very minimal data, try setting some cookies instead of passing the data via url. Then on the server retrieve the data from the cookies. In "The Scripts" section of [url]http://www.quirksmode.org/js/cookies.html[/url] you will find three very useful functions. Save them as cookies.js and import them … |
Re: try creating a different http object for each request. If you are still having problems, post your code. | |
Re: [quote]...i would like it to return a result whether only a name was found, just an owner, or both.[/quote] You don't need to AND. The OR should give you what you want even when both are true: [code=php] $sql="SELECT `name`, `owner` FROM Table WHERE `name` LIKE '$%term%' OR `owner` LIKE … | |
Re: on line 29 of first block and line 39 of second block you have: [iCODE]$result=mysql_[COLOR="Red"]db_[/COLOR]query([COLOR="Red"]errorfile[/COLOR],"$SQL");[/iCODE] a. [iCODE]mysql_db_query()[/iCODE] is deprecated. Use [iCODE]mysql_query()[/iCODE] instead. b. Regarding the first argument to the function did you mean [iCODE][COLOR="Red"]$[/COLOR]errorfile[/iCODE]? c. Also, (assuming you "insist" on sticking with [iCODE]mysql_db_query()[/iCODE]) you connect to the db, but you … | |
Re: try: [CODE]content.value = content.value.substring(0,content.selectionStart) + url + content.value.substring(content.selectionEnd);[/CODE] | |
Re: On another note, [CODE]...if($stmt==-1) {...[/CODE] when will that be true? prepare() and execute() methods return [iCODE]FALSE[/iCODE] upon failure. If you are relying on FALSE to be defined as -1, that may not be a good idea. I suggest you consider revising that statement. Regards, Hielo | |
Re: Have you tried using [iCODE]REQUEST_URI[/iCODE] instead of [iCODE]REQUEST_FILENAME[/iCODE]? Try: [CODE]RewriteEngine On RewriteBase /~jn/ RewriteCond %{REQUEST_URI} !-d RewriteCond %{REQUEST_URI} !-f RewriteRule ^([^\.]+)/?$ /~jn/$1.php [NC,L][/CODE] | |
Re: When you pass the data to a script via a URL - ex: [iCODE]<a href="?act=view&title=".$row['title'].""\">".$row['title']."</a> [/iCODE] OR via a <FORM> set to get - ex: [iCODE]<form method="get"...>[/iCODE] then on the server you should make use of [iCODE]$_GET['variableName'][/iCODE] to extract the data you want/need. To clarify, given the URL you posted … | |
Re: executing [iCODE]DELETE FROM `customer`;[/iCODE] will remove all the records from the table, but it will NOT reset the auto-increment counter. Imagine that you start with [iCODE]customer=(1, 'Bob', 'Smith', '330-678-2732', 'Smith22@live.com')[/iCODE] (where 1 is the [iCODE]customer_id[/iCODE]) and this customer exists in the rental table. If you delete all the records from … | |
Re: [QUOTE]detached_fields += $(this).remove();[/QUOTE] that's your problem. You can concatenate STRINGS, but NOT objects. [iCODE]remove()[/iCODE] returns an object. Since you are issuing a concatenation operator, javascript calls its [iCODE]toString()[/iCODE] method which simply returns a string whose value is [iCODE][object Object][/iCODE]. What you need is the ACTUAL objects. Make detached_fields an array, … | |
Re: [url]http://www.php.net/manual/en/functions.variable-functions.php[/url] [CODE] $goto=$_GET['goto']; $sections= array('fail','success'); if(in_array($goto,$sections)) { $goto(); } [/CODE] | |
Re: [QUOTE]But if the item contains more than one word, or special characters, like a single quote, the delete does not work...[/QUOTE] Most likely you have: [iCODE]<input type=checkbox value=White Bread >[/iCODE] instead of: [iCODE]<input type=[B][COLOR="Red"]"[/COLOR][/B]checkbox[B][COLOR="Red"]"[/COLOR][/B] value=[B][COLOR="Red"]"[/COLOR][/B]White Bread[B][COLOR="Red"]"[/COLOR][/B] >[/iCODE] You need to quote the values of the attributes - particularly, the [B]VALUE[/B] … | |
Re: When "importing" javascript, never use the "short" syntax: [iCODE]<script src="..." type="text/javascript" [COLOR="Red"]/>[/COLOR][/iCODE] Use the "long" syntax: [iCODE]<script src="..." type="text/javascript"[B][COLOR="Green"]></script>[/COLOR][/B][/iCODE] some browsers "choke" if you use the "short" syntax. Having said that, on the FIRST block of code, fix line 1 so that it uses the "long" syntax. On the SECOND … |
The End.