You are here:  » Question about writing information to sql database

Support Forum



Question about writing information to sql database

Submitted by kartunes on Tue, 2009-07-14 13:05 in

I'm preforming some changes and i have one question about sql database

On pricetapestry script to write information i must use the line described bellow?????

$sql = "INSERT INTO `".$config_databaseTablePrefix."merchant_info (userName, name, companyName, address, cp, nif, email, web, phone,fax, mobile, creationDate, password`) VALUES ('$userName', '$name', '$companyName', '$address', '$cp', '$nif', '$email', '$web', '$phone', '$fax', '$mobile', '$creationDate', '$password')";
database_queryModify($sql,$insertId);

I don't have any error but database is empty....

And to read all the content in all fiels from table "feed_name, what code i must use

$sql = "SELECT * FROM `".$config_databaseTablePrefix."feed_name` WHERE filename='".database_safe($feedName)."'";

$getLinks = mysql_query($sql, $config_databaseTablePrefix);
$links = mysql_fetch_assoc($getLinks);

Anyone can help????

Best Regards

Submitted by support on Tue, 2009-07-14 15:24

Hi there,

The 2 tables that you mention are not part of the distribution so I assume that these relate to additional tables that you have created as part of your modification.

What I normally suggest in these situations is to print the SQL that you have generated, and then execute it against your database using phpMyAdmin - as this will give a detailed error message. For example;

$sql = "INSERT INTO `".$config_databaseTablePrefix."merchant_info (userName, name, companyName, address, cp, nif, email, web, phone,fax, mobile, creationDate, password`) VALUES ('$userName', '$name', '$companyName', '$address', '$cp', '$nif', '$email', '$web', '$phone', '$fax', '$mobile', '$creationDate', '$password')";
print "[".$sql."]";exit();

...then run the script and copy the SQL from between the [square brackets] and paste into the SQL form in phpMyAdmin...

Hope this helps!

Cheers,
David.