zelllibin Posted September 2, 2008 Share Posted September 2, 2008 HI. i have a script below. it seems that there is some error. k anyone help me???? Fatal error: Function name must be a string in C:\wamp\www\php_project\final\member\addpage.php on line 31 <?php // If our form has NOT been submitted.... if (!isset($_POST['submitted'])) { ?> <h3>Add Your Site</h3> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <p><b>Name :</b> <input type="text" name="name" size="25" maxlength="40" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" /></p> <p><b>Site URL :</b> <input type="text" name="url" size="25" maxlength="60" value="<?php if (isset($_POST['url'])) echo $_POST['url']; ?>" /></p> <p><b>Description :</b><br /> . <textarea name="description" rows="5" cols="40"><?php if(isset($_POST['description'])) echo $_POST['description']; ?></textarea></p> <p><div align="center"><input type="submit" name="submit" value="Add Site" /></div> <input type="hidden" name="submitted" value="TRUE" /> </form> <?php } else { // If the form HAS been submitted, continue. // Connect to your database require_once('../mysql_connect.php'); if (empty($_POST['name'])) { echo '<font color="red">Please enter in a name for your site.</font><br />'; $n = FALSE; } else { $name = $_POST['name']; $query = "SELECT id, name FROM websites WHERE name = '$name'"; $result = mysql_query($query) OR die($mysql_error()); $num = mysql_num_rows($result); } if (empty($_POST['url'])) { echo '<font color="red">Please enter in a URL for your site.</font><br />'; $u = FALSE; } else { $u = mysql_real_escape_string($_POST['url']); } if (empty($_POST['description'])) { echo '<font color="red">Please enter in a description for your site.</font><br />'; $d = FALSE; } else { $d = mysql_real_escape_string($_POST['description']); } if ($n && $u && $d) { $query = "INSERT INTO websites (name, url, description, password) VALUES ('$n', '$u', '$d', SHA('$p'))"; $result = mysql_query($query) OR die(mysql_error()); if ($result) { echo '<h3>Site Added!</h3> <p>Your site has been added into your database, you may now take the code below and add it to your site so people can start voting!</p>'; } } $query = "SELECT id, name FROM websites WHERE name = '$n'"; $result = mysql_query($query) OR die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); } ?> Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/ Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 can u point out line 31? Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-631996 Share on other sites More sharing options...
PFMaBiSmAd Posted September 2, 2008 Share Posted September 2, 2008 You have a $ in front of a function name. Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-631997 Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 You have a $ in front of a function name. Just pointing out it is not technically illegal to do so in php but probably the correct answer. Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-632001 Share on other sites More sharing options...
zelllibin Posted September 2, 2008 Author Share Posted September 2, 2008 line 31===== $result = mysql_query($query) OR die($mysql_error()); Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-632011 Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 as stated the $ infront of $mysql_error is the issue unless u set a variable to be $mysql_error which is the name of the function you wish to be exectued Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-632014 Share on other sites More sharing options...
zelllibin Posted September 13, 2008 Author Share Posted September 13, 2008 ok i removed the $ . when i click submit. it turn into blank page... it seems not work... please help... Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-640371 Share on other sites More sharing options...
PFMaBiSmAd Posted September 13, 2008 Share Posted September 13, 2008 You are probably getting a fatal parse or fatal runtime error. When learning php, developing php code, or debugging php code, you should have error_reporting set to E_ALL and display_errors set to ON in your php.ini file to get php to help you (stop and start your web server to get any changes made to php.ini to take effect.) Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-640412 Share on other sites More sharing options...
zelllibin Posted September 15, 2008 Author Share Posted September 15, 2008 i did on php.ini file. and it did not enter the data to my database and the script return blank when i entered any data// Link to comment https://forums.phpfreaks.com/topic/122395-need-help-form/#findComment-641734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.