
loren646
Members-
Posts
52 -
Joined
-
Last visited
Everything posted by loren646
-
Can I data scrape / datamine data using PHP?
loren646 replied to loren646's topic in PHP Coding Help
Thanks. I'm going to do some reading up on this right now. -
Can I data scrape / datamine data using PHP?
loren646 replied to loren646's topic in PHP Coding Help
just text data. I can either put it in a mysql database or excel. it doesn't matter. i just want to automate it - rather than do it manually. -
Can I data scrape / datamine data using PHP?
loren646 replied to loren646's topic in PHP Coding Help
http://a810-bisweb.nyc.gov/bisweb/bispi00.jsp example (on row 1 of property search): Select "manhattan" Input "22" "west 11 st" Click "GO" ---- Click "complaints" then click each complaint and copy the disposition i.e. "01/26/2004 - A9 - ECB & BUILDINGS VIOLATIONS SERVED" -
I'm sure it's possible. I want to go to a website. Input values then copy and paste data it found from that search. Not even sure where to start.
-
thanks Sen
-
got three columns Table: Rentals: Columns: house number, street, owner. what's the coding? "SELECT owner FROM Rentals" Not sure what to write so i don't select duplicate owners. or is it better to select all and then when echo don't echo the duplicates?
-
Possible to send information through a link?
loren646 replied to loren646's topic in PHP Coding Help
is there a way to do this without adding it to the url? -
ANSWERED. It adds to the previous variable. appends.
-
$variable.= ??? why does the variable have the "." ? what does that mean?
-
while($row = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row['hotel'] . "</td>"; echo "<td>" . $row['hotelnum'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "<td align='center'>" . $row['bedroom'] . "</td>"; echo "<td>" . $row['descrip'] . "</td>"; echo "<td>" . $row['level1'] . "</td>"; echo "<td>" . $row['level2'] . "</td>"; echo "<td>" . $row['notes'] . "</td>"; ?> <td><A HREF="viewhotelnum.php" onClick="return popup(this, 'notes')">view</A></td> <?php echo "</tr>"; } echo "</table>"; mysql_close(); I want to send the $row['prim'] to the link viewhotelnum.php. This way when they click the link the viewhotelnum.php I can display the photos for that particular hotel room.
-
it's more than just the space. i tried changing the folder from 40 Allen to 40Allen it still outputs nothing. okay... i removed the first / and it seems to work. SOLVED
-
<img src="/pics/Dan/40 Allen/4/201232313_33.jpg" alt="40allen" width="400" height="400"><br> <?php $dir = "/pics/Dan/40%20Allen/4/*"; // Open a known directory, and proceed to read its contents foreach(glob($dir) as $file) { echo "filename: $file : filetype: " . filetype($file) . "<br />"; } $files = glob("/pics/Dan/40 Allen/4/*.{jpg,gif,png}", GLOB_BRACE); echo "yo yo".$files[0]; ?> I'm trying different ways using %20 and without using %20. Nothing seems to come up. The html works on top. It only prints the picture from the html and the "yo yo"
-
In case anyone else is having this problem. For future reference. I deleted all the white space. I guess the formatting caused problems. SOLVED.
-
<?php // Connects to your Database error_reporting(E_ALL); ini_set("display_errors", 1); mysql_connect("localhost", "xxxx", "xxxx") or die(mysql_error()); mysql_select_db("xxxx") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: members.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] || !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database // if (!get_magic_quotes_gpc()) { // $_POST['email'] = addslashes($_POST['email']); // } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=areg.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: members.php"); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"></td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } ?> added error checking. added "//" before the email part (not sure why that's in there.) These are now the current errors: Notice: Use of undefined constant ID_my_site - assumed 'ID_my_site' in login.php on line 60 Warning: Cannot modify header information - headers already sent by (output started at login.php:1) in login.php on line 60 Notice: Use of undefined constant Key_my_site - assumed 'Key_my_site' in login.php on line 61 Warning: Cannot modify header information - headers already sent by (output started at login.php:1) in login.php on line 61 Warning: Cannot modify header information - headers already sent by (output started at login.php:1) in login.php on line 65
-
<?php // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); mysql_select_db("Database_Name") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: members.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: members.php"); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } ?>
-
"Warning: Cannot modify header information - headers already sent by" http://php.about.com/od/finishedphp1/ss/php_login_code_4.htm i'm just putting this code in. didn't modify it at all. line 51-57: else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: members.php"); } } } else { // if they are not logged in Warning: Cannot modify header information - headers already sent by on line 54 Warning: Cannot modify header information - headers already sent by on line 54 Warning: Cannot modify header information - headers already sent by on line 56 full code below: ----------------- <?php // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); mysql_select_db("Database_Name") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: members.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: members.php"); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } ?>
-
I have several folders of photos neatly organized. All photos have different names but end in .jpg. Folder could be called 03, 04, tom, jen, empire, etc if user clicks 03 link all photos would be shown in the 03 folder for example: http://www.lukeandleroy.com/wp-content/uploads/2011/03/ i want a page to show all in that folder whether there is 1 or 20 pics and regardless of name of photo.
-
thanks! got it to work.
-
it's not updating the rows... <?php $rent=$_POST['urent']; $update=$_POST['uupdate']; $apt=$_POST['uapt']; $price=$_POST['uprice']; $bedroom=$_POST['ubedroom']; $movein=$_POST['uprice']; $prim_id=$_POST['prim_id']; $count=$_POST['countadd']; if (!get_magic_quotes_gpc()) { $apt = addslashes($apt); $price = doubleval($price); $bedroom = addslashes($bedroom); $movein = addslashes($movein); } $conn = mysql_connect("localhost","user","password"); mysql_select_db("listing"); for ($i2 = 0; $i2 <= $count; $i2++) { mysql_query("UPDATE available SET apt='$apt[$i2]', price='$price[$i2]', bedroom='$bedroom[$i2]', movein='$movein[i2]' WHERE prim='$prim_id[$i2]'"); }
-
The price (i.e. "11", "2999", "4959") is outputted to a text box. The user will now change the price. When the "Update" button is pressed i want the all the prices to be to be changed to the new ones. I need to help on figuring out how to code the process page. <?php mysql_connect("localhost","user","password"); mysql_select_db("listing"); $result2 = mysql_query("SELECT * FROM available JOIN land ON available.building = land.building WHERE land.landlord = '$landlordselect' ORDER by available.price ASC"); echo "<table border='1'> <tr> <th>Building</th> <th>Apartment #</th> <th>Price</th> <th># of Bedrooms</th> <th>Move in</th> <th>Rented</th> </tr>"; while($row = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row['building'] . "</td>"; echo "<td>" . $row['apt'] . "</td>"; ?> <form action="processpage.php" method="post"> <td><input name="uprice[]" type="text" size="5" value="<?php echo( htmlspecialchars( $row['price'] ) ); ?>" /> </td> <?php echo "<td>" . $row['bedroom'] . "</td>"; echo "<td>" . $row['movein'] . "</td>"; ?> <td><input type="checkbox" name="rent[]" value="yes"></td> <?php echo "</tr>"; } echo "</table>"; ?> <p><input type="submit" value="Update"><p> </form> <?php mysql_close(); ?>
-
AWESOME. THANKS! if none are selected would it be better to change $hoodlist to all checked or to have it not even search location IN $hoodlist? I have this now: $hood=$_POST['hoodselect']; if (empty($hood)) { $hood[0] = "EV"; $hood[1] = "LES"; $hood[2] = "CT"; $hood[3] = "WV"; $hood[4] = "SH"; //Trim the values $hoodAry = array_map('trim', $hood); //Remove empty values $hoodAry = array_filter($hoodAry); //Prepare for DB query $hoodAry = array_map('mysql_real_escape_string', $hoodAry); //Implode into comma separated list (with quotes) $hoodList = "'" . implode("', '", $hoodAry) . "'"; } else { //Trim the values $hoodAry = array_map('trim', $_POST['hoodselect']); //Remove empty values $hoodAry = array_filter($hoodAry); //Prepare for DB query $hoodAry = array_map('mysql_real_escape_string', $hoodAry); //Implode into comma separated list (with quotes) $hoodList = "'" . implode("', '", $hoodAry) . "'"; }
-
<input type="checkbox" name="hoodselect[]" value="<?php echo $result['hood']?>"><?php echo $result['hood']." "?> $hood=$_POST['hoodselect']; the values are 2 letters i.e. EV or WV ------- I'm deleting the loop. its just shows that the checkbox are working.
-
Basically I have some checkboxes that store in an array, $hood. i think i have to use IN but i have tried and it does not seem to work. $N = count($hood); if(empty($hood)) { for($i=0; $i < $N; $i++) { echo($hood[$i] . " "); } } $myquery = "SELECT * FROM available LEFT JOIN land ON available.building = land.building WHERE location =$hood";
-
Greater than Less Than - Not working... IF statements.
loren646 replied to loren646's topic in PHP Coding Help
wow. *takes hand to forehead.*