954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

help with javascript (moved from javascript forum)



<?php
$cat = $_GET['cat'];
if(empty($cat)) {
$query = "SELECT * FROM products ORDER BY 'price'";
} else {
$query = "SELECT * FROM products WHERE cat = '$cat' ORDER BY 'price' ";
}
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$num=mysql_num_rows($result);

mysql_close();


$i=0;
while ($i < $num) {

$ID=mysql_result($result,$i,"ID"); $name=mysql_result($result,$i,"name"); $price=mysql_result($result,$i,"price"); $photo=mysql_result($result,$i,"photo"); $longdescription=mysql_result($result,$i,"longdescription"); $qty=mysql_result($result,$i,"qty"); ?> [<? echo "$ID" ?>]
<? echo" alt="<? echo "$name" ?>"> <?=$name?>

Our price £<? echo "$price" ?>





">
">
">



<?
$i++;
}
?>

symoore22
Newbie Poster
9 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

You seem to be asking someone to troubleshoot your PHP code. So, I've moved this thread to the PHP forum.

If you're asking a JavaScript question, post only the JavaScript code that appears to contain the problem.

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 

Hello tgreer,
i am not agree with u
on his code there is also PHP.
so why move his post?

val542
Newbie Poster
10 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

Because I saw no JavaScript in his code. I saw PHP code that produces JavaScript. So the first step in troubleshooting the problem is to make sure all of the PHP is valid. If it is, then we can move on to working through the JavaScript.

If a user truly wants help with JavaScript, they should post the relevant JavaScript. With server-side-generated code, the best way to see what is actually produced is to "view source" and copy the relevant code snippets to the forum. Which the original poster can still do! He hasn't been "banned" from the JavaScript forum by any means. I just made a judgment call that he would get better help here.

While we're talking about clarity, in a technical forum I would recommend proper spelling and punctuation. :)

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You