Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 29447

php help PLz

$
0
0
Can Someone Look at my code and tell me what is wrong
My insturctor says that we are creating a bog report system
When you click Create bug > it takes you to a form to create a bug then when you click submit it suppose to create a table in a database that is already created and fields here is my code for that
PHP Code:

<?php $required = array('bdesc''ldesc''actaken');
$error FALSE;
foreach(
$required as $field){
    if (empty(
$_POST[$field])){
        
$error TRUE;
    }
}
if (
$error){
    echo 
"All Fields are required.";
    echo 
"<p><a href ='NewBug.php'>Click here to go back</a></p>";
}else {
    include (
'config.php');
if (
$dbconnect !== FALSE) {
    
$Tablename "4530ceevulukwu";
    
$SQLstring "SHOW TABLES LIKE '$Tablename'";
    
$QueryResult Mysql_query($SQLstring,$dbconnect);
    if (
mysql_num_rows($QueryResult) == 0){
        
$SQLstring "CREATE TABLE 4530ceevulukwu (ticketID SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY, bdesc CHAR(80), ldesc CHAR(100), actaken CHAR(100))";
        
$QueryResult Mysql_query($SQLstring$dbconnect);
        if (
$QueryResult === FALSE)
            echo 
"<p> Unable to create the reporting system table.</p>"."<p>Error Code" .mysql_errno($dbconnect). ":" .mysql_error($dbconnect) . "</p>";
            else 
            echo 
"<p> sucessfully created the the reporting table.</p>";
    }    
    
     
$SQLstring "INSERT INTO $Tablename (bdesc, ldesc, actaken) VALUES ('$bdesc', '$ldesc', '$actaken')";
     
$QueryResult Mysql_query($SQLstring$dbconnect);
     if (
$QueryResult === FALSE) {
         echo 
"<p> unable to insert the values into the report table.</p>"."<p> Error code" .mysql_errno($dbconnect).":" mysql_error($dbconnect) . "</p>";
        
     }else {
            
$ticketID mysql_insert_id($dbconnect);
            echo 
"<h1>Entry Saved</h1>\n";
            echo 
"<p>Robo System assigned your ID as $ticketID.</p>\n";
            echo 
"<p><a href='Project4.php'>Back to Bug Main Page</a></p>";
        
     
     }
      
mysql_close($dbconnect);

 }
 
}



?>


Now after that there should be a link that you can click on that views all the bugs you have created in the sql on a table
here is my code
PHP Code:

<?php
include ('config.php');
if (
$dbconnect !== FALSE){
$Tablename "4530ceevulukwu";
$SQLstring "SELECT * FROM $Tablename";
$QueryResult mysql_query($SQLstring);
if (
$QueryResult === FALSE)
echo
"<p> unable to execute the query.</p>""<p>Error code"mysql_errno($dbconnect). ":"mysql_error($dbconnect). "</p>";
echo 
"<table width ='100%' border='1'>\n";
echo 
"<tr><th>ID</th><th>Brief Description</th><th>Long Description</th><th>Resolution/Action Taken</th></tr>\n";
while ((
$Row mysql_fetch_array($QueryResult))) {
    echo 
"<tr><td>".$Row['ticketID']."</td><td>"$Row['bdesc']."</td><td>".$Row['ldesc']."</td><td>".$Row['actaken']. "</td></tr>\n";
}
echo 
"</table>\n";
echo 
"<p><a href='Project4.php'>Back to Bug Main Page</a></p>";
mysql_close($dbconnect);
}
?>

BTW forgot to mention that the cofig file is just a connector to the database
MY question is for some reason when i go to view all the bugs nothing shows up just numbers

i really dont know the error i did here

Viewing all articles
Browse latest Browse all 29447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>