Jump to content
php.lv forumi

You have an error in your SQL syntax;


suport

Recommended Posts

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and parent = 0' at line 1

 

sql kods:

SQL KODS:

<?

 

$sql = "SELECT * FROM `ura_items` WHERE CategoryID != 2 AND CategoryID != 1 AND CategoryID != 0 ORDER BY `Add_Date` DESC LIMIT 10";

$result = @mysql_query($sql);

if( !$result ) {

echo "MySql Error: ".mysql_error();

}

$i = 0;// for alternative row color

while( $row = mysql_fetch_assoc($result) ){

 

echo "<li><a href=\"".seo_links('detail', $row['ProductID'], $row['ProductName'], 1, _SEO)."\">".fewchars($row['ProductName'], 60)."</a> <span class=\"date_right\">".nice_date($row['Add_Date'])."</span></li>";

echo "<li class=\"shortdesc\">".fewchars($row['LongDesc'], 140)."</li>";

 

$i++;

}

?>

Link to comment
Share on other sites

lol true

 

es vienīgi varu ieteikt mysql_query() vietā lietot slaveno go() funkciju

function go($sSql) {  // izpilda mysql query
$h = mysql_query($sSql) or exit('<b>mysql_query() error ' . mysql_errno() . ':</b> ' . mysql_error() . '<br /><b>query:</b> ' . substr($sSql, 0, 1000));
return $h;
}

tā uzreiz pasaka arī sql, kur bija kļūda

Edited by 2easy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...