I finally got my ISP to resolve the issues with connecting to my db. I have a test
table in the database named test. I have 3 fields; ID(20Char), PRICE(int),QTY(int).
I am using php (this is what my ISP supports and suggested).
I can connect using:
<?php
$link = mysql_connect ("localhost.domainnamehere.com.", "usernameherel",
"passwordhere")
or die ("Could not connect");
?>
I can draw the data out using this sample code:
<?php
$query = "SELECT ID, PRICE, QTY
FROM test
where PRICE=3";
$result = mysql_query ($query)
or die ("Query failed");
# fetch rows in reverse order
for ($i = mysql_num_rows ($result) - 1; $i >=0; $i--) {
if (!mysql_data_seek ($result, $i)) {
printf ("Cannot seek to row %d\n", $i);
continue;
}
if(!($row = mysql_fetch_object ($result)))
continue;
printf ("%s %s %s<BR>\n", $row->ID, $row->PRICE, $row->QTY);
}
mysql_free_result ($result);
?>
1. I can not seem to get the syntax correct to select where the ID=text value. I get
parse errors with almost every scenario. What is the correct string to select where a
character field is equal to a value???
2. I primarily need to select one record from the table and display the PRICE on the
webpage and show a hyperlink "buyme" where QTY is gt 0. Does someone have a sample
piece of php that will handle this??
Thanks, I am running very short on time!!!!
Joe.