Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. the OR statement should do it, how are you displaying your results?
  2. ok - try this: $insert_query = "INSERT INTO users (username, height_above, mb_diff, alternative) VALUES ('$username', '$height_above', '$mb_diff', '$alternative')"; $insert_action = mysql_query($insert_query) or die ('Error Dring Insert :<br>'.mysql_error().'<br><br>Error occured running the following code :<br>'.$insert_query); that is replace your current mysql_query("INSERT INTO users (username, height_above, mb_diff, alternative) VALUES ('$username', '$height_above', '$mb_diff', '$alternative'"); which is missing the closing bracket from the VALUES statement in the SQL...
  3. I mean that there is condition within the code that sais "if this form was just posted and I am to display it again, display the form using the information that was just entered --or-- display the form with the info from the database" I was asking which is being returned - the information that you input, or the database info. This will help establish if the problem is with the recognition of the POST content or not. anyway, I got to turn in for the night, I'll look back in on it in the morning.
  4. you're not actualy selecting anything...
  5. because with your AND your condition is saying "return records which have the folder field equal to BOTH blog AND politics AT THE SAME TIME" which is of cource impossable.
  6. as I said, explicitly name the fields that you want to select ie. SELECT username, age, country, sex FROM user_table WHERE user_table.userID = 1 of cource you wouldn't actualy store someones age in a table, you would store their date of birth and calculate their age - since a persons age isn't a constant, but you get the idea.
  7. ok, if the form is coming back up, and no output from $message is telling you there was a problem, are the values in the form the database values or the post values that you entered?
  8. if you want me to write you a login script were going to need to start talking prices, I'll help you out for free, but I (and a lot of other people here) will chargeyou if you it all done for you . let me look into the issue.
  9. $input1 = $_GET['value1']; $input2 = $_GET['value2']; $input3 = $_GET['value3']; if((trim($input1) == '')&&(trim($input2) == '')&&(trim($input3) == '')){ //do something if all values are empty } elseif((trim($input1) != '')&&(trim($input2) == '')&&(trim($input3) == '')){ //do something if only the 1st value is used } // etc. for all the other permutations
  10. For the variable stuff just assign the variables, as you have the other ones at the start of the page, to whatever the corresponding input name is in the form that is posting the information through to this page. As for the error reporting, you would be best to edit this in the php.ini file and then restart your http server. there are instructions in the php.ini file ate the relevent location, also you can google how to turn on error reporting in php.ini for further guides.
  11. You only need the one query, and you shouldn't use SELECT * - name the field(s) that you want to return explicitly. what you want can be done using if and substr. see http://php.net/manual/en/function.substr.php for info about substr use
  12. you're welcome, and this is a good forum, there are a lot of verry good coders on here - of which I am not one, but I can help with the basics now and then
  13. ok, still not updateing, so what IS it doing? does it error out? does it hide the form as though it has performed the update? what is your actual table structure that you are inserting the information into?
  14. it's just echo $url_event_id; NOT echo $url_event_id['url_event_id']; and please post up your code within the php tags next time, I can't view an attachment while writing a reply...
  15. you still havn't changed the line that runs the insert to what I showed you (or put an or die() statement on there either...)
  16. right, swap in the following code section for what is there already. //We edit the user informations $update_q = "UPDATE users SET username = '$username', password = '$password', email = '$email', description = '$description' " . "keywords = '$keywords', logo = '$logo', webclient = '$webclient', forums = '$forums', hiscores = '$hiscores', chatbox = '$chatbox', " . "staff = '$staff', newstitle = '$newstitle', newsimage = '$newsimage', news = '$news', op1 = '$op1', op2 = '$op2', op3 = '$op3' " . "WHERE id = ".mysql_real_escape_string($_SESSION['userid']); $update_action = mysql_query($update_q) or die ('ERROR! Unable to perform update<br>'.mysql_error().'<br><br>This error occured while atempting to run the following code:<br>'.$update_q); if (mysql_affected_rows() > 0) { //We dont display the form $form = false; //We delete the old sessions so the user need to log again unset($_SESSION['username'], $_SESSION['userid']); ?> I have made the assumption that the id field in your WHERE clause is numerical, as such I have removed the quotes from arround the variable. if there are any other fields that are of type Integer you should remove the quotes from the associated variables there too. Let me know how you get on.
  17. OK, I'll have a go at it, just gimme 5 mins.
  18. doesn't look like there is anything wrong with the braces,string is however malformed: echo '<a href="http://localhost/swb/planet.php?recordID= '$row_cats['CatName'];/"> <p class="rmoncalamari tmoncalamari">' . $moncalamari. "1-1-2-6".'</p></a>'; should look more like: echo '<a href="http://localhost/swb/planet.php?recordID='.$row_cats['CatName'].'/"> <p class="rmoncalamari tmoncalamari">' . $moncalamari. "1-1-2-6".'</p></a>';
  19. it's not a permissions issue. try echo '<a href="http://<your_domain>/'.$filename.'">Check File Name</a>'; (where <you_domain> is actualy your domain) and then click the link to see what happens.
  20. Do the same thing with the update SQL that you did for the select and see where you get.
  21. ok, the problem with the connection is that you are over writing the contents of $username before you run the connection string. so you now have the form input user name rather than the database connection user name. rather than just having or die("cannot connect to server for fuck sake this is driving me potty"); use or die ('Error During Connect:<br>'.mysql_error()); This will let you see what error the database is returning. Now, change $username = "VinnyG"; to $usr = "VinnyG"; and then update your mysql_connect to be mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error()); that should get your connection sorted out. you should change all your or die() statements that are attached to the use of mysql functions to report the mysql_error() as well as hold some statement relevent to what the php was trying to do when the error occured. To handle the INSERT INTO you just name the fields that you want to the values inserted into in the order that you are presenting the values to the table. mysql_query("INSERT INTO users (username, height, difference, alternative) VALUES ('bob', 10, 5, 'something different')" Notice that any values that are being insert that are not integers are not wraped in single quotes and that there are spaces after every comma.
  22. don't use SELECT * - explicitly list each field name. That said - have you tried doing a vardump of the $_GET array after the search button is clicked to make sure you are getting the right values passed?
  23. that and using or die() to manage the return of SQL errors.
  24. look more at the method the form is using - then compare this to the REQUEST_METHOD you set on the other page.
×
×
  • 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.