-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
I thought that at first Thorpe, but based on his original question it looked like he was dealing with a string. After the comment about getting back to the parent album though I'm not sure..?
-
If this is something you'll be using several times, you may want to consider creating a function in combination with parse_url to return parameters in the query string. There's an example in a comment on the PHP manual.. Or if this is just a one-off case you could use preg_match: $url = 'http://domain.com/gallery/?album=3&gallery=65'; if (preg_match('/album\=([^&$]+)/', $url, $matches)) { echo $matches[1]; }
-
FYI there is actually the Image.complete property, that stores a boolean value of whether the browser has loaded the image.
-
The SQL is wrong. Should be something like: $sql = " select * from feed as genreport where `date` between '{$start}' and '{$end}' ";
-
If you read the article I posted you'd know.
-
+7 what?
-
You're defining part of the image tag within the array, and then again within the document.write calls:
-
First off, it's much easier to define an array in JS like: var KW_ARI = [ '<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>', '<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>', '<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>', '<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>', '<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>' ]; (Remove "KW_ARI= new Array()" too) Secondly, what extra garbage?
-
First and foremost I'd look at how to structure a HTML document correctly. You have no doctype, opening <html> tag, <head> section, or <body> section. These are the basic requirements for a HTML web page.
-
How to automatically reload main page after redirected back to it
Adam replied to geekisthenewsexy's topic in Javascript Help
Personally I'd just display the confirmation on the page you're redirecting them to. If you're after a nice little effect for it too, you could use jQuery to fadeOut() the element, or some other effect. -
I don't think you'd need a large blob for an image, it's limit's about 4gig... But anyway, that's a little unusual. Can you show us what a print_r() shows the array contains? I'm thinking you may have a problem INSERTING the record, as apposed to retrieving it. If you check the data in a database administrator like PHPMyAdmin, do you see valid names?
-
readdir returns the file name, not including the file path. Therefore $file alone doesn't exist. You'd need to use: 'temp_photo/' . $file .. glob I reckon would be better here though (as it does return the path): foreach (glob('./temp_photo/*') as $file) { $filelastmodified = filemtime($file); if(($filelastmodified-time()) > 24*3600) { unlink($file); } } Not tested but should work.
-
True enough, but maybe liamloveslearning about oranges..?
-
Why are you trying to use JavaScript for this? PHP would handle this far more efficiently, and would work for every user: <input type="hidden" name="page" id="page" value="<?php echo $_SERVER['PHP_SELF']; ?>"> FYI The reason why your code wouldn't work is because JS needs to be surrounded by <script> tags, and anything within an input's value will be treated as a string.
-
Try: $sql = "UPDATE c_applicants SET streetz='" . $cts . "' WHERE username = '" . $SomeVar . "'"; $query = mysql_query($sql) or trigger_error('MySQL Error: ' . mysql_error(), E_USER_ERROR); Also remove the second mysql_query() call. If you don't get any errors, echo out $sql and make sure the values are valid. If they appear valid, it's still possible they're incorrect.. which you can verify with mysql_affected_rows, or by running the SQL in a MySQL administrator (i.e. PHPMyAdmin) to find the number of rows affected.
-
I provided a link to the MySQL manual for it in my post. Although it's incredibly easy to use: select * from table order by rand() limit 10;
-
You want to use 'order by rand()' for this. There's no point in returning every row within the database, loop through and store in an array, and then randomly sort that.. to do something you could do with a simple order by statement in the query.
-
Solid teeth / ability to give yourself a blow job; they're the same.. Best not mixed of course.
-
How to automatically reload main page after redirected back to it
Adam replied to geekisthenewsexy's topic in Javascript Help
I didn't mean specifically the same action, but rather re-thinking the flow of the application to not require a reload after 5 seconds. JavaScript like that can be really annoying from a user's point of view. Firstly; why is it you need to reload the page after 5 seconds? -
As salathe said, you cannot pass a string in that format to the JavaScript object. Try: var date1 = new Date(2010, 9, 18); var date2 = new Date(2010, 10, 1);
-
You can use mysql_result, but I'd recommend not using "*" if you only need one field.
-
It's easier to use single quotes when echoing HTML. That way you don't have to escape each attribute's opening and closing quote with a blackslash: echo '<td style="background-color:#fff" onMouseover="this.style.backgroundColor=\'#ff9900\';" onMouseout="this.style.backgroundColor=\'#fff\';">'; Of course in your situation you do actually use single quotes, but normally it would be easier.
-
... OR .. of course the best solution would be to not echo out HTML at all: Title:<br /> <input type="text" name="title" value="<?php echo $row['Title']; ?>" />
-
OR a better solution is to use single quotes and use the dot operator to concatenate variables: echo 'Title:<br>'; echo '<input type="text" name="title" value="' . $row['Title'] . '" />';