Jump to content

public-image

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

public-image's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Not quite, my sign up script would add a row for each member to users right... but you might wish to add certain information used from your registration page to other tables too... like the table 'badges' and I forgot to add this and so the rows for when a user registers have not been being added to the table 'badges'. (But yes they are being registered) although my question is, is there a way to take all the registered users in some sort of query and make the code add the rows for every user registered into the table 'badges'. E.g. I have 3 members is there a way that a PHP code could collect the amount of users you have in a table and possibly their username and in a query add a row into another table using the data of the user it collects E.g. Users - id 1 - username: Bob id 2 - username: Sally id 3 - username: CJ >>> Collects rows (3) >>> Inserts row into table 'badges' using information collected from the a user or in my case insert a row for every user in the 'users' table and put 1 row into 'table' specific for this user So when you do a SELECT you would say in table badges where username ='Bob' every user registered would then have a row specific to them... Hope this helped
  2. Hi I haven't really looked around for help on this code and so would be hopeful that someone from PHP Freaks could help me out. Okay I have a table called badges which on registration I should have put a MYSQL insert rows into, but I forgot and now it doesn't have the rows for the users that are currently registered. Is there a PHP code I could do that would select every user in my 'users' table and be able to create a row (or two) for every individual counted in the 'users table' therefore the rows would then be inserted for those who are registered... Thanks
  3. Okay I tried both; with the rows if statement for the while it returns; Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in file on line 233 Line 233: if (mysql_num_rows($q) > 0) { // I did remember to close the bracket so thats not the problem. --- Case 2 --- When I changed the code I got; Problem with the query: SELECT * FROM `posts` WHERE special='123456' ORDER BY `id` ASC LIMIT -10, 10 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 '-10, 10' at line 1 Which I believe is referring to the variables in the pagination code: $prows = 10; $pn = $page - 1; $pn = $pn * $prows; $lastp = ceil($rows / $prows);
  4. Hello everyone, il try to explain how my pagination works in an effort for you to understand clearly what the code is looking at and what might be causing my error. My pagination is being used on a view topic/post page. There are two gets on my page $page = $_GET['p']; // used to define which page of pagination the user is requesting / looking at $ids = $_GET['id']; // used to collect data from row for topic and its replies My error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in FILE on line 233 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 '-10, 10' at line 1 Variables you may want to know: $query3 = mysql_query("SELECT * FROM `posts` WHERE special='$ids'") or die (mysql_error()); while ($row3 = mysql_fetch_array($query3)); $rows = mysql_num_rows($query3); $pn = $page - 1; $pn = $pn * $prows; $lastp = ceil($rows / $prows); $prows = 10; // amount of rows/replies allowed per page This line (233 is): $q = mysql_query("SELECT * FROM `posts` WHERE special='$ids' ORDER BY `id` ASC LIMIT $pn, $prows"); while($f = mysql_fetch_array($q)); // this searches the table posts to find replies that have the special id same as the id in the URL (HOWEVER) I found that this problem only occurs when there is only a begining post thus being no replies for that topic yet. On other topics with replies the error is gone. Any help would be great and if you require any more information please just ask.
  5. setcookie("display", $display, time()+60*60*24*365, "/", ""); I use something like the above with the / but that has the with and without www. too although if you have cpanel access on your site im sure your allowed to permit whether everyone entering must have www. or not im sure its a feature.
  6. setcookie("display", $display, time()+60*60*24*365, ".yoursite.com", ""); see if that helps
  7. Sorry I wouldnt know that much Im a MYSQL person the others have never really bothered me and I don't know if they are much better or just as much a pain as the others
  8. Check your other pages within the folder for the error, if it is only that page then you know it has something to do with the coding and CURLs can cause timeouts when there is something missing in them etc.. so yeah double check everything.
  9. Yeah that is a safety impliment that could be enforced. Salt or even MD5 Im an MD5 fan but I question its safety myself here is what you put if you would like the experiment $passwordMD5 = md5($password); // Above line is making the password unreadable to hackers trying to acquire user data and its more safe !
  10. could you post your cookie on the line that you use to set it so that I can see if I know what the problem is..
  11. I would suggest to minimize space if you have: echo"something"; echo"something else"; echo"something else"; Make this echo"something something else something else"; If you are using echos for line breaks don't what to do is in your echo after the word or letter you want a line break put in <br /> It will cause a break. As for your echo's - you will have to go through them and make sure that the ' OR " is not being used within the echo you are looking at if there is one replace it with the oposite character or alternatively backslash it like so \' OR \" Always remember to close your echos with the same tag as you used to open them i.e. ' OR " echo is also the same as the php print tag. Both work the same I hope you are begining to understand how it works just a little more
  12. Have you tried doing some like: Example: article.php: The withdrawl of the code bellow is that you would have to in some way be able to show your current database rows that hold the information such as the title that will be used as a link. - By this I mean you would have to have a page where news rows where added when new news is created - Easily done but that is your choice. <? $title = $_GET[article]; includes("config-file-directory.php"); $query = mysql_query("SELECT * FROM newscatagory WHERE title = '$title' LIMIT 1 order by id DESC") or die(mysql_error()); $row = mysql_fetch_array($query); if($title =='$row[title]'){ ?> <? echo"$row[title]"; ?><br> <? echo"$row[article]"; ?><br> <? echo"$row[reporter]"; ?><br> <!-- examples of table row/column names --!> <? } ?> So if the database had a row that had an article with the title: and I went and typed the following link: http://www.somesite.com/article.php?article=peter_pan_becomes_a_man Then it would distribute the example rows Title, Article and reporter for the row with the identical title in the database to that in the URL As for MOD_Rewrite (Not huge expert on but) .htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^articles/(.*)$ article.php?article=$1 </IfModule> Something along those lines not set in stone although I hope it helped
  13. The codes are really quite messy I must say lol remember that if you have an echo that is using " then you cannot use them within the content of that echo or if you do then you must remember to backslash \" - the same rule applies to using ' for echo's. Example of wrong thing to do (you will get an error!): echo"This is random content my name is "Andrew", the end."; Right would be: 1. echo"This is random content my name is \"Andrew\", the end."; - The backslashes won't show up so don't worry OR 2. echo'This is random content my name is "Andrew", the end.'; kind of thing and you do not have to echo so much echo's can be as big or as small as you like.
  14. 1. Try without double quotes at _VALID_INCLUDE use either ' if same problem then dont use them. also numbers don't need "" around them try without and see how you get on Like so: <?php define(_VALID_INCLUDE,TRUE); $ccms_bridge=1; $inindex=1; $svar_index_orig_intact=1; while ($cmscvar_site_enabled==0) while (!!$ccms_svar_time_today) $config_ccms_prefix=xccms_$check==0defined(_VALID_CRINC)!!$cmscvar_site_enabled; Return (1); Return (1); ?> Not sure if that will help but if it doesnt then you will agree with my amature guesses at the first problem
  15. Why not just update your Database details and delete that include/require
×
×
  • 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.