Jump to content

MxpUnk

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MxpUnk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey everyone, i'm re-coding a register page, and i've run into this error: Fatal error: Call to a member function on a non-object in /home/cjnalsn1/public_html/site/register.php on line 11 and i went to find it on line 11, and saw the error, so I fixed it so it would connect right, but i am still getting the same error. Anyone know? lines that its saying the error is on: [code] } $name_check = $db_object->query("SELECT username FROM members WHERE username = '".$_POST['username']."'"); if (DB::isError($name_check)) {         die($name_check->getMessage());     } $name_checkk = $name_check->numRows();     if ($name_checkk != 0) {         die('Sorry, the username: <strong>'.$_POST['username'].'</strong> is already in use, please choose a new username, and try again.');     }[/code]
  2. 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. 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. I'm sorry for all the questions i just asked I guess you can say i'm stumped.. 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?)
  3. [!--quoteo(post=319252:date=Nov 16 2005, 03:43 PM:name=GraceandCo)--][div class=\'quotetop\']QUOTE(GraceandCo @ Nov 16 2005, 03:43 PM) 319252[/snapback][/div][div class=\'quotemain\'][!--quotec--] Access denied for user: 'gracecod_simple@localhost' to database 'gracecod_simpleauth' The obove error is just a connecting to the database error. It's simple to fix. 1. You can edit the below code to match you're database. $conn = connectToDB($dbhost,$dbuser,$dbpass,$dbname); function connectToDB($dbhost,$dbuser,$dbpass,$dbname) { $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error()); mysql_select_db($dbname,$conn) or die(mysql_error()); return $conn; Also, if you already have a connect.php file for your site, that is correct, you can do <?php include('connect.php'); ?> That does the same thing as you had, so. If you don't have a connect.php file, I would make one.. <?php ob_start(); @mysql_connect("localhost","db_name","password") or die(' <link href=style.css rel=stylesheet> <Br> Down <br> Could not connect; ' . mysql_error()); mysql_select_db("db_name"); ?> The above is how I make my connect.php, there are some other ways.. But like I said if you dont have connect, you might want it Also: $dbhost="localhost:8080"; $dbuser="gracecod_simple"; $dbpass="*"; $dbname="gracecod_simpleauth"; Just checking, but the $dbname you're connecting too could be wrong too. Well anyway, I tried to explain this in simplist form, and as I said it's VERY simple to overcome. Just change the db names around, and connect, and you've got it! [!--quoteo(post=319252:date=Nov 16 2005, 03:43 PM:name=GraceandCo)--][div class=\'quotetop\']QUOTE(GraceandCo @ Nov 16 2005, 03:43 PM) 319252[/snapback][/div][div class=\'quotemain\'][!--quotec--] Access denied for user: 'gracecod_simple@localhost' to database 'gracecod_simpleauth' The obove error is just a connecting to the database error. It's simple to fix. 1. You can edit the below code to match you're database. $conn = connectToDB($dbhost,$dbuser,$dbpass,$dbname); function connectToDB($dbhost,$dbuser,$dbpass,$dbname) { $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error()); mysql_select_db($dbname,$conn) or die(mysql_error()); return $conn; Also, if you already have a connect.php file for your site, that is correct, you can do <?php include('connect.php'); ?> That does the same thing as you had, so. If you don't have a connect.php file, I would make one.. <?php ob_start(); @mysql_connect("localhost","db_name","password") or die(' <link href=style.css rel=stylesheet> <Br> Down <br> Could not connect; ' . mysql_error()); mysql_select_db("db_name"); ?> The above is how I make my connect.php, there are some other ways.. But like I said if you dont have connect, you might want it Also: $dbhost="localhost:8080"; $dbuser="gracecod_simple"; $dbpass="*"; $dbname="gracecod_simpleauth"; Just checking, but the $dbname you're connecting too could be wrong too. Well anyway, I tried to explain this in simplist form, and as I said it's VERY simple to vercome. Just change the db names around, and connect, and you've got it!
  4. MxpUnk

    Msql Help!!

    W000T I finally fixed it. I feel like a total idiot also. It was the most simple mistake in the entire world. My Code now: <?php $view=$_GET['id']; $q = "SELECT * FROM players WHERE id='$id'"; $result = mysql_query($q) or die ("Could not execute query : $q." . mysql_error()); $view = mysql_fetch_array($result, MYSQL_ASSOC); if (empty($view['id'])) { print "I'm sorry there is no user with that ID Please Try again."; include("footer.php"); exit; } LOL, I had <?php $id=$_Get['id']; which was my problem! thanks for the help everyone! (Im recruiting some people to help admin the game, and code, so if you wanna help out a sweet job, message me!)
  5. MxpUnk

    Msql Help!!

    oh well, I guess nothings working. I've kinda ignored the whole matter for a few days and started on some other parts of the game, but I keep coming back to this problem, and this is the main thing that I need to fix. :| well, if anyone has any more ideas, please post! All are appreciated!
  6. MxpUnk

    Msql Help!!

    no, daviddj, sorry to say it didn't work. Just gave me more errors. New error: White screen with; Parse error: parse error, unexpected ']' in /home/elitewar/public_html/view.php on line 43
  7. MxpUnk

    Msql Help!!

    Ok, fixed that problem with the screen shot. it was just a typing error. But now i'm back to my original problem. lol..
  8. MxpUnk

    Msql Help!!

    Oh shit. I tried what i was told to do, and then i put back in my old code. Usually I get that error but this time I didn't. But theres still a problem. It SEMI works. I don't get any errors, but look i get all my code on the page with the layout and all. I'll show a screen shot, hold on let me get it. http://i6.photobucket.com/albums/y227/Xelerate/favor.jpg Thats what im getting now.. :-/ atleast it SEMI works. Please help, and thanks for the help so far!
  9. MxpUnk

    Msql Help!!

    tried that. didn't work
  10. MxpUnk

    Msql Help!!

    alright let me give it a try. and thanks for for helpin
  11. MxpUnk

    Msql Help!!

    When i added that echo mysql_error(); i got the following: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/elitewar/public_html/view.php on line 7 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 '' at line 1No such player.
  12. MxpUnk

    Msql Help!!

    Here is part of the code.. I didn't know if this is where i'm getting the error, but it was the only place that seemed logical to be getting an error... So here is the code.. like i said before im still a noob at this, so if i seem like a retard im sorry im trying to learn Code <?php $id=$_GET['id']; $view = mysql_fetch_array(mysql_query("select * from players where id=$id")); if (empty ($view['id'])) { print "No such player."; include("footer.php"); exit; } Error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/elitewar/public_html/view.php on line 7 No such player.
  13. MxpUnk

    Msql Help!!

    Hey, thats a ton man.!! Let me try this, and repost my results.
  14. MxpUnk

    Msql Help!!

    I'm creating a game, strictly using PhP, and Mysql. I'm very new to both, but good enough to manage through making this, but suddenly I have gotten stuck on something. I'm getting an error as follows: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/elitewar/public_html/view.php on line 7 No such player. I'm not sure.. I'm stumped... f you know what this is, please contact me at; haggardskater57@gmail.com help would be greatly appreciated.!
×
×
  • 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.