Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To start with, I would suggest </p> <p>1) to check whether or not your PHP is called 2) to check what it is doing and what are the results.</p> <p>If you don't have the tool box to do so, here are some useful functions:</p> <pre><code>function PrintLog($string) { if (! BDEBUG) return ; $logDir = LOGPATH; if (! file_exists($logDir)) { umask(000); if (! mkdir($logDir, 0777)) ErrorLog("Failed to create Directory $logDir"); chmod($logDir, 0777); } $fplog = @fopen($logDir.'/'.'debug-'.date('Y-m-d').'.log', 'a'); if ($fplog) { fwrite($fplog, date("d-m-Y H:i:s")."\t".$string); fwrite($fplog, "\n"); fclose($fplog); } } function PrintrLog(&amp;$arrayToDump, $strName = '') { ob_start(); print_r($arrayToDump); PrintLog("$strName = ".ob_get_contents()); ob_end_clean(); } </code></pre> <p>Insert in your PHP script those function and the code:</p> <pre><code>define("BDEBUG", true); define("LOGPATH", "./log/"); PrintrLog( $_POST); </code></pre> <p>Then, have a look to the log file generated. If nothing, look at your Apache logs, may be some error will be here waiting for you to fix. If log is here, check if the POST is how it should be, then it's probably a problem in your SQL. I don't know much about your DB schema, but intuitively, I would write something more like that :</p> <pre><code>$my_query = "INSERT INTO lotteries (started, duration, ticket_price, win_percentage, description,available) VALUES ('$started', '$duration', '$ticket_price', '$win_percentage', '$description', '$available')"; PrintLog($my_query); // Take it from logs, and run it manually inPHPmyAdmin to debug it eaily </code></pre> <p>You can add this this kind of function too in your toolbox:</p> <pre><code>function ExecQuery($Cnx, $baseName, $query, &amp;$sqlError) { PrintLog($query); $result = mysql_query($query, $Cnx); if (! $result) { $sqlError = "ERROR: Failed to execute query '$query' [".mysql_errno().': '.mysql_error().']'; PrintLog($sqlError); return false; } return $result; } </code></pre> <p>I hope this will help you in your current and future investiguations ;-)</p> <p>PS: You should also think about using such a function to systematicaly avoid SQL injection:</p> <pre><code>function getPostValue($name) { if (! isset($_POST[$name])) return ''; return(mysql_real_escape_string($_POST[$name])); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload