Hi, please bear with me on this if it doesn't come out 100% clear what the exact issue is, this is must first project with php after years spent working in html.
Im trying to do two very simple things with forms; different forums and for the life of me i cannot seem to make either work. If anyone could help out i would be most grateful.
Issue One
I have made a website shop which has about 2million products in it. Because of the same of the database we have decided that it will be split into 10 different databases, one for each of the categories.
We seem to be having an issue making a search for at the moment. We can easily make a form to search x database but ideally on the shop we want to have a search form at the top of the screen where the user types in the keyword and then from a drop down list selects which category of the site they wish to search in. We somehow need the drop down bit to tell the form which of the 10 databases to look in for that result.
Issue Two
I have set yup an online shop and i need a way in which i can get a list of the products and the exact url to said product. I have got this working in part. at the moment when i run the scrip it get the output like follows
Silver Slimming Tablets 7 Week Course ; http://iwanttopayless.co.uk/healthandbe ... db=2&pid=1
this breaks down as Product Name ; url to that product
(if you go and look at the site its still being made so bear that in mind)
This output gives me all of the information i need however what i really need is to be able to output it into a table with one column for keyword and one for url. This will then make life much much easier as i will be able to copy and paste these columns direct into adwords editor.
The code for the php script is
<?php
if($_SERVER['REQUEST_METHOD'] == "POST"){
include ("../includes/connect.php");
$dbnum = $POST['dbnum'];
$path = $POST['path'];
$link = mysql_connect($hostname, $username, $password)
or die('Could not connect: ' . mysql_error());
mysql_select_db($database) or die('Could not select database');
$query = 'Select merchant, prodName as prod, prodID as prID FROM affiliSt_products'.$dbnum.'';
$result = mysql_query($query) or die( $query . ' : ' . mysql_error());
while ($row = mysql_fetch_object($result))
{
$data[$row->prID]["prod"] = $row->prod;
$data[$row->prID]["prID"] = $row->prID;
}
//Free resultset
echo "<table border=1>";
mysql_free_result($result);
foreach ($data AS $key => $val) {
$clean_name = preg_replace('/[\':;"-,.()!{;}\/-]/','',$val['prod']); // Strip out unwanted chrs.
echo $clean_name. " ; ".$path."/index.php?proddb=".$dbnum."&pid=".$val['prID']."<br />\n";
}
}
else {
print '<h3>Collect the products from an affilistore product table.</h3>';
print "<body>";
print '<form action=" " method="POST">';
print '<br />';
print 'Enter the Database Table Number';
print '<br>';
print '<input name="dbnum"></input>';
print '<br>';
print '<br>';
print 'Enter the full URL of this Store (ie. http://www.thisstore.com, WITHOUT the trailing /)';
print '<br>';
print '<input name="path"></input>';
print '<br>';
print '<br>';
print '<input type="submit" name="submit" value="Submit" >';
print '<br>';
print '<br>';
print '</form>';
print '<br/>';
print '</body>';
}
?>
any help anyone could offer would be most welcome
thanks
Carl