Jump to content

LOUDMOUTH

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

About LOUDMOUTH

  • Birthday 12/08/1981

Contact Methods

Profile Information

  • Gender
    Male
  • Location
    CA.

LOUDMOUTH's Achievements

Member

Member (2/5)

0

Reputation

  1. Dont know much about this is why I am asking, looks to me like there should be a space in between, but still throws error
  2. I am trying to query this and am getting a syntax error, am I doing this completely wrong? haha query -- Table structure for table `adds` CREATE TABLE IF NOT EXISTS `adds` ( `id` int(10) NOT NULL auto_increment=1, `fid` int(15) default NULL, `added` int(15) defaultNULL, PRIMARY KEY (`id`), KEY `fid` (`fid`) ) TYPE=MyISAM AUTO_INCREMENT=2058469 ; -- Dumping data for table `adds` -- Table structure for table `admin` -- CREATE TABLE IF NOT EXISTS `admin` ( `id` int(10) NOT NULL auto_increment, `admin` varchar(10) NOT NULL, `password` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `username`, `password`) VALUES (1, 'username', 'password'); error i am getting Error SQL query: -- Table structure for table `adds` CREATE TABLE IF NOT EXISTS `adds` ( `id` int( 10 ) NOT NULL AUTO_INCREMENT =1, `fid` int( 15 ) default NULL , `added` int( 15 ) defaultNULL, PRIMARY KEY ( `id` ) , KEY `fid` ( `fid` ) ) TYPE = MYISAM AUTO_INCREMENT =2058469; MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=1, `fid` int(15) default NULL, `added` int(15) defaultNULL, PRIMARY KE' at line 2
  3. Thanks Ruzzas, wokrs
  4. Here is the site so you can see live. http://pledgeresistance.com/guestbook.php
  5. Please Help I have a guestbook I am trying to setup and am having a problem getting the info to insert into the DB The info calls fine when I manually insert the info into the DB but only calls the time "ID" and "DATE" when I try to enter a guestbook submission on the site. here is what I have DB CREATE TABLE `guestbook` ( `id` int(4) NOT NULL auto_increment, `name` varchar(65) NOT NULL default '', `email` varchar(65) NOT NULL default '', `comment` longtext NOT NULL, `datetime` varchar(65) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; guestbook.php <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong>Test Sign Guestbook </strong></td> </tr> </table> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form id="form1" name="form1" method="post" action="addguestbook.php"> <td> <table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><input name="name" type="text" id="name" size="40" /></td> </tr> <tr> <td>Email</td> <td>:</td> <td><input name="email" type="text" id="email" size="40" /></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><textarea name="comment" cols="40" rows="3" id="comment"></textarea></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </td> </form> </tr> </table> <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong><a href="viewguestbook.php">View Guestbook</a> </strong></td> </tr> </table> addguestbook.php <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="guestbook"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $datetime=date("y-m-d h:i:s"); //date time $sql="INSERT INTO $tbl_name(name, email, comment, datetime)VALUES('$name', '$email', '$comment', '$datetime')"; $result=mysql_query($sql); //check if query successful if($result){ echo "Successful"; echo "<BR>"; echo "<a href='viewguestbook.php'>View guestbook</a>"; // link to view guestbook page } else { echo "ERROR"; } mysql_close(); ?> <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong>View Guestbook | <a href="guestbook.php">Sign Guestbook</a> </strong></td> </tr> </table> <br> <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="guestbook"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td>ID</td> <td>:</td> <td><? echo $rows['id']; ?></td> </tr> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><? echo $rows['name']; ?></td> </tr> <tr> <td>Email</td> <td>:</td> <td><? echo $rows['email']; ?></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><? echo $rows['comment']; ?></td> </tr> <tr> <td valign="top">Date/Time </td> <td valign="top">:</td> <td><? echo $rows['datetime']; ?></td> </tr> </table></td> </tr> </table> <BR> <? } mysql_close(); //close database ?> lights joint*
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.