Jump to content

[SOLVED] What is this? - MySQL syntax '-3, 3'


web_master

Recommended Posts

<?php 

	// OnOff
		if($_POST['posters_onoff_submit']) {

			if($_POST['posters_onoff'] == "0") {
				$query_update = mysql_query("UPDATE `posters` SET
					`posters_onoff` = '1'
				WHERE
					`posters_id` = '".$_POST['posters_id']."'
				");

			}

			if($_POST['posters_onoff'] == "1") {
				$query_update = mysql_query("UPDATE `posters` SET
					`posters_onoff` = '0'
				WHERE
					`posters_id` = '".$_POST['posters_id']."'
				");
			}

		} // end of OnOff



	if($_POST['posters_delete_submit']) {
	print
		"<fieldset class=\"photodeletefield\">
			<legend class=\"photodelete\">BIZTOS TÖRLÖD?</legend>
				<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">
					<div class=\"divcenter\"><input type=\"submit\" name=\"posters_delete_confirm_submit\" value=\"TÖRÖL\" class=\"button-red\" /></div>
					<div><input type=\"hidden\" name=\"posters_id\" value=\"".$_POST['posters_id']."\" /></div>
					<div><input type=\"hidden\" name=\"page\" value=\"".$_REQUEST['page']."\" /></div>
				</form>
		</fieldset>";

	}


	if($_POST['posters_delete_confirm_submit']) {

		$query_update = mysql_query("UPDATE `posters` SET
			`posters_delete` = '1'
		WHERE
			`posters_id` = '".$_POST['posters_id']."'
		");


	} // Delete
















	// Pagination
		if(!isset($_REQUEST['page'])) {
			$page = 1;
		} else {
			$page = $_REQUEST['page'];
		}

		$max_results = 3;

		$from = (($page * $max_results) - $max_results);

	// select fromba // LIMIT $from, $max_results




	// Reload from dBase
		$query_return = mysql_query("SELECT * FROM `posters` WHERE `posters_delete` = '0' ORDER BY `posters_id` DESC LIMIT ".$from.", ".$max_results." ");

	// Check query
		if(!$query_return){
			print mysql_error();
			exit;
		}

	// Request query
		while($request = mysql_fetch_array($query_return)) {


	// Onoff
		if($request['posters_onoff'] == "0") {
			$posters_onoff_submit_value = "KIKAPCSOLVA";
			$posters_onoff_submit_class = "button-red";
		} elseif ($request['posters_onoff'] == "1") {
			$posters_onoff_submit_value = "BEKAPCSOLVA";
			$posters_onoff_submit_class = "button-green";
		}
	?>

Looks like it's in here

 

$query_return = mysql_query("SELECT * FROM `posters` WHERE `posters_delete` = '0' ORDER BY `posters_id` DESC LIMIT ".$from.", ".$max_results." ");

 

Check your $from variable to see if it contains -3

Looks like it's in here

 

$query_return = mysql_query("SELECT * FROM `posters` WHERE `posters_delete` = '0' ORDER BY `posters_id` DESC LIMIT ".$from.", ".$max_results." ");

 

Check your $from variable to see if it contains -3

 

yup, that looks like the issue. the first value for LIMIT has to be 0 or greater

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.