It gives me this error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home2/gfxdesig/public_html/directory/category.php on line 14 Problemas en el select: Line 14 would be: mysql_select_db("gfxdesig_directory", $conexion) This is the full script used in that page: require('conection.php'); mysql_select_db("gfxdesig_directory", $conexion) or die("Problemas en la selección de la base de datos"); $registros=mysql_query("select * from webs where category=$category ORDER BY id",$conection) or die("Problemas en el select:".mysql_error()); while ($reg=mysql_fetch_array($registros)) { echo "<a href=\"".$reg['url']."\">".$reg['title']."</a> - ".$reg['description']; } can someone pls help me
It sounds like it cannot find the mysql database. So, either the database doesn't exist or the location isn't correct.
The error doesn't mean that no result was returned. The error is in the input to the function, not the output. Plus, 'no result' is not an error in the first place! Like I said, on one line you use $conexion and on another line you use $conection. One of those is wrong. Like crazyden said, we really need to see conection.php to know for sure which one is right, but surely you know which one is!
Like I posted above the input to the function is not the one he should use Plus no result will return an error. and he is right for the $connection just remove it from the code like : ("select * from webs where category='$category' ORDER BY id")
Well, we're going to have to agree to disagree... from what I can gather, you're saying that the incorrect input is the actual query? I'm saying that it's the second parameter which represents the DB link (the error says it's not a valid link resource: the first parameter is a query and the second is the link... which parameter do you think the error message is in reference to?). OK. When you said 'no result' I assumed you meant '0 lines found matching the query' (which doesn't error). Anyway, my point still stands: the error message says that the link isn't valid so by 'deduction' it *has* to be the second parameter... or am I totally missing something?
fixed it a bit it was $conexion, now I get this: Problemas en el select: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 'ORDER BY id' at line 1
Now *that* error is the one that maiahost was addressing. You should make the change as per his first reply and see what happens.
Now that I see your table structure again and think... is 'category' a number or a string? If it's a number, then you shouldn't have those single quotes around it (it was right in the first place). However, like you said, there was a problem with the query. That, plus the absence of any results kind of implies that the $category variable is not being populated...