Jump to content

grantp22

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

grantp22's Achievements

Member

Member (2/5)

0

Reputation

  1. fenway, thanks, that worked! I know this is not the ideal solution because the query takes longer, but I guess it's going to have to do for now!
  2. Thanks, I'll give that a try!
  3. Hi fenway I figured this was going to be problematic, and my sql is not that hot! The original designer of the website I am upgrading is using the same database for other functionallity, I have been asked to make additions to the website ie: more pages connecting to his db. He no longer works for the company and I have been asked to expand the website. And now I am forced to use these string based fields because the old pages rely on these fields being strings, and I need them to be date based for my additonal pages and now I have run into this problem where I can't change the old page script to date based values because there are so many changes I would need to make. So now I am stuck trying to adapt my own source to accept his old string based db values. I have been trying to figure this out for hours now and even visiting the mysql forums to try and put together a solution. So any ideas you may have will be greatly appreciated at this point no matter how good or bad they are, I getting desperate! Thanks Grant
  4. Can anybody help out with the following mysql query, I want to order a field by month, but the field values in the database contains the year as well! Like this eg: +--------------------+--------+---------+ | strMonth | event | place | +--------------------+--------+---------+ |February 2011 | ...... | ....... | |August 2010 | ...... | ....... | |September 2010| ...... | ....... | |January 2011 | ...... | ....... | |October 2010 | ...... | ....... | |November 2010 | ...... | ....... | |December 2010 | ...... | ....... | This is what I would like to achieve: +--------------------+--------+---------+ | strMonth | event | place | +--------------------+--------+---------+ |August 2010 | ...... | ....... | |September 2010| ...... | ....... | |October 2010 | ...... | ....... | |November 2010 | ...... | ....... | |December 2010 | ...... | ....... | |January 2011 | ...... | ....... | |February 2011 | ...... | ....... | I could do it like this below if it was just the month, but it will include the year and the year portion can range from 2008 to 2015: SELECT * from myTable order by field(strMonth, 'August', 'September', 'October') asc, strMonth LEFT(strMonth, LENGTH(strMonth)-5) //which should give you eg: August So i thought I could do this: order by field(LEFT(strMonth, LENGTH(strMonth)-5), 'August', 'September', 'October') asc, strMonth But I am sure this will give me: +--------------------+--------+---------+ | strMonth | event | place | +--------------------+--------+---------+ |January 2011 | ...... | ....... | |February 2011 | ...... | ....... | |August 2010 | ...... | ....... | |September 2010| ...... | ....... | |October 2010 | ...... | ....... | |November 2010 | ...... | ....... | |December 2010 | ...... | ....... | I just cant figure out how the get them ordered by month and then order by year Can any body help me out with this problem Thanks Grant
  5. I agree, in this example you would need to reset $col, but for my code, these two loops are actually inside another loop which I never included just to simplify things! Thanks for the help Barend!
  6. Hi, I need some advice on how to go about allowing administrators with dev skills the ability to edit my existing templates I have created for them by logging into the backend and editing the pages online or even adding their own custom templates and switching them! I can write the script for doing this by allowing them to write files to a folder that has permissions and simply allowing them to set a new path to that file which will get loaded into the main template via database array variables in place of static include paths! My template could have the following script to include their templates: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Custom templates</title> </head> <body bgcolor="#001e00"> <div class="container"> <?php // This will be where the header gets inserted include('thenewtemplate.php'); ?> <div class="main"> // someother static divs with contents in here </div> <?php // This will be where the footer gets inserted include('thenewtemplate.php'); ?> etc, etc... So my question is what would be the best approach, because obviously allowing permissions to write to templates or create new ones with potentially dangerous scripts can obviously be witten out to the template to be loaded later, if an unauthorised person ever managed to get access to my backend The backend is pretty secure but I wouldn't stake my life on it either! I would like to have a textarea where they could type in the new template source code and then save it out to a text file or some other file format to be loaded into the main template. I want them to be able to change the header div contents, footer and right column div to create their own unique looks Does anybody have any advice on this! Good or bad? Thanks Grant
  7. I just noticed I forgot to add a counter: use like this: <?php // $rss=simplexml_load_file("http://www.somesite.com/rss/yourtarget.xml");// can also be yourtarget.rss // $i=0; foreach($rss->channel->item as $post){ //create multi-dimentional array to hold element values $myarray[$i] = array( "Url" => $post->link, "Title" => $post->title, "Description" => $post->description, ); $i++; } ?>
  8. I know, but who is really going to go to each proxy service and request your ip, if they even give it out in the first place, because they guarentee anonymity. Lets just say this makes it more difficult for anyone wanting to know where the page requests are coming from. My reason for this is to remain anonymous, no malicious intents! Thanks for pointer
  9. Mr Adams, I can if I go through a proxy and the reason for spoofing is that I don't want my servers details being recorded period!
  10. You can use it like this: <?php // $rss=simplexml_load_file("http://www.somesite.com/rss/yourtarget.xml");// can also be yourtarget.rss // foreach($rss->channel->item as $post){ //create multi-dimentional array to hold element values $myarray[0] = array( "Url" => $post->link, "Title" => $post->title, "Description" => $post->description, ); } ?> Call it as follows: echo $myarray[0]['Url']; or put into an element like this: <td><?php echo $myarray[0]['Url']; ?></td> Hope this helps
  11. Hi MrAdam or anybody else who can help, I am basicly scanning table data on another website, it is working perfectly using simple_html_dom as seen in the simplified example below! include('simple_html_dom.php'); // $startpoint=1;//this allows you to pick the td to start at $endpoint=20;//this allows you to pick the td to end at // $i=1; $mycount=1; // $html = file_get_html('http://www.somewebsite.com/tabledata); foreach($html->find('tr') as $tr) { if($i >= $startpoint && $i <= $endpoint){ foreach($tr->find('td.datacell') as $td){ $val1 = 'val1_' . ($i-$startpoint); $val2 = 'val2_' . $mycount; $myarray[$val1][$val2] = $td->innertext; if($mycount==10){ $mycount=1; }else{ $mycount++; } } } $i++; } // $newcount = newcount($myarray); // $i = 1; //Add table rows and cells while($i <= $count) { echo '<tr>'; echo '<td>'.$myarray['val1_'.$i]['val2_1'].'</td>'; echo '<td>'.$myarray['val1_'.$i]['val2_2'].'</td>'; echo '<td>'.$myarray['val1_'.$i]['val2_3'].'</td>'; echo '</tr>'; } Now I need an example of how to change my code using curl to hide my server details and make it appear as though the request is being made from the users machine or some other random details. I knew that curl was the answer, and I have never used it before, and also it's just there is not much info about using these functions to do this. Can anybody tell me how to do this or at least point me to a tutorial of some kind Thanks
  12. I have script on my web hosts server built into pages that will be offered to the public, eg: index.php will have some script amongst the html, this script calls other webpages on the net eg: wiki.org Now my question is, when that script runs when somebody accesses that page, will the website eg: wiki.org record the users browser info and ip who called my index page or will it record the webhosts server details as the one making the requests?
  13. Thanks Barand, I have already been made aware of this a few minutes ago on another forum, I can't believe I missed that! It's normally one of the first things I check...
  14. Thanks for the suggestion DavidAM, You would expect that to work, right, but it doesn't! Below is a variation of your solution, and it too doesn't work, nothing gets echoed, just a blank screen! <?php $n = array(1 => "aa", 2 => "ab", 3 => "ac", 4 => "ad", 5 => "ae", 6 => "af", 7 => "ag", 8 => "ah", 9 => "aj", 10 => "ak"); $row = 1; $col = 1; while($row<=10) { while($col<=10) { $key = 'col_' . $col; $sm_array[$row][$key] = $n[$col]; $col++; } $row++; } echo sm_array[1]['col_1']; ?> Does anybody have any ideas why this is not working?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.