hi, apologies if posted in the wrong area.
Im very new to php so forgive me if i get the terms etc wrong, i normally work in hmtl.
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
New to php, trying to make my first output form..
Moderator: General Moderators
Re: New to php, trying to make my first output form..
i have given up trying to write this, if anyone is interested in writing this for me please drop me a pm and we can chat about remuneration for your service