Alphabetical sorting help....
Moderator: General Moderators
- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
Do this after you make the INSERT statement but before the query is executed and show me what you get.
Code: Select all
echo $add_all;yes i did that but still did the same thing until i messed up on how you wanted me to do it here is what the scripts looks like now after i inserted that code you gave me..
Code: Select all
<?
if(isset($_GETї'commented']))
{
// Tell the user it has been submitted (optional)
echo('Your comment has been posted.');
// Set Mysql Variables
$host = 'localhost';
$user = 'smackie';
$pass = 'deketazz';
$db = 'haunted_poetry';
$table = 'dbpoems';
// Set global variables to easier names
$username = $_GETї'uname'];
$poem = $_GETї'poem'];
// Connect to Mysql, select the correct database, and run teh query which adds the data gathered from the form into the database
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
echo $add_all = "INSERT INTO $table values("$username","$poem")";
mysql_query($add_all) or die(mysql_error());
}
else
{
echo $add_all;
// If the form has not been submitted, display it!
?>
<form method='get' action='<? echo $PHP_SELF; ?>'>
Username: <input type='text' name='username'><br><br>
Poem: <input type='text' name='poem'><br><br>
<input type='submit' value='Post your poems'>
</form>
<?
}
?>- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
Actually I meant like this
Code: Select all
$add_all = "INSERT INTO $table values("$username","$poem")";
echo $add_all;
mysql_query($add_all) or die(mysql_error());- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
If I had looked up toward the top of your code I would have probably seen the problem earlier....
Change this
To
Change this
Code: Select all
if(isset($_GETї'commented']))
{Code: Select all
if ((isset($_GETї'username']) == true) && (isset($_GETї'poem']) == true))
{
Last edited by smpdawg on Sat Mar 05, 2005 1:24 am, edited 1 time in total.