-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
Yeah that's fine..
-
POST data is just sent as a simple sting to the web server. Plus you can't "conditionally deny a request" without the server having received it. What are you going to do with the last 4 digits though? It's sent that way purposefully to make it useless.
-
Why not just submit the data to "update.php"?
-
Everyone likes a little chafing, right? Depends how I got it...
-
Getting the year itself is extremely easy, thanks to the date function -- I'll leave that part to you. Looks as though you're using sprintf on that string afterwards though, going by '%1$s'. You'll need to show us the full string and the point where you call s?printf() in order for us to help you with that. As always though, have a read of the manual and see if you can do it yourself first. If not, show us what you tried.
-
'reason["+number+"]' To concatenate the variable, you need to close/open the string using a single quote like you originally use to open/close it. Otherwise what you'll end up here with is literally: reason["+number+"]. Also you'd be better off changing the name of the function. "Image" is a default object, and although JS is case-sensitive, it doesn't seem to like you referencing it within the document. You could fix the problem by calling "window.image(0)" - but it would be better to change it to avoid such issues.
-
You're not setting the left CSS property.
-
You can't conditionally close a loop. Control structures shouldn't, and thankfully don't, work that way. What you can do is break from the loop. Although I don't see how that would fit into your code anyway?
-
Ah, think you just needed to think simpler. Try this: var example = document.getElementById(number).value; var exampleid = example+number; if (example.length >= 12) { example = example.substr(0, 12) + '...'; } document.getElementById(exampleid).innerHTML = example; Key being the operator used, ">=" not "==". Edit: removed the quotes in the "exampleid" declaration.
-
You made a typo, but you answered that yourself: .substr(). What have you tried so far?
-
Allow me to re-phrase.. You're only adding the "<tr>" on the first row, and "</tr>" on the fourth row. What you're effectively doing is creating a new row in the HTML table after the fourth row in the database.. Which is why you see the broken structure shown in that image.
-
Looks like you're only adding the "</tr>" after 4 rows from the DB table? Shouldn't you start a new HTML table row for each DB row?
-
You mean any values within the 'cart' session variable? That can be achieved easily with !empty.
-
An ID must be unique- only used for one element. Here you're assigning it to every image, so the browser is just applying it to the first with that ID, as it isn't expecting there to be more than one. Instead of adding a number to the end of the ID or something though, just pass the element's object to the function using the special JavaScript variable "this": <img border="0" width="20" height="20" src="enable.jpg" onclick="change(this);" /> "this" represents the current element's object; the "img" as it's represented internally within the DOM tree. Within the function add the parameter so that you can use it: function change(obj) Now instead of using getElementById(), you can simply use the variable "obj". For example: obj.src="disable.jpg";
-
Let's say the form is in form.php, and you process it in a file called process.php. When the data is submitted to process.php from form.php, you should include all the form data you need to pass back, within another form in process.php but as hidden inputs. The user won't know see the inputs, but it's effectively like them filling it all in again. Clicking back should submit said form, effectively posting the data back to form.php, but from process.php. Then the code I provided before will work.
-
You shouldn't use a session for this. Assuming the form isn't shown on the page with the back button, just include all the form data as hidden inputs. When the data is then submitted back to the form, you just need something like this on each input: <input type="text" name="example" value="<?php if (isset($_POST['example'])) echo htmlspecialchars($_POST['example']); ?>" />
-
Putting the function call on the same line won't do the trick. We need to see the code behind rslider() to provide any kind of useful information...
-
"photos" is the name of the table containing the actual photo details (ID, caption, location, etc) and "p" is an alias assigned to it. An alias is used to prevent any ambiguity between the tables. If no column names are the same between them though, you don't necessarily need it.
-
Did you call it through PDO (accessed using $this->dbh in your code), or through PDOStatement (accessed using $statement in your code)? Both have a method called errorInfo(), but since you're using a statement I believe the error will only be available in the statement object.
-
Did you call it for PDO or PDOStatement ?
-
Use a second - "relational" - table to store the tags. A comma delimited string is not good for querying, as you'd need to perform LIKE queries on the column, and that will severely limit the accuracy of your results -- at least without a hit to performance. The table just needs to contain the - "foreign key" - ID of the photo, and a simple varchar column for the tag. Add a primary key across the two. Obviously guessing certain column names here, but you could then perform a JOIN query like this to get the results: select t2.photo_id, count(t2.photo_id) as matches from photo_tags t1 join photo_tags t2 on ( t1.tag = t2.tag and t1.photo_id != t2.photo_id ) join photos p on (t2.photo_id = p.photo_id) where t1.photo_id = << ID of photo >> group by t2.photo_id order by matches desc; That will return a list of photo IDs that have matching tags for the given photo ID, in descending order of number of matches. If you add a LIMIT clause to the end, you can retrieve the the top x matches. Obviously you can also extend the query to select more columns from the photos table..
-
Looks like you're using PDO. Check if ->errorInfo() contains an error that might explain the problem.
-
A database would be ideal yes, though not essential. As for procedure, do you mean in terms of the code / database structure needed or.. more about the logic behind it?
-
You could just use PuTTY to access the server's VI(M?) editor (assuming it's Linux). That's real easy to transport, heck it's even available as an iPhone app now!