This is my first post. on to the point
I am trying to make a bulk update in a MySQL table using a php if statement.but since i have no clue of mysql apart to connect to a database and update things 1 by 1.
So basically i am trying to use this if statement that is loooking for the word Casio in the name and avoids all prodcuts that have Bulgarian letters in the name on its own the code works,i just have 0 idea how to impliment it for MySQL would love some help to how to start.
<?php
require("words.php");
$product = "CASIO EF-513D-5AV MTP Chronograph";
if (strstr($product,"CASIO",0)) {
/*Watches for men*/
if (strstr($product,$gs,0) || strstr($product,$edifice,0) || strstr($product,$mtp,0) || strstr($product,$mrw,0)) {
if ($product == substr($avoid[0],0) || $product == substr($avoid[1],0) || $product == substr($avoid[2],0)) {
echo $product;
}
elseif(strstr($product,$gs,0)) {
echo str_replace($gs,$gsW,$product);
}
elseif(strstr($product,$edifice,0)) {
echo str_replace($edifice,$edificeW,$product);
}
elseif(strstr($product,$mtp,0)) {
echo str_replace($mtp,$mtpW,$product);
}
elseif(strstr($product,$mrw,0)) {
echo str_replace($mrw,$mrwW,$product);
}
}
}
/*Watches for women*/
elseif (condition) {
# code...
}
else{
}
?>
all the variables that the if statement above contains
<?php
/*Real words that we have*/
$gs = "G-SHOCK";
$casio = "CASIO";
$edifice = "EDIFICE";
$mtp = "MTP";
$mrw = "MRW";
/*Words that will be added*/
$gsW = "Мъжки спортен G-SHOCK";
$casioW = "часовник CASIO";
$edificeW = "Мъжки часовник EDIFICE";
$mtpW = "Мъжки часовник MTP";
$mrwW = "Мъжки часовник MRW";
/*Avoid words*/
$avoid = array("Мъжки","часовник","спортен")
?>
update:My idea is to target a table "product" and access the sub table "name" and which ever name has the word Casio in it,to start doing the if statement for it
Aucun commentaire:
Enregistrer un commentaire