if description does not contain the following words


Posted on 16th Feb 2014 07:03 pm by admin

Hello everyone,

I am parsing a MS Excel (.xls) file and adding it's content to a mySQL database, so far to good, but what I want to do is if the column titled description does not contain these words "seedlings" or "discount" then add it to the database but if it does skip it and keep looping.

Did you know?Explore Trending and Topic pages for more stories like this.
Here is my code that I am trying to get working:if((!empty($description))or($available >0)and(!preg_match("/seedlings/i", $description))):
mysql_query("INSERT INTO `availability` VALUES ('','$description','$available','$price')");
endif;

I may not be using the right function for this "preg_match"?
No comments posted yet

Your Answer:

Login to answer
70 Like 27 Dislike
Previous forums Next forums
Other forums

PHP using IF to display error
i have a MySQL query and i want to display 1 thing only if the number of affected rows is >=1

How to submit a form to the same page?
I have a table containing information about books in my library and this table has the following col

how to remove in php string display
My code is $message="We're looking at developing our website."; $body= "My mess

Php WordPress help
I am writing the following code for making a plugin

<?php
header("Content-Type

BackButton Behaviour in AJAX
I have an ASPX Page AJAX Enabled!The page has a gridView and a DDL for filtering on it. The Gridview

Removing Title From database problem
Hi again ! i am having an issue with updating database. When i update any price of a title it remove

Form Help
Here is the form:

Line number On/Off | Expand/Contract<? include("../include/sess

sendmail code suddenly not working
Hi Guys, I maintain 3 sites (including my own) I use the following code from a french webmaster that

Preg_match question
I want to use preg_match to make sure a string is always 6 characters long and only contains 0-9 and

array_count_values question?
ok i'm trying to create a top ten list from a database of listed favorite movies.

the followi

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash