Jump to content

whelpton

Members
  • Posts

    107
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

whelpton's Achievements

Member

Member (2/5)

0

Reputation

  1. Thank you very much, that worked beautifully! One final question, as it stands right now, this sql will echo product names that are like bread, is there any way to also echo the butter products? Thanks once again! =D
  2. I'm still not getting any data or errors from that statement :/ $result = mysql_query("SELECT * FROM sample WHERE `nice_date` >= '2010-01-01' and `nice_date` < '2012-01-31' AND `product_name` LIKE '%a%' INNER JOIN ( SELECT user_id FROM sample WHERE `nice_date` >= '2010-01-01' AND `nice_date` < '2012-01-31' AND `product_name` LIKE '%b%' ) as brand2 USING (user_id)"); while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td align='center' width='200'>" . $row['user_id'] . "</td>"; } echo "</table>"; I've opened the query up to just A & B so it theoretically should match most products, but I'm not getting anything at all. Thanks for your help so far though, Like I said earlier on, I don't have much experience with sql statements such as these. EDIT- on second thoughts, it looks like its bugging out with the query.
  3. Barand, Unfortunately I don't seem to be able to run that Query, I've modified it to fit the characteristics of my DB and it dies: SELECT * FROM sample WHERE `nice_date` >= "2012-01-01" and `nice_date` < "2012-01-31" AND `product_name` LIKE "%bread%" INNER JOIN ( SELECT user_id FROM sample WHERE `nice_date` >= "2012-01-01" and `nice_date` < "2012-01-31" AND `product_name` LIKE "%butter%" ) as product_name USING (user_id)
  4. Hey Jazzman1, thanks for replying. There are no errors occuring and echoing the statement comes back with: SELECT * FROM sample WHERE `nice_date` >= "2012-01-01" and `nice_date` < "2012-01-31" AND `product_name` LIKE "%bread%" AND `product_name` LIKE "%butter%" Where $brand1=bread & brand2=butter
  5. Hey guys, thanks for reading my post. I'm banging my head against a brick wall with this one, I have very limited knowledge of Mysql statements unfortunately. I'm trying to select data from a table that contains product purchases and find out which customers have purchased two seperate products, the code I have for this so far is: $brand = $_GET["brand"]; $brand2 = $_GET["brand2"]; $result = mysql_query('SELECT * FROM sample WHERE `nice_date` >= "'.$year.'-01-01" and `nice_date` < "'.$year.'-01-31" AND `product_name` LIKE "%'.$brand.'%" AND `product_name` LIKE "%'.$brand2.'%" '); However, this simply finds products that contain $brand and $brand2, whereas I'm trying to look for results where both brands were purchased. Once again, thanks for reading and any pointers would be brilliant.
  6. Hey guys, thanks for reading. I feel like I'm banging my head against a brick wall with this one: I've got a CSV file with 9 columns and I have a MySQL table with 11 columns. The CSV file looks like: col1, col2, col3, col4, col5, col6, col7, col8, col9 and the MySQL table looks like: col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 I need to get the script to ignore the two erroneous (but required) MySQL columns. The mysql columns that need to be ignored in the import are named: db_id & nice_date This is what I have so far: $sql = 'LOAD DATA LOCAL INFILE "../csvtemp/test.csv" INTO TABLE sample FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY """" IGNORE 1 LINES' ;
  7. Thanks for the reply PIkachu2000, Is there a way around this, as the data is imported from a 100/200mb csv file that would be a pain in the arse to manually change and I imagine a pain in my processor's arse to change through code
  8. Hey guys, First of all, thanks for reading my post, its much appreciated. I've been roped into trying to develop a system to work with a large CSV file, which I believe should be ported into a mysql db to start off with then processed via php. The only issue comes into searching through the DB and finding a specific date range, I am trying to use the mysql between code such as this: SELECT * FROM sample WHERE `order_date` >= "01/01/2010" and `order_date` < "30/12/2010" But I still get order_date's that are outside of that date range. Any ideas?
  9. Thank you, thats nearly got it. However now Im getting 0.2.101 or 0.2.10.1 if I use the original 0.0.1. Im just looking to increase the last decimal position by one. Thanks
  10. Hey, just wondering what would be the best way of adding .1 to a string. For example: $newversion = $currentversion + '0.0.1'; $newversion is taken from a db, lets say for this example it is 0.2.1 This code simply outputs 0.2 Any ideas? Thanks =)
  11. @Jnerocorp, still no luck. Script dies after the command.
  12. Hey guys, I have used this code before on a linux server and know that it works, however after porting my site over to a windows server running apache, php and mysql; the following code seems to make one of my scripts crash. $queryfam1 = "SELECT * FROM wp_users WHERE user_login='$username'"; $resultfam1 = mysql_query($queryfam1) or die(mysql_error()); $row21 = mysql_fetch_array($resultfam1) or die(mysql_error()); I have no idea of a result as there is no error reported, it simply dies and does not tell me what is happening with it. Any ideas?
×
×
  • 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.