Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. For those not knowing about this, is a new security hole found in all linux/unix based operating systems that should be patched. http://arstechnica.com/security/2014/09/bug-in-bash-shell-creates-big-security-hole-on-anything-with-nix-in-it/
  2. I included the letter that first sold the item $count_position = $count_position + 1; If you want from the letter below it and onwards, just comment out that line.
  3. I would have to say yes on that, is like reading a book without knowing the meanings of the words. I would suggest Symfony or Laravel as frameworks though.
  4. I was interested in this so made a function that produces an array of the tier levels, refer letter, amount remaining each tier after commission deducted, percentage used and commission price Maybe not exactly what you were looking for with your current code, but something you should consider versus trying to keep adding more tiers. If it's something different than you expect, are welcome to modify it. Was interesting to create either way. <?php function referPosition($refer_letter, $amount, $percentage) { //check all parameters exist if (!$refer_letter || !$amount || !$percentage) { return NULL; } //create alphabet array $alphabet = range('a', 'z'); //letter check $refer_letter = strtolower(trim($refer_letter)); if ($refer_letter == '' || !in_array($refer_letter, $alphabet)) { return NULL; } //amount check $amount = str_replace(array( "$", "," ), array( "", "" ), $amount); $amount = number_format($amount, 2, '.', ''); if (trim($amount) <= 0 || !is_numeric($amount)) { return NULL; } //percentage check $percentage = str_replace("%", "", $percentage); if (trim($percentage) <= 0 || !is_numeric($percentage)) { return NULL; } //find array key position of the letter in array, slice it, reverse it $find_key = array_search($refer_letter, $alphabet); $count_position = array_search($find_key, array_keys($alphabet)); //add 1 to count position $count_position = $count_position + 1; $refer_array = array_slice($alphabet, 0, $count_position); $refer_array = array_reverse($refer_array); //loop remaining letters in array and calculate amounts by percentages $commission_array = array(); $deduct = 0; foreach ($refer_array as $key => $value) { $amount = $amount - $deduct; $amount = number_format($amount, 2, '.', ''); $deduct = ($percentage / 100) * $amount; $deduct = number_format($deduct, 2); $tier = $key + 1; $pretty_amount = number_format($amount, 2, '.', ''); //build an array $commission_array[] = array( "tier" => $tier, "letter" => $value, "amount" => $pretty_amount, "percentage" => $percentage, "commission" => $deduct ); //simple single array letter as key and commision_value //$commission_array[$value] = number_format($deduct, 2); } return $commission_array; } /* Usage arguments: letter: works letters a-z upper and lower amount: $ or not, comma or not percentage: % or not all 3 function arguments required or returns null if any arguments do not meet expectations, returns null */ //$payments = referPosition("a", "100", "25%"); //$payments = referPosition("b","$40,000.23","1.5"); //$payments = referPosition("c","$35","5.5"); $payments = referPosition("d","350.20","10%");//letter,amount,percentage //show the array if commission is due if (is_array($payments)) { echo "<pre>"; print_r($payments); echo "</pre>"; } else { echo $payments = 0; } ?> This example returns: Array ( [0] => Array ( [tier] => 1 [letter] => d [amount] => 350.20 [percentage] => 10 [commission] => 35.02 ) [1] => Array ( [tier] => 2 [letter] => c [amount] => 315.18 [percentage] => 10 [commission] => 31.52 ) [2] => Array ( [tier] => 3 [letter] => b [amount] => 283.66 [percentage] => 10 [commission] => 28.37 ) [3] => Array ( [tier] => 4 [letter] => a [amount] => 255.29 [percentage] => 10 [commission] => 25.53 ) )
  5. You only need to make one connection to the database for all.
  6. You can try AddType application/x-httpd-php52 .html .htm .php AddHandler application/x-httpd-php52 .html .htm .php if for some reason they are using the Suhosin patch AddType application/x-httpd-php52s .html .htm .php AddHandler application/x-httpd-php52s .html .htm .php
  7. Can there be an auto remove oldest message from mailbox so can always get new. I see the max is 50, kinda sucks to delete manually to make room for more. Can't you just limit these to 49 by always removing the oldest one? To ensure can get any new messages.
  8. action="../login.php" is where it goes once the form is submitted. You will need to change the redirect location in login.php to the home page instead of myaccount.php if that's where you want to go.
  9. I switched it around a little, am pretty sure this is what you wanted. I added the first <div> to the form <?php if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true){ ?> <div> <form action="../login.php" method="post" accept-charset="UTF-8" class="middletext" onsubmit="javascript:this.style.display='none';"> <p> <input type="text" size="20" name="user_name_login" id="user_name_login" value="ENTER USERNAME" style="color:#D9D9D9" style="vertical-align:middle"; onfocus="if (this.value=='ENTER USERNAME') {this.value=''; this.style.color='#696969';}" > <input type="text" size="20" name="password_login" id="password_login" value="ENTER PASSWORD" style="color:#D9D9D9" style="vertical-align:middle"; onfocus="if (this.value=='ENTER PASSWORD') {this.value=''; this.style.color='#696969';}" > <input type="hidden" name="cookie_time" value="10080" /> <img src="../themes/default/images/arrow-red.png" alt="" /><input type="submit" style="outline:grey" font-size="5px" value="[var.lang_login_now]" class="button-form2" /> <input type="hidden" name="submitted" value="yes" /> <input type="hidden" name="remember_me" value="remember_me" /> </p> </form> </div> <?php } else { ?> </div> <!--Begin Sub-Navigation. This only appears when a user is logged in.--> <div class="container1"> <div class="menu1"> <div class="sub-nav"><a href="../index.php"></a> <img src="../themes/default/images/arrow-red.jpg" style="vertical-align:middle" alt="" /><a href="../members/[var.user_name]"> my account</a><img src="../themes/default/images/arrow- red.jpg" style="vertical-align:middle" alt="" /> <a href="../credits.php">[var.lang_my_credits]: [var.member_credits]</font></a><img src="../themes/default/images/arrow-red.jpg" style="vertical-align:middle"><a href="../logout.php">[var.login_out]</a> <!--[onload;block=div;when [var.loggedin]=1;comm]--> </div> <?php } ?>
  10. Another thing, using wildcard * to select items in a query insead of: $query-"SELECT * FROM MyTable WHERE id='" . mysql_real_escape_string($get_result) . "'"; can just grab only what you need $query-"SELECT id,title FROM MyTable WHERE id='" . mysql_real_escape_string($get_result) . "'";
  11. For better assistance please paste your chunks of code in the code tags here versus an image cyberRobot already showed you how to create the hyperlink To use a $_GET in a query: //check if result exists in url and is not blank if(isset($_GET['result']) && trim($_GET['result']) != ''){ $get_result = trim($_GET['result']);//use the trimmed result and create a variable $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } $query-"SELECT * FROM MyTable WHERE id='" . mysql_real_escape_string($get_result) . "'"; $resource = mysql_query($query,$link); if(!$resource){ die('Could not get data: ' . mysql_error()); } echo "<table class='sortable' align='center' border='0' width='100%'>"; while($result=mysql_fetch_assoc($resource)){ $id = $result['id']; //$title = $result['title']; echo "<tr><img align='center' src='http://covers.openlibrary.org/b/isbn/".$id."-L.jpg'/></tr>"; } echo "<tr><td> </td></tr></table>"; mysql_close($link); } else { //show an error, redirect, anything you desire die('result is not set in url'); } Some beginner advice for you or anyone else reading this: always try to remove any whitespace trim() trim an array $array = array_map('trim', $array); or foreach($array as $key => $val){ $array[$key] = trim($val); } mysql_* functions are deprecated, you should use PDO or mysqli_* functions if is a certain type of data you expect check for that all numbers ctype_digit() all numbers including decimals is_numeric() alphanumeric character ctype_alnum() so on I will refer to the mysqli counterpart functions, mysql and mysqli don't mix mysqli_fetch_assoc() Returns an associative array that corresponds to the fetched row or NULL if there are no more rows. mysqli_fetch_row() Returns an array of strings that corresponds to the fetched row or NULL if there are no more rows in result set. mysqli_fetch_array() Returns an array that corresponds to the fetched row or NULL if there are no more rows for the result set represented by the result parameter. Note: mysqli_fetch_array() returns an array with both the contents of mysqli_fetch_row and mysqli_fetch_assoc merged into one. It will both have numeric and string keys. If do not need both sets, use mysqli_fetch_assoc() instead. Always filter,escape,sanitize anything before you insert into a database, make it exactly how you expect Validation filters Sanitize filters url functions and rawurldecode() mysqli_real_escape_string() htmlspecialchars() htmlentities() language encoding multibyte language encoding iconv setting database collation and character sets (I use utf8) Am sure I missed some things, these were the top of my head
  12. Leave the form action blank instead, no need to use $_SERVER['PHP_SELF'] there <form action='' method='post'>
  13. Because the colors are going to be dynamic throughout the site so I can't just save a .png of every color combination The idea would be to show images using your own script and setting values the way you need them to appear. I was showing how url parameters can manipulate the generated image. So your issue is how to make the bunny colors change without darkening the lighter sections as well? I believe you have to use a grayscale image and -modulate http://www.imagemagick.org/Usage/photos/#chroma_key Look at the shirt image examples You can also look at replace and fuzz To better explain using a single script using GET parameters you would post this image code and change the values wherever needed it. <img src="imagemagick.php?shading=10&color=blue"/> And in your php script making variables for each if(isset($_GET['shading']) && ctype_digit($_GET['shading'])){ $shading = $_GET['shading']; }else( $shading = "0"; } if(isset($_GET['color']) && trim($_GET['color']) !=''){ $color = trim($_GET['color']); }else( $color = "white"; }
  14. Add $_GET parameters to your url for your script so you can control any colors or shading strengths. As an example I'll show you my website snapshots using parameters and GD instead http://dynaindex.com/url-thumb.php?size=250&text=Dynaindex.com&textsize=8&textcolor=aqua&url=phpfreaks.com
  15. I'm not sure what your code looks like, no idea what you tried. I took the liberty to just place all the content of that page into a csv file, then a small script to make them into an array read-csv.php <?php $my_file = "inkshops.csv"; if (file_exists($my_file)) { $data = file($my_file); foreach ($data as $line) { $line = trim($line); $explode_line = explode("|",$line); $shop_name = trim($explode_line[0]); $address_one = trim($explode_line[1]); $address_two = trim($explode_line[2]); $phone = trim($explode_line[3]); //check if website exists if($explode_line[4]){ $website = trim(strtolower($explode_line[4])); }else{ $website = "NULL"; } $shop_array[] = array( "shop_name" => $shop_name, "address_one" => $address_one, "address_two" => $address_two, "phone" => $phone, "website" => $website ); } //show the new array echo '<pre>'; print_r($shop_array); echo '</pre>'; }else{ echo $my_file."not found"; } ?> inkshops.csv A-1 Port City Tattooing & Body|5775 Gunn Rd|Mobile AL 36619|(251) 591-0846 Abro Inkworks|540 Main St|E Rainsville AL 35986|(256) 638-8360 Aerochild Tattoos|914 23rd St|S Birmingham AL 35205|(205) 328-9215 Aerochild.Com|Against All Odds Tattoos|Auburn AL 36830|(334) 821-7214 Against All Odds Tattoos|1908 Opelika Rd|Auburn AL 36830|(334) 887-5566|Againstalloddstattoo.Com All The Rage Tattoo Studios|805 6th Ave|SE Decatur AL35601|(256) 355-5757 American Emporium|3939 Rucker Blvd|Enterprise AL 36330|(334) 308-2504 Art & Soul|1815 6th Ave SE # A|Decatur AL35601|(256) 580-3001 Artifacts Tattoos|300 Heflin Ave|E Birmingham AL 35214|(205) 639-1855 Artistic Addictions|500 S Quintard Ave|Anniston AL 36201|(256) 240-7075 Artistic Designs|904 Nuckolls St|Gadsden AL 35903|(256) 546-0996 Artistic Ink|12500 US Highway 431 # B|Guntersville AL 35976|(256) 582-2200|Artisticink.Com B & E Tattoo Co|1443 Montgomery Hwy|Dothan AL 36303|(334) 677-7454 Bama Tattoo|2601 Leeman Ferry Rd SW # B1|Huntsville AL 35801|(256) 715-1615 Bama Tattoo|1804 Lurleen B Wallace Blvd|Northport AL 35476|(205) 764-0741 Blackbeard’s Tattoo Parlour|137 14th St|SW Decatur AL 35601|(256) 351-7500 Blackbeard’s Tattoo Parlour|1295 George Wallace Hwy|Russellville AL 35654|(256) 332-6100 Blue Rose Tattoo|1402 Memorial Pkwy|NW Huntsville AL 35801|(256) 533-4400|Thebluerosetattoo.Com Body Language|2012 Woodward Ave|Muscle Shoals AL 35661|(256) 320-5742 Capitol City Tattoo|4127 Troy Hwy # C|Montgomery AL 36116|(334) 286-9070 Cloud Nine Permanent Cosmetics|1030 20th St|S Birmingham AL 35205|(205) 458-9998|Cloud9south.Com CMB Tatoos|6398 University Dr|NW Huntsville AL 35806|(256) 726-9800 CMB Two|11065 Highway 231 431 N # 6|Meridianville AL 35759|(256) 715-0502 Core|1351 Mcfarland Blvd|Tuscaloosa AL 35401|(205) 561-2351 Cynical Tattoos Shop|2205 Lurleen B Wallace Blvd|Northport AL 35476|(205) 330-1070 Cynicaltattoos.Net|David’s Gallery|East 809 Gulf Shores Pkwy|Gulf Shores AL 36542|(251) 948-7862 Davy’s Professional Tattoo|6101 University Blvd|E Cottondale AL 35453|(205) 469-9212 Deep South Tattoos|1357 County Road 437|Cullman AL 35055|(256) 734-8966 Devotion Tattoo|3804 Governors Dr|SW Huntsville AL 35805|(256) 519-3338 Down South Bdy Arts & Piercing|5563 Jackson Rd Mobile AL 36619|(251) 660-6678 Dragon Trax Tattoo Piercing|6415 Highway 90|Theodore AL 36582|(251) 423-7867|Dragontraxtattoos.Com Dream Land Skateboards|871 Cox Creek Pkwy|Florence AL 35630|(256) 766-2243 Eternal Art Tattoos|3380 Mcfarland Blvd # 3|Northport AL 35476|(205) 339-6112 Exit 13 Tattoo|1120 Shelton Beach Rd|Saraland AL 36571|(251) 675-1359 Flying Tiger Tattoo|1935 S College St|Auburn AL 36832|(334) 502-8822 Forbidden Images|121 W Crawford St|Dothan AL 36301|(334) 673-3554 Forever Ink|3226 Stillman Blvd|Tuscaloosa AL 35401|(205) 391-2171 Free Spirit Tattoos|13313 Highway|231 431 N Hazel|Green AL 35750|(256) 828-8939 Gulf Coast Tattoo Studio|7470 Theodore Dawes Rd|Theodore AL 36582|(251) 653-8063 Hole Truth|1009 S 4th St # C|Gadsden AL 35901|(256) 547-0100 Hot Rod Tat2|7914 Memorial Pkwy SW # A1|Huntsville AL 35802|(256) 489-2067 Images In Ink|US Highway 411|Odenville AL 35120|(205) 629-7638 Infinity Ink|1408 Pelham Rd|S Jacksonville AL 36265|(256) 782-1144 Ink City Tattoo|1029 6th Ave SE # B|Decatur AL 35601|(256) 306-9099 Ink City Tattoo|192 Putman Pkwy|Rogersville AL 35652|(256) 247-7740 Ink Factor|1665 E Main St|Prattville AL 36066|(334) 365-5545 Ink Factor2 LLC|105 N Burbank Dr|Montgomery AL 36117|(334) 356-2192 Ink Master Tatoo Inc|37135 US Highway 231 # 3|Ashville AL 35953|(205) 594-7305 Inked Addiction|253 8th Ave|Alexander City AL 35010|(256) 392-3330 Inkworx Tattoos|411 Jordan Ln NW # B|Huntsville AL 35805|(256) 217-0294 Jolly Kleen|1311 6th Ave|SE Decatur AL 35601|(256) 686-1410 Kaoz|330 S University Blvd|Mobile AL 36609|(251) 344-5343 Kreations Tattoos & Body Prcng|2022 Jordan Ln NW # E|Huntsville AL 35816|(256) 859-2545 L A Body Art By World Famous|221 1/2 Dauphin St # 12|Mobile AL 36602|(251) 423-0854|Myspace.Com/Tattoochattv LA Body Art|422 Dauphin Island Pkwy|Mobile AL 36606|(251) 476-0008 Mad Tatters Tattoo & Body|3009 S Broad St # A|Scottsboro AL 35769|(256) 259-3858 Madtown Tattoos|107 Arlington|Dr Madison AL 35758|(256) 774-8282 Magic Needle Tattoo|417 Jordan Ln|NW Huntsville AL 35805|(256) 830-0102 Master’s Hand Tattoos & Metal|1247 S Oates St|Dothan AL 36301|(334) 699-2306 Mr D Tattoo & Good Smoke Tyme|808 US Highway 431|Boaz AL 35957|(256) 840-9040 N V Upscale Body Art & Prcngs|1221 Blount Ave|Guntersville AL 35976|(256) 486-3472 No Regrets Tattoo Studio|4820 University Dr NW # 34|Huntsville AL 35816|(256) 489-8875 Non Stop Art Tattoo|213 20th St|N Birmingham AL 35203|(205) 251-1119 Nuwave Tattoo Design|4057 Moffett Rd|Mobile AL 36618|(251) 219-7522 Old School Ink|944 Sutton Bridge Rd # 4|Rainbow City AL 35906|(256) 442-5331 Oni Ink Tattoos & Piercing|2415 E South Blvd # M|Montgomery AL 36116|(334) 284-3999 Outlaw Custom Tattoo|1736 E Main St|Prattville AL 36066|(334) 365-8666 Outlaw Tattoo Co|430 Twain Curv|Montgomery AL 36117|(334) 215-8152 Plan B Tattoos|730 Mitchell Blvd|Florence AL 35630|(256) 275-3661 Port City Tattoo|205 Dauphin St|Mobile AL 36602|(251) 415-3366 Pulse|24912 US Highway 72|Athens AL 35613|(256) 233-4655|Thepulsetattoos.Com Randy’s Ink Spot Tattoo|3606 Highway 280|431 N Phenix City AL 36869|(334) 297-9117 Real Artist Tattoo Gallery|728 3rd Ave|W Birmingham AL 35204|(205) 202-4065 Revolution Ink|2961 Pelham Pkwy # 102|Pelham AL 35124|(205) 620-1350 Riverside Tattoo Studio|1763 Hamric Dr|E Oxford AL 36203|(256) 835-2705 Rocket City Tatoos|700 Pratt Ave NW # B3|Huntsville AL 35801|(256) 489-8282 Royal Street Tattoo|110 N Royal St|Mobile AL 36602|(251) 432-4772 Royal Street Tattoo|Eastern 28850 US Highway 98 # 107|Daphne AL 36526|(251) 447-0499 Royal Tattoo|3310 Governors Dr|SW Huntsville AL 35805|(256) 270-9450 Sacred Art Tatoos|104 Church St|Rainbow City AL 35906|(256) 413-1441 Screamers|1544 E Cottonwood Rd|Dothan AL 36301|(334) 794-3692 Screamers Tattoo|1005 US Highway 231|Brundidge AL 36010|(334) 808-4100 Screamers Tattoo|703 N Daleville Ave|Daleville AL 36322|(334) 503-1000 Screamers Tattoo & Body|1229 Rucker Blvd|Enterprise AL 36330|(334) 308-0289 Screamers Tattoo & Body|1394 El Paso Plz|Montgomery AL 36110|(334) 445-0737 Shenanigans Tattoo Parlor|422 S Gay St|Auburn AL 36830|(334) 821-7250|Autattoo.Com Shogun Tattoos & Body Piercing|2200 S Oates St # B|Dothan AL 36301|(334) 794-8550 Showtime Tattoos|1028 15th St|Tuscaloosa AL 35401|(205) 331-4212 Skin Deep|1225 Snow St # 9|Oxford AL 36203|(256) 835-8442 Skin Deep Tattoo & Body Prcng|613 Highway 67|S Decatur AL 35603|(256) 686-1199 Skin Traditions Tattoos-Body|9483 Lee Road 246 # A|Smiths Station AL 36877|(334) 480-0770 Skin WORX Tattoo|2169 Pelham Pkwy|Pelham AL 35124|(205) 834-8700 Slow Fade Studio|10654 US Highway 31 # D|Spanish Fort AL 36527|(251) 621-3710 Southern Ink Tattoos & Prcngs|3335 Highway 14|Millbrook AL 36054|(334) 285-8400 Studio 25 Tattoo|1530 W I65 Service Rd S # C|Mobile AL 36693|(251) 660-2575 Symbolic Ink|307 Skyland Blvd|Tuscaloosa AL 35405|(205) 331-4522 Tat2 Town|6677 Three Notch Rd|Mobile AL 36619|(251) 666-2005 Tattoo Addiction|2275 Andrews Ave|Ozark AL 36360|(334) 443-8288 Tattoo Experience Studio|2703 University Blvd|E Tuscaloosa AL 35404|(205) 553-8313 Tattoo Expression|503 Cahaba Park Cir # B|Birmingham AL 35242|(205) 408-0502 Tattoo Expression|5712 Chalkville Rd # 120|Birmingham AL 35235|(205) 815-1174 Tattoo Jungle|4601 Highway 31 # E|Calera AL 35040|(205) 668-6566 Tattoo Shop|5818 Mcclellan Blvd|Anniston AL 36206|(256) 847-8282 Tattoo Shop|1531 Montgomery Hwy|Dothan AL 36303|(334) 699-7246 Tattoo Expression|5712 Chalkville Rd # 120|Birmingham AL 35235|(205) 815-1174 Tattoo Jungle|4601 Highway 31 # E|Calera AL 35040|(205) 668-6566 Tattoo Shop|5818 Mcclellan Blvd|Anniston AL 36206|(256) 847-8282 Tattoo Shop|1531 Montgomery Hwy|Dothan AL 36303|(334) 699-7246 Tattoo Shop|120 East St|N Talladega AL 35160|(256) 362-9246 Tattoo Zone|3722 Moffett Rd|Mobile AL 36618|(251) 460-2779 Tattooed Lady LLC|10099 Memorial Pkwy SW # 4|Huntsville AL 35803|(256) 489-9284 Taylor Made Body Art|5036 Vaughn Rd|Montgomery AL 36116|(334) 239-7434 Thicker Than Water|10099 Memorial Pkwy|SW Huntsville AL 35803|(256) 585-3693 Tight Cuts & Tattoos|1401 3rd Ave W # 103|Birmingham AL 35208|(205) 783-9244 Top Notch Tattoo|501 7th St|S Clanton AL 35045|(205) 755-7711 Total Illusion Tattoos|2000b S Wilson Dam Rd|Muscle Shoals AL 35661|(256) 248-4864 Toxxxic Ink Tattoos|619 Tuscaloosa St|Greensboro AL 36744|(334) 624-1212 Trillium Tattoo Studios|25814 Canal Rd|Orange Beach AL 36561|(251) 988-8282|Trilliumink.Com Voodoo Needle|435 N Dean Rd|Auburn AL 36830|(334) 826-1195|Voodooneedle.Org West Coast Tattoos|3115 Florence Blvd|Florence AL 35634|(256) 760-8011 Wicked Ways Tattoo|1022 20th St|S Birmingham AL 35205|(205) 983-7753 Wildman Tattoo|15 County Road 599|Hanceville AL 35077|(256) 339-7034 World Tattoo|Skyland Park|Mobile AL 36693|(251) 661-6605 Zen Tatu|28850 US Highway 98 # 107|Daphne AL 36526|(251) 626-0031 Zero Gravity|2601 Spring Ave|SW Decatur AL 35601|(256) 353-4461 now you can work on inserting this data into a database
  16. It might be simpler to just include a php file when needed that runs an sh script
  17. That should be added to the 6 year old article somehow. http://www.phpfreaks.com/tutorial/basic-pagination
  18. My response is nothing on the internet is safe, you can only try to make it safer. And at least with open source you have the option to change anything you desire yourself. As for heartbleed you should update OpenSSL and regenerate any keys, assess if anything else could have been compromised. Can also recompile OpenSSL using the OPENSSL_NO_HEARTBEATS flag
  19. Is the sh file executable? chmod +x pull.sh cd to the directory first
  20. You don't want to save html to a database. You need to parse the exact data you need and give them a variable. Some items to help you parse the data simple html dom preg_match_all() preg_match() dom simplexml The idea is to do pattern matching and on those values insert into a new array you create in the loop As for making it able to insert, making new arrays in a loop. foreach ($site AS $line) { $line_array[] = $line;//adding [] places them all in an array //print_r($line); } //now outside the loop print_r($line_array);//if need to see the new array //you can then implode the array for inserts, although should clean everything first $imploded = implode(",",$line_array); echo $imploded; You can also create associative arrays and key,value pairs $new_array = array(); $new_array[] = array( "url" => $url, "title" => $title, );
  21. I myself started coding at age 8 and now 43 So to learn php for me was just learning the syntax and functions. Once you know some languages is easy to pick up others. I used to host dedicated and virtual private servers, along with websites.. PHP came along and just started to integrate it into existing projects. I was a bit crazy and my first large project in php was making a search engine and a website index. Along the way have made thousands of functions and scripts that I can use in other projects I do. As to how I studied or learned it, that was a matter of getting familiar with it at php.net, doing my own little scripts and trying to make them work. When you get an error you try and find what you did wrong and keep going. I noticed you wrote about not having enough knowledge to build your own project. While that may seem to be true, in reality you can start small and work your way up. Everyone has ideas, for instance...make something that starts tracking what you have learned in php in a database Maybe something that is tracking your steps in your quest to learn php. You start out by making a new folder named what you like drop in an index.php file open an ide or programmers notepad and start writing code as you go along create more folders and files You can just keep making small stuff, or keep adding to an existing project...eventually will have something useful. When the time comes you need to do something special, you can look it up and see what is the best choice for the task at hand. Try them all, see what works or not. Use from memory or looking it up on google and see what others used.
  22. Lots of online tutorials are poor examples with bad coding practices and outdated code. There is a lot of useful and current information at the source itself. http://php.net/manual/en/getting-started.php Will show you anything deprecated not to use, example codes, similar or opposite functions. Think of how hard it would be to read a book without knowing what the words mean. Once you know most of the functions it gets easier to read others code and understand what they are trying to do. Take a look at function names and familiarize yourself what they all do. Bookmark the main functions page for the future. http://php.net/manual/en/funcref.php Some popular and useful areas http://php.net/manual/en/ref.strings.php http://php.net/manual/en/ref.array.php http://php.net/manual/en/book.pdo.php http://php.net/manual/en/book.mysqli.php Keep reading posts at this site for problems and their solutions. Many times the poster will explain it pretty clear as to why. People learn in different ways...seeing,doing,reading. Repetition is the key, keep at it, what you don't understand look it up.
×
×
  • 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.