Jump to content


Photo

Help with 2 Errors


  • Please log in to reply
No replies to this topic

#1 MxpUnk

MxpUnk
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 04 December 2005 - 03:33 PM

Well, I'm creating a form, that sends info the the db, so it will make a clan/crew/team, or whatever you wanna call them (for an online game) and when I go to the createcrew.php page (where the problem is occuring) I get some errors.

My errors:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/elitewar/public_html/createcrew.php on line 78

Fatal error: Cannot redeclare to_money() (previously declared in /home/elitewar/public_html/header.php:49) in /home/elitewar/public_html/header.php on line 49



My code:
<? include('header.php') ?>

<table width="100%">



                        <tr><td colspan="2" align="center">::.. Create Crew ..::</td></tr>



                <form name="form1" method="post" action="viewcrewprofile.php?view=$crew[id]">



                <tr><td><b>Name:</b></td><td><input name="name" type="text" id="$name" size="30"></td></tr>



                <tr><td><b>Rank1:</b></td><td><input name="r1" type="text" id="$rank1" size="15"></td></tr>



                <tr><td><b>Rank2:</b></td><td><input name="r2" type="text" id="$rank2" size="15"></td></tr>



                <tr><td><b>Rank3:</b></td><td><input name="r3" type="text" id="$rank3" size="15"></td></tr>



                <tr><td><b>Rank4:</b></td><td><input name="r4" type="text" id="$rank4" size="15"></td></tr>




                <tr><td colspan="2" align="center">Description</td></tr>



                <tr><td colspan="2" align="center"><textarea rows="5" cols="50" name="$description"></textarea></td></tr>



                <input type=hidden name="leader" value="20061">


                 



                </form>



                </table>
                 <form>

<Center> <form>
<input type=button value="Create Crew!"
 onClick="window.open('viewcrewprofile.php?vew=$crew[id]')">
</form>
<?php

$name = ($_POST['name']);
$rank1 = ($_POST['rank1']);
$rank2 = ($_POST['rank2']);
$rank3 = ($_POST['rank3']);
$rank4 = ($_POST['rank4']);
$description = ($_POST['description']);
if ($name || $rank1 || $rank2  || $rank3 || $rank4 || $description) {
   echo "
You must include all fields of the form. Try again.";   include('createcrew.php');   
exit;
}


$sql = "INSERT INTO `crew` VALUES ('', '$id' '$name', '$rank1', '$rank2', '$rank3', '$rank4', '$description')";
if (mysql_query($sql, $connect))
{
echo "Thank you $name, your crew was created!.";

 echo "Your crew id is $crew[id].";
 } else
{
include('createcrew.php');
echo "Sorry $stat[user], your crew could not be created."; }
?>
 </Center>






<script type="text/javascript" src="/i.js"></script>


I'm trying to make it, so if you dont fill out all fields, it asks you to fill them out.. But when I miss a field and click create, it doesn't give me any errors, or anything. It just refreshes to the page "viewcrewprofile.php". I'm also trying to make it so when you create, it creates a new crew, that include: $id, $name, $rank1, $rank2, $rank3, $rank4 $description, and i'd also like it to show the leader (the person who owns the crew), and also how many users there are. I'm stumped on the last 2, (leader, and total users) so that is also a part of my other question. :P


I've added the link, so when you click create, it goes to "crewprofile.php?view=crew[id]" - I'm not sure if that is correct, so thats another question. :D


I'm sorry for all the questions i just asked :D I guess you can say i'm stumped.. :D well if you know any problems, or see something wrong in my code, or know why the errors are occuring, please let me know. :) Also, if you know the leader, and total users problem, shout that! :)

Thank you, and hope you all can try and help! (ps: i didn't code the profile yet, would that have an effect?)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users