Jump to content

neller

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by neller

  1. I think you have just forgot to add the variable part by looks of it Your current code doesnt add to a variable to echo out as u can see below.. '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>'; You either need to add it to the variable you are using $insertgallery .= '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>'; or echo it out echo '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>';
  2. $count = count($links); // how many items are in the array // echo $count; exit; //this echo's 16...so there's stuff in the array $i = 0; // total count $s = 0; // table cell count...should ever get above the value of 3 while ($i <= $count) { if ($s == 0) { echo "<tr>"; } // if at the start of a table row, start the row echo $links[$i]; $i++; $s++; // print out the table cell with the proper value if ($s < 3) { echo "<td> </td>"; $s++; } // if we're not at table column 3, add a new column...this also should close the row with "null" values to fill in the table if ($s == 3) { echo "</tr>"; $s = 0; } // are we at table column 3? If so, close the row. } try removing the ; from the end of your while statement, I have done so above, I think that will fix it
  3. Making the following 2 changes will fix it.. 1 - change the text on your submit button, currently you have spaces " Register " , but in your PHP you are not checking for spaces you just have if (isset($_POST['submit']) && $_POST['submit'] == 'Register') So change your submit button to... <input type="submit" value="Register" name="submit" id="submit"/> then I always find wrapping my if statements in brackets is far better as it none of it will get run unless it passes your checks u are doing, so for example use this.. if (isset($_POST['submit']) && $_POST['submit'] == 'Register') { $query = 'INSERT INTO nelyn_user (user_id, username, password, email) VALUES (NULL, "' . mysql_real_escape_string($email, $db) . '", ' . '"' . mysql_real_escape_string($username, $db) . '", ' . 'PASSWORD("' . mysql_real_escape_string($password, $db) . '"))'; $result = mysql_query($query, $db) or die(mysql_error()); $user_id = mysql_insert_id($db); $_SESSION['logged'] = 1; $_SESSION['email'] = $email; header('Refresh: 5; URL=login.php'); } Hope that helps and all make ssense
  4. have you added single quotes either side of the username? it looks like you are escaping the query using the double quotes to use the $session->username variable but you need single quotes if so either side of those ' ".$session->username " ' (without the spaces)
  5. thansk for the reply guys. The server doesn't get tied up just that user, the page istelf uses loads of various tables the page loads pretty well due to the amount of data it displays, BUT the user has to wait for that page to load before any of the others will bother loading. The second that page finishes loading then the other pages load instantly again. If the same user was on the website using 2 different browsers / database connections, then they can easily load that big page in 1 and move around the site in the other, but this is not ideal as I need them to be able to do it in the 1 session. I tried doing a new / seperate database connect for that page, but that didnt work either
  6. Hi guys, Wasnt 100% sure how to title it but this is what I'm trying to do... I have a site where 99% of the pages load pretty fast but there is 1 page which takes about 3 mins to load (very big database useage) When the user opens this page they can't load any of the other pages until this one has finished loading, is it possible to say open a second connection when using this page so they can carry on using the rest of the site while this is loading? Thanks
  7. I have read the stickies and searched other threads but can't seem to find an answer, have not seen these in any of my mysql books either. If you had this Query..... SELECT DISTINCT ehorsename FROM entries WHERE rraceid = '1' AND ehorsename <> 'Horse Name' AND eprognum <> '' AND eprognum <> '0' What are the <> doing? I'm used to using them for "less than" or "greater than" but they are clearly not being used for this here, when used together do they mean something else? thanks
  8. Think you need to add ; to the end of your SQL statements
  9. Ok lets say I have a stored procedure called proc_getData which has 5 select statements.... Select * From table1; Select * From table2; Select * From table3; Select * From table4; Select * From table5; then within my PHP script I called the procedure.. CALL proc_getData(); How would it be possible to set each select statement from the procedure into different results? so I could loop through each as and when needed on my page? (hope this make sense) Thanks
  10. nevermind fixed it.... I just put ` around all the table names and it seems to have fixed the problem, I do usually use these in my queries anyways but left them out the function for some reason.
  11. Ok I have a pretty basic stored function but it returns a different result to the query inside it? let me show you a quick example so it makes more sense, here is the query and the result it returns... SELECT username FROM users WHERE user_id = 1; (returns "Player 1") however, when I use that exact same query within a stored function it returns a totaly different result CREATE DEFINER=`root`@`localhost` FUNCTION `get_Username`() RETURNS varchar(128) CHARSET latin1 BEGIN RETURN (SELECT username FROM users WHERE user_id = 1); END (returns "Player 2"); The table itself is just a basic one containing usernames with user_id as a Primary key. any help will be much apprieated
  12. ahhh I just thought of how to do it after reading your last post, and can do so from the 1 database loop Sorry its now off topic, I posted it in the MySQL section hoping the thing I was asking could be done in mysql, I'm pretty good with mysql but not on the advance level with functions and procedures etc so wasn't sure if it could be done that way. thanks for your help
  13. as in just a better way than I did it in my second post?
  14. Yeah sorry I did not post my code I usually would and I know you recommend doing so in that "please read" thread (I have read it ) The only reason I never is because imo it makes this simple problem look more complex than it is, I just figured the problem I listed in my first post was something simple I was just missing, anyways here is my code... SELECT `w`.`venuecode`, `w`.`workoutdate`, `v`.`venuename` FROM `workouts` `w` INNER JOIN `venue` `v` ON `w`.`venuecode` = `v`.`venuecode` ORDER BY `v`.`venuename`, `w`.`workoutdate` DESC in the above code just think of the "workouts" table as my "friends" table and the "venue" as "users" from my first post, I will try to be more precise when posting in the future
  15. Yeah that was pretty much what I was asking for help with in my original post As I stated in my second reply its probably not a good way to solve my problem and I would not recommend using it, but for now until I learn how to solve it in MySQL I thought I might as well post "my fix" just in case anybody else was totaly stuck for the time being. I'm usually pretty good with both joins and mysql, not sure why im so stuck here, probably missing something quite stupid.
  16. Not sure if there is a better way but decided to do it on the PHP end with 2 loops. first I looped through the database results and set all an array with the username as the key and the friends ID as a sub array, like so: $users[$user_id][] = $friends_id to everytime it loopts through the databse results, any duplicate names won't matter as they are just used as the 1 key in the main array. then in my second loop, I looped through the $users array foreach($users as $username => $users_friends_array) { foreach($users[$username] as $key => $friends_name) { echo $friends_name; } } I would not advise using it as its probably not the best piece of coding , 3 loops just to do such a simple thing, however just thought I would post my result as its working fine, but if anybody has a better way please share, thanks
  17. Hi guys, Does anybody know how to do the following in MySQL... Lets say I had 2 tables to do a basic join on.. table1 (list of names) (user_id, username) table2 (list of friends for the people in table one, linked by user_id) So I do a basic MySQL join query to get all the names and friends from both tables, but then in the PHP loop I end up with the names from the first table repeated for as many friends results as it finds, for example... username - Alan, friend_id 1 username - Alan, friend_id 2 username - Alan, friend_id 3 username - Joe, friend_id 1 username - Joe, friend_id 2 username - Joe, friend_id 3 etc etc Idealy I need the loop to print like the following.... Username - Alan friends 1,2,3 Username - Joe friends 1,2,3 I have tried GROUP_BY and stuff, however that just limits the result to 1 row per user so only returns the first friend_id. I hope the above makes sense, if anybody can point me in the right direction I would be very grateful, Thanks
  18. Hi Guys, I'm trying to convert a coldfusion website into PHP, so far everything has gone fine, I know nothing about coldfusion but have managed by using Google plus the fact its quite obvious what most the coldfusion code is and easily to convert, anyways..... I have come stuck on the code below, does anybody know what this would be in PHP? you don't have to write the PHP, if you could just give me a run down on what its actually doing, Thanks and here is the code. <cfloop from="#datediff('d', dateadd('d', 1, range.start), now())#" to="#datediff('d', range.finish, now())#" index="offset"> <cfoutput>#dateformat(dateadd('d', -offset, now()), 'DDD')#</cfoutput> </cfloop>
  19. Thanks guys, I will check out both those links to see if they solve my problems.
  20. As long as you backup your database it should be fine, you should try a few "test" transfers now to see how things go, just create a fake site and see if you can re-create your forums etc without much hassle. plus if you do run into any problems (hopefully not) you can see how to fix them ahead of time. The main things which will need changing are Database login info (to match the new site) and the paths to files.
  21. Hi, Say I had the following stored function (just a quick demo it does nothing) BEGIN SELECT `name` FROM `customers` WHERE `name` = var_name END How would I check within a procedure how many rows where returned? so if > 0 I can run another query within the function, for example (and this obviously wont work) BEGIN SELECT `name` FROM `customers` WHERE `name` = var_name IF > 0 another query here END thanks in advance ps... alternatively if anybody knows a good tutorial / book on things like the above #i'm more than happy to find it myself.
  22. I'm not an expert in MSSQL and I'm not sure on the major differences, however the queries / code are very similar, borderline identical in most areas. All the basic queries, SELECT, INSERT, UPDATE etc etc are just the same in both, from what ive seen its mainly the more advanced functions which are differently coded. As I say I'm not an expert in MSSQL tho so don't know the major differences, I have always used MySQL but recently had to convert a site which uses MSSQL to MySQL and everything barring a few things was just the same.
  23. I really want to learn about Java servlets, how to create them etc. I know nothing about Java servlets but have good knowledge of PHP / MySQL, so not a total noob at programming. Does anybody know of a good "beginers" book / tutorial from compiling to writing a JSP? Also is there much of a difference between a servlet and an applet?
  24. Can anybody recommend a good book on java servlets? I have very small knoweldge on Java so need it to be a beginners book
  25. cheers guys, have sorted the negative number thing will work on the rest of your suggestions, thanks for the feedback
×
×
  • 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.