02-11-2008, 07:22 PM
|
#8 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 445
Thanks: 49
|
PHP Code:
<?php
// First, check wether CAT has been defined. if ( !empty ( $_GET['cat'] ) ) {
// Second, check if both vars are numeric. If not, it won't work either way. if ( ( is_numeric($premierMessageAafficher) ) && ( is_numeric($nombreDeMessagesParPage) ) ) { // If all just checks out, you can engage the querie and do with it as you please. $resQuery = mysql_query(' SELECT * FROM `video` WHERE `group` = "' . $_GET['cat'] . '" ORDER BY `id` DESC LIMIT "' . $premierMessageAafficher . '", "' . $nombreDeMessagesParPage . "'") or die ('MySQL returned an error. \'<i>' .mysql_error(). '\'</i>.'); } else { echo 'I am sorry. One or both of the values are not numeric.'; } # End Numeric Checks } else {
echo 'You should really SET the GET variable called "cat" before you init the script.'; } # End Cat-Check
// Good luck darklord of the sith.
?>
If you type EVERY mySQL table keyword with the backquote (`word`), you should do that with everyone. Also you must be careful to not name every word the same or use keywords that mySQL uses itself. Words like "group" are predefined mySQL keywords used to perform actions on the query, inside it. (same as NOW() and stuff).
Also make a NOTE in your PHP diary if you have one, to finish up quotes before you type a var between them. Zend Studio or phpDesigner2008 will also auto-correct or display the errors for you. (no clue on other programs tho)
IF you are using DreamWeaver, I should suggest to ONLY use it for HTML and CSS scripting. Use a PHP editor for all the other work. My vote goes out to phpDesigner and Zend, as I initially said.
Good luck and please DO read the comments. I haven't tried it but it is my most common way (without using sprinf()) so it should work.
Have a good one.
Mark
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|