Jump to content

Darklink

Members
  • Posts

    126
  • Joined

  • Last visited

    Never

Everything posted by Darklink

  1. I'm nearly 18 and earning over $46k a year. That's a conversion from pounds/sterling. Around £23k.
  2. You can't vote which ones better! They depend on what you want to do. Using a flat-file system you can generate a cache (little to none resources needed), whilst using SQL will require resources. However SQL is incredibly useful when you want to find, update, join and delete data quickly. I would never recommend on creating a flat-file database, but rather a datastore which is used to simply cache small sets of data if needed.
  3. I'm one of those to attend one of the poorest schools in the UK, one which is constantly at threat of being closed down. Unfortunately I didn't learn as much I could in the maths area and most of what I know today is from what I've learnt myself. It's got me very far. As far as I know the schooling in the US is a lot more complex and sophisticated than the schools in the UK, probably due to the extended 2 years of compulsory education. But they just seem generally smarter too. The schools in the UK seem to treat the students as if they are still small children and the students seem to like that all the time which is dumbing the country down quite a bit but we always seem to pull through. I got as far as doing Triginometry and I was in one of the highest classes. Says something?
  4. I use EasyPHP. I believe the latest version has PHP5 and the latest MySQL update. I wouldn't advise installing an earlier version of EasyPHP and then try upgrading to PHP5. I did it myself, and I found myself lucky to get it working but it seems like hard work for something so small (but then again this is PHP!).
  5. Sessions are not complicated. At the top of each script you must place the session_start() function and then simply set the session variables. Bare in mind I haven't used session vars in a few years now, but it should be something like: <?php session_start(); // Always at the top of each page $_SESSION['example'] = 'test'; echo $_SESSION['example']; ?> The session variables will pass through pages BUT it will add annoyances like PHPSESSID vars in the URL and it's just simply basic working. Cookies are the best choice in my opinion.
  6. Yes. That's all all you need. The parameters do not need any data type definitions like other languages. <?php function blah($str, $file) { // Process goes here } ?>
  7. I'm not incorrect. As I said, you would need to define the printable template. Which means it would need the print-specific CSS attributes as said in that thread.
  8. You can't bring up an equation symbol from a variable without using eval. The following code should work (or something similar using eval). I don't use eval as much anymore but I know it's something like this. $matho = array('+', '-', '*'); eval("echo $number1 " . $matho[rand(0,2)] . " $number2;");
  9. You are making a dir in a directory with a 0777 permission applied right?
  10. Hmm. You might have to be a bit more specific than saying "IF the length of this IS NOT 5 THEN" I'm not sure how you are trying to get it to work exactly. Just be more specific with your conditionals.
  11. No. You will need to create a new template that will show less detail of the page. Or your own function which strips all the detail and just leaves you with the important stuff which you need to print. This isn't as simple as it sounds, so the best idea is to just create a print template.
  12. Heres your code cleaned up. Does it work? <?php //Connect to Members DB mysql_connect('p41mysql145.secureserver.net', 'cory_fcs', 'Sils1234') or die(mysql_error()); mysql_select_db('cory_fcs') or die(mysql_error()); if(isset($_COOKIE['ID_fcs_member'])) { //Look for the cookies $username1 = $_COOKIE['ID_fcs_member']; $pass1 = $_COOKIE['Key_fcs_member']; $username2 = $_COOKIE['ID_fcs_team']; $pass2 = $_COOKIE['Key_fcs_team']; // Fetch data $check1 = mysql_query("SELECT * FROM members WHERE username = '$username1'")or die(mysql_error()); $check2 = mysql_query("SELECT * FROM team WHERE username = '$username2'")or die(mysql_error()); if (mysql_num_rows($check1) > 0) { //They have a member's cookie! $login_logout = "<a href='logout.php'>Logout</a>"; } elseif (mysql_num_rows($check2) > 0) { //The have a team cookie! $login_logout = "<a href='logout.php'>Logout</a>"; } } else { $login_logout = "<a href='login.php'>Login</a> <img src='images/splitter.gif' class='splitter' alt='' /> <a href='register.php'>Register</a>"; } print $login_logout; ?>
  13. I advise the file_exists function. <?php $filename = 'images/example.jpg'; if ( file_exists($filename) ) { $image = $filename; } else { $image = 'images/noimage.jpg'; } echo '<img src="' . $image . '" alt="" />'; ?>
  14. If you want something basic, stick with sessions, otherwise to be honest I don't recommend sessions at all. Your code is a bit of a mess, so it's hard to understand. Why do you have opening brackets when there is no need for them in some areas?
  15. Don't use trim. You shouldn't need it. And don't use AND. Use && instead. Try this: <?php if ( strlen($user['user_birthday']) != 6 ) { $year = substr($user['user_birthday'], 4, 4); $month = substr($user['user_birthday'], 0, 2); $day = substr($user['user_birthday'], 2, 2); } elseif ( strlen($user['user_birthday']) != 5 ) { if ($user['user_birthday'] && $user['user_birthday'] != 999999) { if ( strlen($user['user_birthday']) != 6 ) { $year = substr($user['user_birthday'], 4, 4); $month = substr($user['user_birthday'], 0, 2); $day = substr($user['user_birthday'], 2, 2); } elseif ( strlen($user['user_birthday']) != 5 ) { $year = substr($user['user_birthday'], 3, 4); $month = substr($user['user_birthday'], 0, 1); $day = substr($user['user_birthday'], 1, 2); } $try->set_value('nonmandatory', 'birthday', "{$month}-{$day}-{$year}"); $try->set_value('nonmandatory', 'birthday_search', "{$year}-{$month}-{$day}"); } ?>
  16. Well $r['filename'] doesn't seem to contain anything. Are you sure thats the right array key to use? Or are you sure theres data there?
  17. I've managed to fix this error, doing it the wrong way however. I changed the output datatype to SQLVARCHAR(1). But why the hell would it work this way and not with SQLBIT? Note: That it works with SQLVARCHAR with 50 characters to, so it's not just the first number!!
  18. You might want to alter your error_reporting values, or if you want to sort it out via your code there, you need to define each array key before-hand. It's really annoying sometimes, but it's all down to security. Edit: so before $name and $ext is made do: $name = ''; $ext = '';
  19. Just a tip. Always look on the last line of code before the line it tells you for T_VARIABLE areas. It's nearly always a missing semi-colon.
  20. There's not really a lot of support for the MSSQL functions is there? Alot of what's on the internet is the same thing. Anyway, I am having no problems with using stored procedures with SQL Server right up until I need to get my output with values using SQLBIT. Instead of returning 1 or 0 like it should, it's returning me with an 8bit number, which changes every couple of minutes strangely. As if it was a timestamp, except its not. I am using some fairly complex class I've written to execute my stored procedures, however I am absolutely certainly positive that I am sending the correct information as I've written to output everything that has been sent to the server. It's simple, like so: mssql_bind($sproc, '@NameExists', $retval['NameExists'], SQLBIT, true); Now $retval['NameExists'] should either be 0 or 1. But instead it returns me an 8 bit random number. I am using Windows Server 2003 with PHP 5.2.3. Hope someone can help me. Thanks EDIT: I would just like to say, that I can send SQLBIT to SQL Server. Just isn't working as an output value.
×
×
  • 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.