plznty Posted November 12, 2009 Share Posted November 12, 2009 <?php // ID calculation process $id = $_GET["id"]; $id1 = $id + 1; $id2 = $id + 2; $id3 = $id + 3; $id4 = $id + 4; $id5 = $id + 5; $id6 = $id + 6; $id7 = $id + 7; $id8 = $id + 8; $id9 = $id + 9; $id10 = $id + 10; // Search page name $page = get_file_contents("searchpage.txt"); // Gather ID item name $a = file_get_contents("$page$id1"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $a, $m1); echo $m1[1]; $b = file_get_contents("$page$id2"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $b, $m2); echo $m2[1]; $c = file_get_contents("$page$id3"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $c, $m3); echo $m3[1]; $d = file_get_contents("$page$id4"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $d, $m4); echo $m4[1]; $e = file_get_contents("$page$id5"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $e, $m5); echo $m5[1]; $f = file_get_contents("$page$id6"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $f, $m6); echo $m6[1]; $g = file_get_contents("$page$id7"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $g, $m7); echo $m7[1]; $h = file_get_contents("$page$id8"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $h, $m8); echo $m8[1]; $i = file_get_contents("$page$id9"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $i, $m9); echo $m9[1]; $j = file_get_contents("$page$id10"); preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $j, $m10); echo $m10[1]; // Insert names and ID into database mysql_connect("localhost", "master", "pass") or die(mysql_error()); mysql_select_db("webhost") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m1', '$id1' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m2', '$id2' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m3', '$id3' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m4', '$id4' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m5', '$id5' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m6', '$id6' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m7', '$id7' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m8', '$id8' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m9', '$id9' ) ") or die(mysql_error()); mysql_query("INSERT INTO main (rsn, ip) VALUES('$m10', '$id10' ) ") or die(mysql_error()); // Refresh page after updated database for new entries echo "<title>ID List - $id1 - $id10</title><meta http-equiv='refresh' content='0;url=index.php?id=$id10'>"; ?> searchpage.txt http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj= It comes up with "Parse error: syntax error, unexpected T_VARIABLE in /home/webhostg/public_html/index.php on line 23" Help me please? Link to comment https://forums.phpfreaks.com/topic/181277-solved-help-with-t-variable/ Share on other sites More sharing options...
Garethp Posted November 12, 2009 Share Posted November 12, 2009 preg_match("/<div class='brown_box main_ge_page vertically_spaced'>\s*<div class='subsectionHeader'>\s*(.*?)\s*<\/div>/" $a, $m1); Your preg match is missing a , between the pattern and the variable. Same with all of them Link to comment https://forums.phpfreaks.com/topic/181277-solved-help-with-t-variable/#findComment-956315 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.