Jump to content

advancedfuture

Members
  • Posts

    132
  • Joined

  • Last visited

    Never

About advancedfuture

  • Birthday 03/11/1983

Contact Methods

  • AIM
    rockhardabsman
  • Website URL
    http://www.dial1auto.com/

Profile Information

  • Gender
    Male
  • Location
    San Jose, CA

advancedfuture's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. So Im building this little link scraper. The problem I am having is when it outputs the links that are in the array its got duplicate elements. I'm trying to erase the dupes and only show unique values. I've tryed array_unique() with out success as well as in_array(). Any help would be appreciated! //PAGE WE ARE GETTING LINKS ON $diags = str_get_html(getDiagramLinks($html)); //GET THE DIAGRAM LINKS TO PAGES INTO ARRAY foreach($diags->find('a') as $f) { $diagLinks[] = $f->href; } //iterate through the array for($i=0; $i<sizeof($diagLinks); $i++) { //ignore if blank element if(trim($diagLinks[$i]) !== ' ') { echo $diagLinks[$i]. '<br>'; } } The Output: /partsearch/model.aspx?diagram_id=110375 /partsearch/model.aspx?diagram_id=110375 /partsearch/model.aspx?diagram_id=110376 /partsearch/model.aspx?diagram_id=110376 /partsearch/model.aspx?diagram_id=110377 /partsearch/model.aspx?diagram_id=110377 /partsearch/model.aspx?diagram_id=110378 /partsearch/model.aspx?diagram_id=110378 /partsearch/model.aspx?diagram_id=110379 /partsearch/model.aspx?diagram_id=110379 /partsearch/model.aspx?diagram_id=110380 /partsearch/model.aspx?diagram_id=110380
  2. Happy Holidays Fellow PHPFreaks! I wanted to know how can I combine these two queries, if possible at all. $query = "UPDATE users SET active='n' WHERE username='$payer_email'"; mysql_query($query); $query = "DELETE FROM services WHERE username='$payer_email'"; mysql_query($query);
  3. So I have gzip running to compress my css files, the problem i am running into is when the page loads, the css must not fully decompress because the page renders half the page without the CSS and the other half fine. I'm not sure what I do in this scenario. Any thoughts?
  4. I am trying to limit how many dbconnections I run. How can I combine these two mysql statements into one query.. if possible. //If the user cancels their subscription, deactivate their account and delete their advertisement. if($txn_type == "subscr_cancel") { $query = "UPDATE users SET active='n' WHERE username='$payer_email'"; mysql_query($query); $query = "DELETE FROM advertisements WHERE username='$payer_email'"; mysql_query($query); }
  5. Yeah I have a c++ / PHP background, the syntax is pretty similair. I am not strong on JavaScript, but with the project I have been working on I think I'm going to need to learn it. Thanks for the advice guys
  6. I am stuck scratching my head over this problem. Here is my situation. I have 3 dropdown boxed. Box 1 = States Box 2 = Counties Box 3 = Cities What I am trying to accomplish is when the user selects their state, mysql will return the counties in that state in box 2, then when a county is selected box 3 will populate with all the cities in the county. Problem is PHP is all server side, so by the time the page loads it is done, how do I go about this problem? Just need idea's.
  7. I could i suppose load the image into my db as blob data and have the img code request a dynamic URL, but I think there is probably easier way right?
  8. So we do a lot of craigslist marketing, and as you know craigslist does not allow javascript or anything else. I am programming a hit counter that will tell me how many times a page was viewed through a tracking pixel. I can make the counter thats no issue, the problem is I don't know how to go about finding out if the pixel was loaded. I know it is possible, I run a statistical tracker called tracktool, and whenever I do an image based ad (with the image hosted on the server) every page craigslist imageload gets recorded as a hit. (normal traffic is 40uvs a day without any ads) run an image ad traffic spikes to 500-600uvs, these have no links back to the site, so they arent visiting the site it is deff image impressions
  9. Thanks Susa.. Works flawlessly now... Sometimes I forget some of the simple mysql functions. =]
  10. So here is my delimma. I setup wildcard subdomains on my server. My subdomain format is county.state.mydomain.com I'm matching the subdomains against my database, to ensure it is a valid combo, if it isn't it should redirect to the main page 'www'. Problem is my if statement is not working as it should... if I enter lets say... ilovebats.ca.mydomain.com it runs the query no problem, but doesn't execute the header statement in my IF statement... which leads me to beleive i malformed the if statement. Any help would be appreciated. <?php //Get what subdomain we are on. strip the county and state variables //from the URL, and if it is www, set it to Orange County, CA include 'dbconnect.php'; $domain = explode('.',str_replace("mydomain.com"," ",$_SERVER['SERVER_NAME'])); $county = $domain[0]; $state = $domain[1]; //This variable is used for displaying the county without the slashes $county_slash = str_replace("-"," ",$county); //If we are on the root of the domain, set the variables to Orange County, CA if ($county == "www") { $county = "Orange"; $state = "CA"; } //Check to make sure subdomain is valid. If not redirect to www else { $query = "SELECT * FROM `zip_code` WHERE county='$county' AND state_prefix='$state'"; $results = mysql_query($query); if($results == 0) { header('LOCATION: http://www.mydomain.com'); exit; } } ?>
  11. I want to grab the subdomain name with PHP so I can generate database queries. for example my subdomain is san-jose.mydomain.com How would I go about grabbing the subdoman name with PHP? Thanks!
  12. Trying to echo a HTML tag that has variables in it. Kinda beating my head on the wall with this one unfortunately. How to I echo the anchor text with the ' and " in it. $output = $row['services_address'] . $row['services_address_2'] . $row['services_city'] . $row['services_state']; echo '<a href ="maps.php?address='.$output.'" onClick="window.open('maps.php?address='.$output.'','Page Name','height=500,width=500,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');">View Map</a>';
  13. Okay here is the situation. I have a database with 2 tables, advertisements and users. I want to select all usernames from advertisements table that are advertising in a specific zipcode. It checks the users table to make sure they have the available column set to 0 and the vendor_status colum set to 1. It should then return all usernames with ads running! But I am having problems with my query. Currently what it is doing is printing out the username from BOTH the users table, and the advertisements table! The tables look as follows Table Advertisements: username | advertisement_title | zip_code Table Users: username | available | vendor_status The query I am trying to get to work is as follows. SELECT advertisements.username FROM advertisements, users WHERE users.available='0' AND users.vendor_status='1' AND advertisements.zip_code='95119'
  14. So I having a problem on one of my pages. The page displays all related advertisements. However when I select the ad I want to delete and press the form button it just refreshes the page without deleting it! Anyone able to see what the problem is in my code? Much thanks! <?php //*********************************** //*********************************** // SHOW THE USER ADS. // //*********************************** //*********************************** //GET THE USERS ADS FROM THE DATABASE $query = "SELECT * FROM advertisements WHERE username = '$username'"; $results = mysql_query($query); $num = mysql_num_rows($results); echo '<form id="form1" name="form1" method="post" action="profile.php">'; echo '<table align="left" width="95%" border="0">'; if($num == 0) { echo "<center><strong>Sorry! You have no advertisements</strong></center>"; } else { //ECHO HEADING FOR ADS TABLE echo '<tr><td bgcolor="#0066FF"><input type="checkbox" id="all" name="all" value=""></td>'; echo '<td bgcolor="#0066FF"><strong>Title:</strong></td>'; echo '<td bgcolor="#0066FF"><strong>Tagline:</strong></td>'; echo '<td bgcolor="#0066FF"><strong>City:</strong></td>'; echo '<td bgcolor="#0066FF"><strong>Phone:</strong></td>'; echo '<td bgcolor="#0066FF"><strong>Service:</strong></td>'; echo '<td bgcolor="#0066FF"><strong>Zip:</strong></td></tr>'; //BEGIN LOOP TO OUTPUT ADS FOR USER while($rec=mysql_fetch_array($results)) { $adid = $rec['adid']; $advertisement_title = $rec['advertisement_title']; $advertisement_tagline = $rec['advertisement_tagline']; $advertisement_city = $rec['advertisement_city']; $advertisement_phone = $rec['advertisement_phone']; $advertisement_service = $rec['advertisement_service']; $zip_code = $rec['zip_code']; echo '<tr><td><input type="checkbox" id="'.$adid.'" name="'.$adid.'" value="'.$adid.'"></td>'; echo '<td>'.$advertisement_title.'</td>'; echo '<td>'.$advertisement_tagline.'</td>'; echo '<td>'.$advertisement_city.'</td>'; echo '<td>'.$advertisement_phone.'</td>'; echo '<td>'.$advertisement_service.'</td>'; echo '<td>'.$zip_code.'</td></tr>'; } echo '</table>'; echo '<input type="submit" name="delete" id="delete" value="Delete Checked" />'; echo '</form>'; //IF THE USER DELETES ADS CYCLE THROUGH ALL THE CHECKBOXES if($_POST['delete']) { foreach($_POST as $adid) { $query = "DELETE FROM advertisements WHERE adid='$adid' LIMIT 1"; $results = mysql_query($query) or die(mysql_error()); } //REFRESH THE USERS ADS LIST if($results) { echo '<meta http-equiv="refresh" content="0"/>'; } } } mysql_close(); ?>
  15. I have a textfield that I want to submit the data into an array The user would enter data such as 92444,1223,12344,2322 all seperated by commas. How would I got about putting $_POST['value'] into an array. I've tried $var = array($_POST['value']) but that doesnt seem to work.
×
×
  • 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.