Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About transfield

  • Rank

Profile Information

  • Gender
    Not Telling
  1. Yes, that is part of the plan. The main idea is to grab multiple csv files of different names from the same website. The difference in the file names are reflected in the $report and $district variable. For example, I want to grab the following files:- http://thewebsite.com/export.aspx?type=csv&report=salesreport~1~ http://thewebsite.com/export.aspx?type=csv&report=employeereport~2~ http://thewebsite.com/export.aspx?type=csv&report=productionreport~3~ From the above example, salesreport, employeereport and productionreport are stored in the report column of the database. 1,2,3 are stored in the district column of the database.
  2. Hi, I'm using the following code to grab a csv file from one website & keep it on my website. The code is working fine. <?php $url = 'http://thewebsite.com/export.aspx?type=csv&report=nameofthereport~8~'; $path = '/home/path/to/mywebsite.com/public_ftp/incoming/nameofthereport_Area_8.csv'; $fp = fopen($path, 'w'); $ch = curl_init($url); curl_setopt($ch, CURLOPT_FILE, $fp); $data = curl_exec($ch); curl_close($ch); fclose($fp); ?> Here's what I want to do next. I want to query a database, and replace nameofthereport and 8 with the results of the query. My code to query the database is below. <?php include("/home/path/to/mywebsite.com/public_html/db_connect.php"); //connect to the database $today = date('Y-m-d'); $query1=("SELECT * FROM `table_name` WHERE expiry > $today"); $result1=mysqli_query($GLOBALS["___mysqli_ston"], $query1); $num1=mysqli_num_rows($result1); if ($num1 > 0) { while ($data = mysqli_fetch_array($result1)){ $email_to = $data["email"]; $district = $data["district"]; $report = $data["report"]; } } ?> Based on the code above, I would like to replace nameofthereport with $report and 8 with $district Could you show me the code please? Thanks.
  3. Good advice regarding the hiding of errors using @. I appreciate that, thanks. With regards to keyword stuffing, I plan to "stuff" it with a maximum of 7 keywords. I don't think that's a bad thing to do...correct me if I'm wrong. Why dynamic? Well here's a weird (& probably a warped) idea I have. I'm tracking organic keyword searches from Google which resulted an actual click to my site. I reckon that if the user clicked on my link displayed by Google during an organic search, then that keyword must have: 1. Appeared on the 1st few pages of Google (which means that I am ranking very well for this keyword). 2. My website was very relevant to the needs of the user (otherwise he wouldn't have clicked my link displayed on Google's search results). Is there a better way to identify a good quality meta keyword that this?
  4. Hi, This is my code. <?php include("/home/path/to/my/website/db_connect.php"); //connect to the database $result2 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * from `wp2_search_queries` WHERE (`query` NOT LIKE '%:%') AND (`query` NOT LIKE '%+%') AND (`query` NOT LIKE '%\.%') AND (`query` NOT LIKE '%\'%') AND (`query` NOT LIKE '%\?%') AND (`source` NOT LIKE '%mywebsite.com%') GROUP BY `query` order by `query_date` DESC limit 0,7"); while($rows2=@mysqli_fetch_array($result2)){ $keywords = "{$rows2['query']}".","; echo $keywords; } ?> Now, I want to insert $keywords into the following HTML meta tag: <meta name='keywords' content='<?php echo $keywords;?>'> How do I get the 'final product' to look like this? <meta name='keywords' content='keyword1,keyword2,keyword3,keyword4,keyword5,keyword6,keyword7'> Please show me the code as I may not be able to understand your instructions. Thanks
  5. Never mind. You never answered any of my questions anyway. You were more interested in deviating from the original issue for reasons best known to you.
  6. I want all the search results to go into this line: if($user_data -> user_login === 'admin' || $user_data -> user_login === 'joe'){
  7. I've figured out the 1st part which is: <?php global $wpdb; $my_table = $wpdb->prefix."users"; $my_query = "Select user_login from $my_table where user_login LIKE '%z%' "; $my_results = $wpdb->get_results($my_query); ?> Now, in second part, how do I put the search results into the foreach loop? Lets assume that I have 100 records in the search results. How do I loop through all the 100 records using the code below: <?php foreach($my_results as $user_data) { if($user_data -> user_login === 'admin' || $user_data -> user_login === 'joe' //all hundred records need to go inside here. How do I do that?) // do something } ?> Thanks for your help.
  8. Hi, I have a Wordpress plugin which I want to edit. My code is below. I have made comments in the areas that I need help in coding. I would appreciate your assistance in showing me the correct way to write the code. Thanks <?php global $wpdb; //this should be correct //I need help to convert the 2 lines below to a Wordpress friendly query $query1="SELECT * FROM wp_users WHERE user_login LIKE '%z%'"; $result1 = mysql_query($query1); //I want to put the search results into the example below if ( $user_login == 'admin' || $user_login == 'joe' ) { $do_something; } ?>
  9. Hi, I am currently using the results of one query to query another table. I'm looking for a simple solution to combine both these queries into a single query & achieve the same result. Part of my code is below. Could you please help me to re-write my query? Thanks. $query1=("SELECT * FROM test_log WHERE '$mktime' < expiry ORDER BY id DESC"); $result1=mysql_query($query1); $num1=mysql_num_rows($result1); while ($row1 = mysql_fetch_array($result1)) { $id = $row1["id"]; $keyword = $row1["keyword"]; $sale = $row1["sale_rent"]; $agents = $row1["e_num"]; $email = $row1["email"]; $cc_email = $row1["cc_email"]; $expiry = $row1["expiry"]; $query2= ("SELECT * FROM condo WHERE (location LIKE '%{$row1['keyword']}%' AND sale_rent LIKE '%{$row1['sale_rent']}%' AND e_num LIKE '{$row1['e_num']}') AND (date >= '$sendate') AND TRIM(IFNULL(`phone_1`,'')) <> '' ORDER BY sale_rent, location"); $result2=mysql_query($query2); $num2=mysql_num_rows($result2); From the code above, I am using the results of $query1 to query the condo table ($query2). So now I want to do away with two queries & have just one query to achieve the same results. Could you show me the code please? Thanks
  • 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.