I have a database of my products inventory, with each products amount that is in stock and our prices for them. I'm trying to make it so that when I type for example 12345
part # for it to search $POST_partnumber
in table inventory
. And take part number + our price of this item and write in a txt file for every part number I type in and hit enter.
partnumber ourprice
partnumber ourprice
partnumber ourprice
partnumber ourprice
I started getting the code and there is a few extra feature I will add on my own, but can't get it to search for user imput and put colum our price
and part number
into a txt file.
Thanks
This is what I found:
$fp1 = fopen( 'obspg.txt', 'w' );
$outPut = "RETSKU\tProduct Title\tDetailed Description\tProduct Condition\tSelling Price\tAvailability\tProduct URL\tImage URL\tManufacturer Part Number\tManufacturer Name\tCategorization\tGender\tsize\tColor\n";
//retrive records from database and write to file
$result = mysqli_query($con,"SELECT * FROM `TABLE 1` ");
while($row = mysqli_fetch_array($result))
{
$outPut .= $row[`id`]."\t".$row[`title`]."\t". $row[`description`]."\t".$row[`condition`]."\t". $row[`price`]."\t".$row[`availability`]."\t".$row[`link`]."\t". $row[`image_link`]."\t".$row[`mpn`]."\t".$row[`brand`]."\t".$row[`google_product_category`]."\t".$row[`Gender`]."\t".$row[`size`]."\t".$row[`Color`]."\n";
}
fwrite( $fp1,$outPut);
fclose( $fp1 );
You could also do something like this. Using
file_put_contents()
&file_get_contents()
You just need to set some things