Page 2 of 2

Posted: Fri Nov 29, 2002 9:30 am
by new to php
im getting "Query was empty"

Code: Select all

confirm.php 

if ($delete == "Delete") 

{ 
<h3>Are You Sure</h3> 
<form action="edit.php" method="post" > 
<input type="submit" name="delete" value="Yes"> 
<input type=hidden name=email value="$email"> 
</form> 
&#125;
Is this correct

Code: Select all

<input type="submit" name="delete" value="Yes"> 
<input type=hidden name=email value="$email">

Posted: Fri Nov 29, 2002 4:09 pm
by abdul
I think there is an erron in your form itself.

Code: Select all

if ($delete == "Delete") 

&#123; 
<h3>Are You Sure</h3> 
<form action="edit.php" method="post" > 
<input type="submit" name="delete" value="Yes"> 
<input type=hidden name=email value="$email"> 
</form> 
&#125;
You have mixed php and HTML here. But, to get HTML on the screen either you have to "echo" the whole HTML or close "<?php" tag.

Code: Select all

<?php
if ($delete == "Delete") 
&#123; 
?>

<h3>Are You Sure</h3> 
<form action="edit.php" method="post" > 
<input type="submit" name="delete" value="Yes"> 
<input type=hidden name=email value="<?=$email?>"> 
</form> 

<?&#125;?>
Note the "<?= ?>" tag on the value of hidden field.

If this doesn't work, print the sql query on the browser, copy and run it directly on mysql.

Cheers!

-Abdul

Posted: Fri Nov 29, 2002 5:04 pm
by volka
some general tips might be helpful to improve your coding (since your name implies your are new to php Image :D).
  • in your php.ini there is a parameter error_reporting. Set it to E_ALL and you will see anything that php complains about. Very helpful to write "clean" code
  • but E_ALL is useless until you read the error/warning messages. You can either open the webserver's log (for apache this is the file error.log in the {apache_dir}/logs directory or set display_errors in php.ini to On (error messages are written to the document output stream i.e. readable in an HTML-doc). I prefer reading the log files and think display_errors=On is only advisable for development-only systems
  • take a look at viewtopic.php?t=3495 (of course not the only source) and choose one IDE to support you with syntax highlighting, syntax checking, autocompletion and so on
  • make intense use of the manual, it's quite good. http://www.php.net/manual/en/ (online version)
  • start with the very basics, like "why does anything happen at all?", "what are strings?" or "how do functions and loops work?". the first two chapters of the manual (I. Getting Started, II. Language Reference) might be good entry points
there are many, many more tips. Maybe someone else will provide some of them ;)

btw: <?= ?> only works if short tags are enabled
http://www.php.net/manual/en/configurat ... t-open-tag