PHP - Simple, But Need It Done Quick
Hi I need someone to fix a bug I have and to "speed up" the loading of the image by having the firs x number of images load first then loading more after they finish.
The bug should be easy to fix as I have a working copy of the page minus the change I made. The problem is since I updated to code the other part wont work (
contact me for more details and let me know you how much you would charge.
Thanks,
.
Similar TutorialsHow do i display an image from my directory?!? :S I don't mean to be lazy and just ask people on here, I have researched it online but can't seem to find a quick simple answer. Thanks People!! I have a quick question to ask, as i cant see it in their docs. Maybe you can help me. I am using http://simplehtmldom.sourceforge.net/ Right, i have written a Simple HTML Dom script to collect data from this page, as an example: http://www.visualdesign.ie/_dev/myscraper/simplehtmldom/dev-env/scraping/daily/daily.html Script executed by running a cron job on this file (which generates the XML): http://www.visualdesign.ie/_dev/myscraper/simplehtmldom/dev-env/scraping/daily/daily.php The data is collected, and written to this file in XML file: http://www.visualdesign.ie/_dev/myscraper/simplehtmldom/dev-env/scraping/daily/daily.xml Thats is fine, and the script essentially scrapes the entire page, with no conditional IF's for any sections. A sample of my code for one segment is below: http://pastebin.com/JLb8f92N What i would like to do now, and i am hoping you could help out is... Scrap this same page, but produce seperate XML files, based on the date. So if you view that page, i want to scrape the data in the table Saturday 4th February 2012 and produce XML for for that day only. The i want to scrape the data in the section for Sunday 5th February 2012, and another for Tuesday 7th February 2012. I think its self explanatory. The table date sections are separated by this HTML element: bg color = " #CCCCCC " But bare in mind that the table rows on each date section will change when the site is updated, and there may be additional or less football game records. Anyway, i would appreciate any help you can show me, on how to place in any conditionals in the code, and only scrape the date sections needed. Separate script files would be fine if it was needed. Many thanks for your time, Darren. Hey guys, Why exactly do people use multiplication when calculating time? Like when setting cookies, timeouts or something that requires second-based definitions. For example, some do: Code: [Select] $thirty_days = time()+60*60*24*30; As opposed to what I do: Code: [Select] $thirty_days = time()+2592000; Why do they do that? Does it help them calculate it without a calculator? Make it easier to manage/adjust in the future? Personal preference? These are the only possible explanations I can think of. This has been bugging me for a while...am I doing something wrong? Hi everyone, I'm trying to select either a class or an id using PHP Simple HTML DOM Parser with absolutely no luck. My example is very simple and seems to comply to the examples given in the manual(http://simplehtmldom.sourceforge.net/manual.htm) but it just wont work, it's driving me up the wall. Here is my example: http://schulnetz.nibis.de/db/schulen/schule.php?schulnr=94468&lschb= I think the HTML is invalid: i cannot parse it. Well i need more examples - probly i have overseen something! If anybody has a working example of Simple-html-dom-parser...i would be happy. The examples on the developersite are not very helpful. your dilbertone what does Code: [Select] WHERE p.pid IN(0,4561,0) mean? I know it's lokoing for DATA FROM p.pid = 4561, but WHAT THE HELL DOES THE 0, ,0 mean? Thanks i need some quick help, this project has been way over due and ive wasted huge amounts of time researching on my own and bothering others trying to figure this out and i just cant leave it be its like a damn drug. im desperate folks! my 2 tables, movies: id - title - category - url categories: id - category (FK) what im trying to do is have every category list as a table and then list the movies owned by that category in them, example: Category 1 --------------- title title Category 2 -------------- title title Category 3 -------------- title title the code im using is Code: [Select] <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mydb", $con); $result = mysql_query("SELECT a.ID, a.Title, b.Category, a.URL FROM Movies AS a JOIN Categories b ON a.Category = b.ID ORDER BY b.Category"); echo "<table border='1'> <tr> <th>Title</th> <th>Category</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td width='100'><a href='".$row['URL']."'>" . $row['Title'] . "</a></td>"; echo "<td width='150'>" . $row['Category'] . "</td>"; } echo "</table>"; $result2 = mysql_query("SELECT ID,Category FROM Categories"); while($row2 = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row2['Title'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> but obviously this code gives me a single table that lists all the titles with category next to them and then under the table it lists my categorys from left to right and its looks like Title Category --------------------- title1 Drama title2 Comedy title3 Horror title4 Thriller -------------------- DramaComedyHorrorThriller what exactly do i need to change to display the results i want ? btw dont hammer me on using 2 while loops, some tell me i need 2 and others say 2 is pointless. i myself have no clue! I've made my first object that will addition an array but it doens't seem to be working as it echo's out 0. here is my script <?php class A { public $sum = 0; function addition($values){ foreach ($values as $numbers){ $this->sum = $number + $this->sum; } echo $this->sum; } } $a = new A(); $array = array(10, 15, 25); echo $a->addition($array); ?> I don't see what I'm doing wrong. Any direction would be greatly appreciated. Hi! I want to be able to create a dynamic tournament bracket but not sure where to get started, right now all the template brackets have been hardcoded, i.e. http://teamx1.com/templates/64.html Can you someone put me in the right direction by using PHP to create and write this file? I want to be able to create 64 + brackets but hardcoding is a huge headache and mistakes easily done. Thanks all. Hi everyone, In the DB, I store dates as date("Y-m-d H:i:s") so it reads "2010-10-25 23:16:06" In a SQL query, I want to query all 2010 dates. I tried, WHERE date_created = '".date("Y")."', but no luck. What goes where date("Y") is? Thanks I am starting to learn PDO by re-writing one of my existing scripts. Do I still need to validate $_GET or does PDO do the work for me? Currently I am using: Code: [Select] $id = $_GET['id']; $sth = $dbh->prepare('DELETE FROM van_reservations WHERE id = :id'); $sth->bindParam(':id', $id, PDO::PARAM_INT); $sth->execute(); I used to validate by using this: Code: [Select] $id = isset($_GET['id']) && is_numeric($_GET['id'])?(int) $_GET['id']:0; Is there a way to only output the first, say, 30 words of a variable? I have a way to do it in mind, but seems like it's messy and not practical. Any suggestions? E.g: WITHOUT LIMIT: Welcome to my store. Would you like to buy something? We have really good noodles and fishes in doodle pools. WITH LIMIT: Welcome to my store. Would you like... Sort of like a short preview. Does storing multiple values in 1 database field with a varchar let's say set at 150, all separated by "|'s" so I don't have to create a field name for each one is it better performance wise or no? (storing 6-7 different |'s that will be outputted with a array ofc) ? What is the difference between these two lines Code: [Select] !isset($_POST[$requiredField]) and Code: [Select] !$_POST[$requiredField] Hi all, I my hunt for better coding i thought i look at some opensource CMS systems and one thing I saw in the index.php of the joomla cms was this. define('JPATH_BASE', dirname(__FILE__) ); define( 'DS', DIRECTORY_SEPARATOR ); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); Are they using DS to make it work on any platform instead of using a / or a \ ? Also they define JPATH_BASE, now they use dirname(__FILE__) for this. I read that __FILE__ tells from where the script is running. But in that same guide they gave as example dirname(dirname((__FILE__)) instead of only 1 time dirname() That was this website btw: http://www.phpguru.org/php-application-structure can anyone tell why i would use dirname 2 times and not 1 or 3 or 4? -edit: OK that last question don't needs an answer, i just put loads of dirname() around it and it seems it's moving up in the file system. Leaves my first still open code <?php //storecodefound.php v1.0 //purpose is to store the http refer and the code associated with the site to a db to be collected and verified by submitcode.php $code = $_GET['code']; $site = $_SERVER['HTTP_HOST']; //check to see if the code already present $connect = mysql_connect("localhost","root","") or die (mysql_error()); $check = mysql_query("SELECT code FROM hunter.codes WHERE code='$code'") or die (mysql_error()); $row = mysql_num_rows($check); echo "result of \$row is ".$row; echo "<br />"; if ($row = 0) { //insert into db cause it's not there mysql_query("INSERT INTO hunter.codes (id, code, site) VALUES ('','$code','$site')") or die (mysql_error()); } else { //echo it's already here echo "Code already found on server!"; } ?> my question is the result of $row is infact 0 and the if statement says if $row is 0 to insert into db and instead it's given me the code is already found? hey! I have a site where I want to use multiple issets at the same time, like if I have four buttons and four issets: if(isset($_POST['one'])) { echo '<div class="example_box">one</div>'; } if(isset($_POST['two'])) { echo '<div class="example_box">two</div>'; } if(isset($_POST['three'])) { echo '<div class="example_box">three</div>'; } if(isset($_POST['four'])) { echo '<div class="example_box">four</div>'; } but for some reason it seems like only one isset can be activate at a time, is there any way to work this out or something :s? I've tried some variants of elseif stuff and such, but yeah, I'm pretty new at this stuff Which is better, option 1 or option 2?
Option 1:
$updated = "n";
if ($v1 == "y") {
Do something with $v1;
$udpated = "y";
}
if ($v2 == "y") {
Do something with $v2;
$updated = "y"
}
OR Option 2:
if ($v1 == "y" && $v2 == "y") {
Do something with $v1 and $v2;
$updated = "y";
} elseif ($v1 == "y" && $v2 == "n") {
Do something with $v1, but not $v2;
$updated = "y";
} elseif ($v1 == "n" && $v2 == "y") {
Do something with $v2, but not $v1;
$updated = "y";
} elseif ($v1 == "n" && $v2 == "n") {
Don't do anything with $v1 or $v2;
$updated = "n";
}
I've used both methods, and they both work, but I'm not sure which one is the best to use. Does if even really matter? Thanks for your opinion.
Hi, I've seen code like this multiple times, but I don't really know what it means. function funcName(&$something) { // whatever } What exactly does the "&" do before the variable? hi. when i get into some function manual and there is a note says. Quote This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. . is that meaning that after 5.3.0 version this function will not be supported? thanks , Mor. how to open a site with curl that has frames ? when ive tried it gives "your broswer does not support frames" ... |