nathanmaxsonadil Posted July 30, 2007 Share Posted July 30, 2007 I've got more problems.. my code does not insert any data into the mysql table except space My Php code is <?php include 'header.php'; ?> <div id="content"> <div id="columnsC"><br/> <a href="http://www.stixy.com"><img style="border:0;" src="siteimg/stixy.jpg" alt="stixy"/></a><Br/> <p>Stixy helps users organize their world on flexible, shareable Web-based bulletin boards called Stixyboards. Unlike most personal productivity or project management software, Stixy doesn't dictate how users should organize their information. Users can create tasks, appointments, files, photos, notes, and bookmarks on their Stixyboards, organized in whatever way makes sense to them. Then they can share Stixyboards with friends, family, and colleagues.</p> </div> <div id="columnsD"> <? /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ $dbh=mysql_connect ("localhost", "my_username", "my_pass") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("my_db"); echo "<ul>"; echo "<li><a href='stixy.php?insert=1'>Add your self to the list</a></li>"; if(isset($_GET['insert']) && $_GET['insert'] == '1'){ $sql = "INSERT INTO `emailists` (`stixy`) VALUE ('" . $email . "')"; if($sqlres = mysql_query($sql)){ echo 'email address added'; }else{ echo mysql_error(); } } $sql = "SELECT stixy FROM emailists"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<li>"; echo $row['stixy'] . "</li>"; } } } echo "</ul>"; } else{ ?> <br/> <p style="border-style: solid; border-width: 3px;"><b>To Invite people or add yourself to the list you need to either login or if you dont have an account signup</b></p> <? } ?> </div> <?php include 'sidebar.php'; ?> <div style="clear: both;"> </div> </div> <?php include 'footer.php'; ?> I want it to insert the email of the logged in user the login script I'm using is http://www.evolt.org/article/PHP_Login_System_with_Admin_Features/17/60384/index.html Quote Link to comment https://forums.phpfreaks.com/topic/62398-solved-php-and-mysql-help/ Share on other sites More sharing options...
trq Posted July 30, 2007 Share Posted July 30, 2007 You should be getting an error because of an syntax error in your sql. This... $sql = "INSERT INTO `emailists` (`stixy`) VALUE ('" . $email . "')"; should be... $sql = "INSERT INTO emailists (stixy) VALUES ('" . $email . "')"; + Where do you define $email ? Quote Link to comment https://forums.phpfreaks.com/topic/62398-solved-php-and-mysql-help/#findComment-310553 Share on other sites More sharing options...
nathanmaxsonadil Posted July 30, 2007 Author Share Posted July 30, 2007 I did not define $email I was wondering how to do it with the login script I linked to above Quote Link to comment https://forums.phpfreaks.com/topic/62398-solved-php-and-mysql-help/#findComment-310556 Share on other sites More sharing options...
Loran Posted August 3, 2007 Share Posted August 3, 2007 require() or include() You might want to read up on them a bit though, or ask someone more knowledgeable. Quote Link to comment https://forums.phpfreaks.com/topic/62398-solved-php-and-mysql-help/#findComment-314618 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.