PDA

View Full Version : What is worng here. It doesn't work!


derek
01-24-2003, 09:44 AM
This is what I have in the PHP file. I tried that SQL code that was posted in the 2nd post but I did not work either.

<?php
// MySQL Connection Information
$db_server = ""; // The name of your server
$db_username = ""; // The MySQL username
$db_password = ""; // The MySQL password
$db_name = ""; // The name of the database where your forums are installed

// Variables
$tbl = "products"; // Name of the table
$url = "Site URL"; // The full URL
$model = "KFC-" //Product Model Number

################################################## ##

mysql_connect("$db_server","$db_username","$db_password");
mysql_select_db("$db_name");

$sql_topic = mysql_query("SELECT t.Model_No,t.Product_Name,t.FOB_Price,t.IMG FROM $tbl t WHERE t.Model_No='$model' ORDER BY Model_No DESC") or print mysql_error();
while($t=mysql_fetch_array($sql_topic))
{
print "<img scr='$url/$t[IMG]'><br><a href='$t[Model_No]'>$t[Proguct_Name]</a><br>$t[FOB_Price]";
}

mysql_close();

?>

For surcurity Reasons. I have removed the databse password and stuff and also the site url.

For the $model the Model_No of the products I want start with "KFC-" but then have 001, 002, 003, etc I want to to show all the products with "KFC-" in the Model_No.


Can someone tell me where I have gone wrong.

Jochem
01-24-2003, 09:49 AM
well, whats the SQL error??

-ToXiC-
01-25-2003, 02:57 PM
--
$sql_topic = mysql_query("SELECT t.Model_No,t.Product_Name,t.FOB_Price,t.IMG FROM $tbl t WHERE t.Model_No='$model' ORDER BY Model_No DESC") or print mysql_error();
while($t=mysql_fetch_array($sql_topic))
{
print "<img scr='$url/$t[IMG]'><br><a href='$t[Model_No]'>$t[Proguct_Name]</a><br>$t[FOB_Price]";
}
--

Why do you have "t" after the table?