
Mutley
Members-
Posts
765 -
Joined
-
Last visited
Everything posted by Mutley
-
[SOLVED] Attaching variables to a database positioning calculation :S
Mutley replied to Mutley's topic in PHP Coding Help
So, at the moment I have my Array looking like this... $my_array = array(0 => array("p1_pts" => $pts_1, "p1_id" => "$p1_id", "pos" => 1), 1 => array("p2_pts" => $pts_2, "p2_id" => "$p2_id", "pos" => 2), 2 => array("p3_pts" => $pts_3, "p3_id" => "$p3_id", "pos" => 3), 3 => array("p4_pts" => $pts_4, "p4_id" => "$p4_id", "pos" => 4)); re_order($my_array); Or is that wrong? Should the area saying "p1_id", "p2_id" etc, just be "user_id" and the same with the "p1_pts" should be "pts"? I understand what you mean by the variables but I can't extract the data (just shows a "1" guessing the Array isn't right). -
[SOLVED] Attaching variables to a database positioning calculation :S
Mutley replied to Mutley's topic in PHP Coding Help
Ah sorry, I wasn't looking at the code properly. I changed the array to how I want so it looks like this for 4 users: $my_array = array(0 => array("p1_pts" => $pts_1, "p1_id" => "$p1_id"), 1 => array("p2_pts" => $pts_2, "p2_id" => "$p2_id"), 2 => array("p3_pts" => $pts_3, "p3_id" => "$p3_id"), 3 => array("p4_pts" => $pts_4, "p4_id" => "$p4_id")); re_order($my_array); (You can see I'm using the variables to fill in the data for user/points). How would I do a foreach to then bind variables to the user id, so $1st = arrayresult $2nd = arrayresult (In order how the array sorts) -
[SOLVED] Attaching variables to a database positioning calculation :S
Mutley replied to Mutley's topic in PHP Coding Help
Thanks a lot for your help Frosty, I appreciate the time you spent producing that code. (I can't edit posts so just replying again ). But the issue above is still existent. -
Hosted with 1&1 for 2 years, their uptime and support was lacking, it wasn't bad... but you could defiantly get better. Moved to HostGator - perfect.
-
It won't be the next Myspace, lol. Loads of games have come out like this in the past (Second Life). I wouldn't be surprised if it has a few thousand users, strangely there are people in this World who would play this crap.
-
[SOLVED] Attaching variables to a database positioning calculation :S
Mutley replied to Mutley's topic in PHP Coding Help
I get this when executed: My variables for testing: -
[SOLVED] Attaching variables to a database positioning calculation :S
Mutley replied to Mutley's topic in PHP Coding Help
I was dreading to hear database re-design, lol! I just re-did loads of files with that database from an even worse one. So is that code for my current database design, sorry? -
I expect it comes with free spyware/adware.
-
Sorry about the title, can't explain it in 1 sentence, so please read, hehe... I have 16 database fields: p1_id | p2_id | p3_id | p4_id | p5_id | p6_id | p7_id | p8_id pts_1 | pts_2 | pts_3 | pts_4 | pts_5 | pts_6 | pts_7 | pts_8 How it works is, the *_id fields contain the users ID number. The pts_* field contains a numeric score, the number after pts_ corrisponds to the user field (so the number in pts_5 belongs to p5_id). What I wish to do is determine 1st, 2nd, 3rd.... 8th positions, depending on the highest number (highest number = 1st, lowest = 8th) then give them a variable, which I need for later on in my script to send messages to each user telling them where they have come etc. As an example, this is how I've done it for just 2 users: <?php if($p1_pts > $p2_pts) { $1st = $p1_id; $2nd = $p2_id; } else { $1nd = $p2_id; $2nd = $p1_id; } ?> I need to do it for 2 users, 4, 6 and 8 users seperatly, the above is okay for 2 users but my mind is boggled for any more users! I hope that makes sense, lol! Very thankful for any help.
-
Did you propose using a PHP script? Congrats.
-
Fixed it, my FTP was in a stupid "skip not overwrite" mode. Thanks a lot!
-
It says: My connection.php: require_once("config.php"); $connection = mysql_connect($host, $user, $pwd) or die("&error1=".mysql_error()); mysql_select_db($db, $connection); My config.php: $host = "localhost"; $user = "yorkrufc_rufc"; $pwd = "";//removed $db = "yorkrufc_rufc"; So it should connect. ???
-
Nope, still no luck. I think my head might just explode, this is really irritating, lol.
-
Same error. Line 5. ??? I wonder what's causing it, something other to the code possibly?
-
Same error, line 6 there. Thanks for the help so far.
-
Nope, same error. ???
-
Error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on line 9 Code: <table align="left" width="80%"> <?php require_once("connection.php"); $query = "SELECT id, name, surname FROM profiles ORDER BY surname, name"; $result = mysql_query($query); if(mysql_num_rows($result)!=0) { while(list($id, $name, $surname) = mysql_fetch_row($result)) { ?> <tr> <td align="left"><a href="profiles.php?id=<?=$id?>"><?=$surname?>, <?=$name?></a></td> </tr> <?php } } else { echo "No profiles were found"; } ?> </table> Anyone know what the problem is? Thanks.
-
I'll try Adwords and see how it goes. I'm going to try a press release service too, I heard they work quite well. Word of mouth is defiantly the most effective method!
-
Do you mean 2 people signing up or 2 hits? I was thinking of Adwords but heard it can drain your cash pretty quick.
-
I've made a guestbook style one, they are really easy to make and you only need like 3 tables to store posts/topics/members. Then you can be as advanced or crazy as you want from there.
-
I was thinking of more financial advertising, paying for adwords and online advertising. Free is simple, effective but rather obvious. I was looking past that. What do people think?
-
Just interested how you guys advertise your site? It's for a music community, I like the idea of press release dispensing. I've looked at both Adsense & Adbrite - but are these really effective? Seems like you need to put in $50-100 a day for something that might not get you any visitors at all. Discuss! Thanks.
-
I redesigned a site, it had a members login area which I haven't touched ... but for some reason users can't login anymore (or never could). It says: The code where this message is generated: <?php function processArgs() { $a = array(); $a['action'] = ema_CleanArgs('action'); $a['param'] = ema_CleanArgs('param'); return $a; } ///////////////////////////////////////////////////////////////////////////// /** * Checks and processes valid logins. * * This function is responsible for administration security. */ function processLogin() { global $emag; if (array_key_exists('oUser', $_SESSION)) { //User is logged in. //TODO verify some user data for additional security. return TRUE; } switch ($emag['args']['action']) { case ACT_LOGIN: $userA = $emag['dbo']->getUserA(ema_CleanArgs('login'), ema_CleanArgs('pass')); if ($userA['user_username'] == NULL){ echo "Sorry, that login and password were not recognised. Please try again.<br/>"; } else { // Successful login. $_SESSION['oUser'] = new EMA_user($userA); $emag['dbo']->updateUserLoginTime($userA['user_id']); return TRUE; } break; ?> I can register and it inputs the data into the database fine and the SQL config file seems fine to, so what is causing this? Thanks.
-
Wrong field type, changing entries from ".1" to "0.1" ?
Mutley replied to Mutley's topic in MySQL Help
I had it on CHAR but only set length to 2, not 3! Oops.