virtuexru Posted December 6, 2006 Share Posted December 6, 2006 I know it's probably something really simple.. but the page only shows up to the point where it echos this line:[b]You have not uploaded a resume yet, please do so now.[/b]It doesn't show the upload form or anything below it??[code] <?php include 'config.php'; include 'opendb.php'; $ncheck= $_SESSION['results'][fullname]; $query = "SELECT id, name FROM resumes WHERE name = '$ncheck'"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "<b>You have not uploaded a resume yet, please do so now.</b><br>"; if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_SESSION['results'][fullname]; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } $query = "INSERT INTO resumes (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, upload failed'); echo "File <b>".$fileName.".doc</b> uploaded Thank you.<br>"; ?> <p/><b><font color="red">Important: Only Word Documents and Rich Text are allowed.</font></b> <br/><b>Your file name will be automatically converted to your first and last name. <br/>For example: <font color="red">John Doe.doc</font>.</b> <form method="post" enctype="multipart/form-data"> <table width="350" border="0" cellpadding="1" cellspacing="1"> <tr> <td> <input type="hidden" name="MAX_FILE_SIZE" value="500000"> <input name="userfile" type="file" id="userfile"> </td> </tr> </table> <br/> <input name="upload" type="submit" class="box" id="upload" value=" Upload "> </form> <? } include 'closedb.php'; } else { while(list($id, $name) = mysql_fetch_array($result)) { ?> <p/>You have already uploaded a resume. To view it, please click here: <a href="download.php?id=<?=$id;?>"><?=$name;?></a><br/> <i>To delete this resume and upload a newer version, please click <a href="#">here</a>.</i> <? } } ?> [/code] Link to comment https://forums.phpfreaks.com/topic/29724-argh-this-is-killing-me/ Share on other sites More sharing options...
roopurt18 Posted December 6, 2006 Share Posted December 6, 2006 I didn't look really hard, but nothing jumped out at me.Usually when I have a problem like this I just insert:[code]echo 'hi2u';[/code]at the last point that echo'ed. Then I just cut -> paste and move that line down the page until it stops displaying. Then you know where it blew up. Link to comment https://forums.phpfreaks.com/topic/29724-argh-this-is-killing-me/#findComment-136457 Share on other sites More sharing options...
marcus Posted December 6, 2006 Share Posted December 6, 2006 Try:[code]<?php include 'config.php'; include 'opendb.php'; $ncheck= $_SESSION['results'][fullname]; $query = "SELECT id, name FROM resumes WHERE name = '$ncheck'"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "<b>You have not uploaded a resume yet, please do so now.</b><br>"; }else if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_SESSION['results'][fullname]; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } $query = "INSERT INTO resumes (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, upload failed'); echo "File <b>".$fileName.".doc</b> uploaded Thank you.<br>"; ?>[/code] Link to comment https://forums.phpfreaks.com/topic/29724-argh-this-is-killing-me/#findComment-136461 Share on other sites More sharing options...
marcus Posted December 6, 2006 Share Posted December 6, 2006 All I saw was you not closing the first if statement Link to comment https://forums.phpfreaks.com/topic/29724-argh-this-is-killing-me/#findComment-136462 Share on other sites More sharing options...
virtuexru Posted December 6, 2006 Author Share Posted December 6, 2006 The else is on the bottom, if there are no rows for that user,t hat means he HAS NOT uploaded anything, then it allows him to. Link to comment https://forums.phpfreaks.com/topic/29724-argh-this-is-killing-me/#findComment-136467 Share on other sites More sharing options...
roopurt18 Posted December 6, 2006 Share Posted December 6, 2006 You can typically find the source of the error using a simple echo statement and if necessary block comments ( /* comment */ );Try it! Link to comment https://forums.phpfreaks.com/topic/29724-argh-this-is-killing-me/#findComment-136503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.