Jump to content

Simple $_POST command now not working


cc976a

Recommended Posts

Hop someone can help. Recently moved servers and small but fundemental script now not working. It is:

 

$abc = $_POST[$def] ;

  $ghi = $_POST[$jkl] ;

 

  if (($abc == '10') && ($ghi == '10')) {

 

    $dosomething = mysql_query("select * from table where place='1' order by id asc");

  $dosomething1 = mysql_num_rows($dosomething);

 

}

 

Anyone have any suggestions as to what is not working. Basically no errors received but I have a script further down which says if $dosomething1 is 0 then show 'No Results Found' which is what is being displayed - whereas before the move hundreds of results were appearing.

 

I've checked the database and all is fine there too  :confused:

Link to comment
https://forums.phpfreaks.com/topic/168379-simple-_post-command-now-not-working/
Share on other sites

Try this:

 

$abc = $_POST[$def] ;
   $ghi = $_POST[$jkl] ;
   
   if (($abc == '10') && ($ghi == '10')) {
   
    $dosomething = mysql_query("select * from table where place=\'1\' order by id asc");
   $dosomething1 = mysql_num_rows($dosomething);

}

 

Looks like you forgot to escape your single-quotes in $dosomething

How's about this?

 

<?php

$abc = $_POST['def'];
$ghi = $_POST['jkl'];
   
   if (($abc == '10') && ($ghi == '10')) {
   
    $dosomething = mysql_query("select * from table where place=\'1\' order by id asc");
   $dosomething1 = mysql_num_rows($dosomething);

}

?>

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.