Jump to content

Nexus10

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by Nexus10

  1. No, I have a variable $industry which holds the value 'textiles' (but it also holds 20 other values as well at different times).
  2. $industry = "Textiles"; $a = ${$industry}; echo("<br />a: $a"); $a is then blank. ?
  3. <?php $learn_textiles_lvl = 5; // original variable $a = "$"."learn_".$industry."_lvl"; // attempt at reconstructing original variable when only $industry is known (it is not always 'textiles') $current_level = $a; // test echo("<br />Current level: $current_level"); ?> How do I construct a variable and get its contents (existing) from a string function (or other way)? I.e. I have the varible $industry and need to get the contents of an existing variable called $learn_(INDUSTRY)_lvl where INDUSTRY is defined in the variable $industry.
  4. Well the above (not the raffle script) does what I need and I've already got 90% of it (just need to get that winner selecting right now) so I'd rather get my code above working.
  5. I still can't get it working
  6. Okay, so this is what I've got (doesn't work): $query = "SELECT * FROM lottery_current"; $result = mysql_query($query) or die("Error: Could not be completed. <br>" . mysql_error()); $count = mysql_num_rows($result); while($row = mysql_fetch_array($result)){ echo $row['user_name']; echo $row['numTickets']; $numTicketsTotal = $numTicketsTotal + $row['numTickets']; } echo("<p>numTickets: $numTicketsTotal"); $prize = (10000 + (0.90 * 1500 * $numTicketsTotal)); echo("<p>Prize: $prize"); $result = mysql_query("SELECT * FROM lottery_current"); while($row = mysql_fetch_array($result)){ $user_name = $row['user_name']; $numTickets = $row['numTickets']; echo("<p>User name: $user_name"); echo("<p>No. of tickets: $numTickets"); $data = array($user_name => $numTickets); } $pot = array(); foreach($data as $user_name => $numTickets) { $pot = array_merge($pot, array_fill(0, $numTickets, $user_name)); } echo("<p>"); print_r($pot); //echo("<p>"); //print_r($data); shuffle($pot); echo("<p>"); echo $pot[0]; echo("<p>Done"); Which produces pillow1admin2terry1obama2 numTickets: 6 Prize: 18100 User name: pillow No. of tickets: 1 User name: admin No. of tickets: 2 User name: terry No. of tickets: 1 User name: obama No. of tickets: 2 Array ( [0] => obama [1] => obama ) obama Done The problem is, only the last user/purchaser of tickets seems to be in the array (i..e user 'obama' always wins here, no one else ever does). Can anyone see why?
  7. Thanks, although I don't really understand it fully. Is there simpler way to do this (even if its slightly longer/less elegant)?
  8. My webhost has error reporting disabled/off (and won't enable it). Needless to say I won't be renewing with them once my current hosting expires.
  9. I need to draw a lottery somehow although am getting lost. My database has a table which has two columns: 'user' and 'numTickets' where user is there user name nad numTickets is hte number of tickets they had. I.e. the table may look like (only player's with tickets will have an entry): Player1 12 Player 2 1 Player 3 43 Player 4 7 I am having trouble manipulating this data to provide 12 tickets to Player 1, 1 ticket to Player 2 etc so we can calculate a winner etc by using the random function (to get a random number from 1 to 63 in this case here). Any suggestions (preferably with a brief sample)?
  10. $to = $email; $subject = "Account Verification"; $header = "from: NexusIndustry <admin@nexusindustry.com>"; $message = "Your confirmation link: \r\n"; $message .= "Click on this link (or copy and paste into the address bar) to activate your account \r\n"; $message .= "http://www.nexusindustry.com/admin/confirm.php?passkey=$email_auth"; $sentmail = mail($to, $subject, $message, $header);
  11. Yeah, I've specified that. The email the user receives does say its from 'my email address', but it also says in the email details the name of my webhost which mailed it.
  12. Messages sent using the php mail function on my webhost's server appear on the email's sent to the user that it was mailed by/from 'sererXXX.mywebhost.com'. Is there a way to hide this/change this so that the user does not know who my hosting providor is (a possible security exception in my opinion I think).
  13. What I want to do is the following: - Make a hyperlink a post sort of function (like a form) so I can use $_POST to capture the assigned value in my processing form. - Second problem: the values will be similar and could be the same for the different links needed, how would I distinguish between the user selecting link 1 which has a value of 4 say (from the db), while link 2 also has a value of 4?
  14. How well does MYSQl scale well with large amounts of data? 5000 rows? 50000 rows? 500000 rows?
  15. I tried this but it only works on the exact url www.mysite.com/folder/register.php etc, not on the mod_rewrite url's www.mysite.com/folder/register/ etc.
  16. I tried this and it now goes to mysite.com/registerProcess.php (omitting the apple subfolder), how do I get it to include that subfolder where the file is located?
  17. More info: http://www.phpfreaks.com/forums/index.php/topic,303860.0.html
  18. Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^apple/register/?$ apple/register.php [NC,L] RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^apple/account/register/?$ apple/register.php [NC,L] on register.php I have a form which is processed by 'registerProcess.php' If I go to mysite.com/register.php it all works good. If I go to mysite.com/register it all works good. If I go to mysite.com/register/ register.php is displayed as it should be, but the form processing then breaks as it tries to look for the processing php script in the location mysite.com/register/registerProcess.php, how can I fix this?
  19. Thanks, but that doesn't solve my problem.
  20. I have an include on my site. The pages it is requested from (page1) may look like mysite.com/page1 or mysite.com/business/sales (which is in-fact page1 shown by mod_rewrite) etc. How can I write the include which is on that page1 so that it goes to the top of the directory first so we can then go through to the right directory? Also, I tried going include('http://www.mysite.com/thefiletocinlude.php'); although thsi fails to work, anyone know why?
×
×
  • 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.