premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
SELECT * FROM table_name WHERE column_name LIKE '%,1,%' Should do that for you.
-
$video_data = get_info($url); print_r(get_flv($video_data)); Or: print_r(get_flv(get_info($url))); Either should work.
-
Well with checkboxes, if the item is not checked it is not going to be in the POST data. Is one of the checkboxes checked? To avoid the notice error you can do this: $testbox = isset($_POST['testbox'])?$_POST['testbox']:null; Which will set textbox to null if no items were checked.
-
<<?php $items = <<<ITEM // First Item <td><img src="http://services.runescape.com/m=itemdb_rs/3016_obj_sprite.gif?id=5354" alt="Plant pot"></td> //Contains the item id and the name <td><a href="http://services.runescape.com/m=itemdb_rs/Plant_pot/viewitem.ws?obj=5354"> Plant pot</a></td> //Contains the link to more specific information on the item <td>199</td> //Contains the current price <td><span class="stay">0</span></td> //contains the change in price //Second Item <td><img src="http://services.runescape.com/m=itemdb_rs/3016_obj_sprite.gif?id=4440" alt="Pot lid"></td> //Contains the item id and the name <td><a href="http://services.runescape.com/m=itemdb_rs/Pot_lid/viewitem.ws?obj=4440"> Pot lid</a></td> //Contains the link to more specific information on the item <td>9</td> //Contains the current price <td><span class="stay">0</span></td> //contains the change in price ITEM; preg_match_all('~<td><a href="(.*)">(.*)</a></td>~iU', $items, $pot_matches); preg_match_all('~<td>([0-9]+)</td>~', $items, $price_matches); preg_match_all('~<td><span class="stay">([0-9]+)</span></td>~', $items, $change_matches); $cnt = count($pot_matches[1]); $display = ""; for ($i=0; $i<$cnt; $i++) { $id_match = array(); // grab the id from the url preg_match('~([0-9]+)$~', $pot_matches[1][$i], $id_match); $display .= "Id: " . $id_match[1] . "\n"; $display .= "Pot: " . $pot_matches[2][$i] . "\n"; $display .= "URL: " . $pot_matches[1][$i] . "\n"; $display .= "Price: " . $price_matches[1][$i] . "\n"; $display .= "Change: " . $change_matches[1][$i] . "\n\n"; } echo $display; /**** Output: Id: 5354 Pot: Plant pot URL: http://services.runescape.com/m=itemdb_rs/Plant_pot/viewitem.ws?obj=5354 Price: 199 Change: 0 Id: 4440 Pot: Pot lid URL: http://services.runescape.com/m=itemdb_rs/Pot_lid/viewitem.ws?obj=4440 Price: 9 Change: 0 *****/ ?> Should work as long as it stays constant. You can access the items via array indexes (as they should also stay consistent). May not be the best way to do it, but they do "work". (as I am not a regex expert).
-
$client_result = mysql_query($check_sql) or trigger_error("Query Failed: " . mysql_error()); Use that and see what error the mysql statement is throwing.
-
You do not need to do spaces after, IE: $array ['index'] Is generally looked down upon. $array['index'] Is the "preferred" way by most coders. Not sure where you got the idea to space between them. But show the full relevant code, specifically where the notice error is thrown, so we can help you.
-
$checkBoxes = array("c", "f", "bb"); // etc foreach ($checkBoxes as $key) { if (isset($_POST[$key]) && $_POST[$key] == "true") { array_push($key, ucwords($key)); } } // iterations One way to shorten it. You also do not need "else {}" after every if statement. It is not a required piece.
-
Take a look at this tutorial: http://www.phpfreaks.com/tutorial/basic-pagination It goes over the basics of pagination, which is what you are trying to do.
-
name="testbox [veg]" Notice the space before [veg]. That is why the testbox has a space in it. name="testbox[veg]" Will solve that issue.
-
You sure can. Just google, "version of linux svn install" where version of linux is the version your box hosts. If it is debian based a simple "aptitude install svn svn-admin" should get you the SVN installed, the svn-admin tool is how you will create the svn repositories. But yes, there is ample amounts of information on how to do this through google. Try googling it.
-
Those two statements just made my day. Thank you.
-
What's the best platform for an internet magazine?
premiso replied to vinnier's topic in Miscellaneous
I am not sure if you have looked, but Wordpress has some "magazine" features / templates. Not sure if this would work or not, but may be something to look into since wordpress is sort of focused as a "news / blogger" cms system. -
No clue. Never used the SOAP client. You can try this: $query2 = ' Select ' . 'a.BodyLength,' . 'a.ContentType,' . 'a.CreatedById,' . 'a.Name,' . 'a.ParentId,' . 'a.SystemModstamp,' . 'n.CreatedById,' . 'n.CreatedDate,' . 'n.OwnerId,' . 'n.ParentId,' . 'n.SystemModstamp,' . 'n.Title' . " from Attachment a, Note n WHERE n.ParentId = a.ParentId AND a.ParentId = " . $where;
-
That is because the session cookies lifetime (<-- link) is being set to 0, which is default and means that the session expires when the browser close. To fix this you will have to change that value to be the lifetime you want the session cookie to last. I cannot remember what the variable names are, but should be easily found with google or even at the php manual for sessions
-
$query2 = ' Select ' . 'a.BodyLength,' . 'a.ContentType,' . 'a.CreatedById,' . 'a.Name,' . 'a.ParentId,' . 'a.SystemModstamp,' . 'n.CreatedById,' . 'n.CreatedDate,' . 'n.OwnerId,' . 'n.ParentId,' . 'n.SystemModstamp,' . 'n.Title' . " from Attachment a JOIN Note n ON n.ParentId = a.ParentId WHERE ParentId = " . $where;
-
<?php mysql_connect (***Host***, ****Database Username***, *****Pass****) or trigger_error('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("db_name"); ?>
-
Just setup your "chat" fetching script for when a user logs in to not pull anychats before that time.
-
Can i somhow limit the function by definition?
premiso replied to sangoku's topic in PHP Coding Help
As far as I know this should also work: function (int $i) And it will do the check for you. If a non-int is passed in it should throw a warning or an exception. Only way to find out is to try it out -
Well it all depends on what the function does. Does it echo or return the statement as a value? Given that it does not have an echo preceding it, I am taking that it echos. And because of this you would either need to use output buffering, change the function to return a value, or add a parameter to tell it to echo it without line breaks. (via an if statement).
-
That and unsupress the error message when loading html data. That will probably give you a better understanding of the real error: @$dom -> loadHTMLFile($data); //TO: $dom -> loadHTMLFile($data); And see what feedback it gives you.
-
http://www.slunked.com/blog/php/2010/01/how-to-fix-header-already-sent-error-in-php Check out that blog post. Should help you understand and fix the error.
-
You can always set the php limits. But I would build it to work with CRON / PHP CLI either way, especially if you want it automated. That way you can set the php CLI php.ini with the upper limits and not have your website adversely effected.
-
You can setup your own personal computer to run a cron job or scheduled task that calls a webpage which will run the code you need to. Other then that, not sure if there is.
-
What fields specifically are you trying to pull out from those three examples?