Jump to content

riT-k0MA

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by riT-k0MA

  1. Sorry for the long time it took me to reply. I've been on sickleave for the last few days, which could also explain why my last post was a bit muddled. Every menu link uses the following formula: http://www.site/folder/file.php Every Require() statement uses the following formula: /usr/htdocs/main/Users/Page.php. I have not mixed www. and no www. Should I use the full path (http://.....) for my Includes Requires?
  2. Ooops! I mixed my links up Each file calls (Requires) the Menu.php, the path to which is something like /usr/htdocs/main/Users/Page.php. Each hyperlink is, in fact, http://www.site/folder/file.php based. Sorry for the mixup
  3. Hi. Thanks for replying. session.cookie_path = "/" session.cookie_domain has no value. I am unable to change any configurations as the hosting company does not want them changed for security reasons. Every hyperlink in the menu uses a path similar to "/usr/htdocs/main/Users/Page.php" I added that code you suggested and got the following error: " Notice: A session had already been started - ignoring session_start() in /usr/www/<deleted>/Menu.php on line 3 " Tried using this: if (isset($_SESSION['SessionUserID'])) { //do nothing } else { echo"Starting Session <br />"; session_start(); } and got: " Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/www/<Deleted>/Welcome.php:9) in /usr/www/<Deleted>/Welcome.php on line 10 " So I tried disabling the Session_start() on each page but the Welcome Page and got: " Notice: Undefined variable: _SESSION in /usr/www/users/vector/VectorTechBETA/VectorLogin/Functions/EditUserBody.php on line 6 " Either I'm a total frikking idiot, am missing a brain and need to be beat about the head with a cluestick, or there's an error in this. I'm hoping it's the former. Brainless Idiots can be cured
  4. Hi. The site I'm trying to sort out is hosted on a Linux webserver running Apache version 1.3.34, PHP version 4.4.4-8 and MySQL version 5.0.32. I built the site on my own PC, running WinXP Pro, Abyss version 2.6.0.0, PHP version 5.2.0 and the same mySQL instance as the webhost, version 5.0.32. I coded the site and it worked perfectly as localhost. I changed the hyperlinks to what they should be on the webserver and uploaded it. One has to enter the site through a PHP-based login screen. The login page calls up the Welcome Page, which checks a mySQL DB for the username and password, validates it, then queries the same DB for some other fields. The Welcome Page then shows some links, menu-style, based on what the user's access privellages are. Every page has a session_start() at the top, before any other code. The problem I'm having is that the session seems to reset (The session ID is different) everytime the user clicks on a hyperlink. (It never does, or did, on my computer, whether on localhost or webhost.) I've tried this on three other computers, and all three do the same thing. I was wondering if it was the way I'd structured my website: Main |_ Login.php |_ Welcome.php |_ menu.php |_ Logout.php |_ Users | |_ UserPage1.php | |_ UserPage2.php | |_ UserPage3.php | |_ Functions | |_UserFunction1.php | |_UserFunction2.php |_ FAQ | |_ FaqPage1.php | |_ FaqPage2.php | |_ FaqPage3.php | |_ Functions | |_FaqFunction1.php | |_FaqFunction2.php etc. Each page in the site calls the menu.php in the site root. Each hyperlink in the menu starts from the root (/usr/htdocs/main/Users/Page.php). It was the only way I could get the hyperlinks to work. Could this be what's terminating the session? or is it a problem with different PHP versions? If it is different PHP versions, why does it work perfectly on my PC? Hours of googling yesterday got me absolutely nowhere. I would really appreciate any sort of clue as to why this is happening. Even if you only have a small hunch or gut-feel, it'd be more than I've got. Thanks an epic amount in advance riT-k0MA PS: If you need some code to test this out, I'll have to make some for you. I can't show any of my actual code due to one of those hated Contractual clauses.
  5. After some fiddling around I realised it was my syntax that caused the problem. It is possible to nest a SELECT in an INSERT So long as the table boing updated does not appear in the SELECT. Here's the example I made: CREATE TABLE Animal ( AnimalID INT, AnimalName VarChar(20) ) CREATE TABLE Owner ( OwnerID INT, OwnerName VarChar(20), Animal INT, FOREIGN KEY (Animal) REFERENCES Animal(AnimalID) ) INSERT INTO Animal (AnimalID, AnimalName) VALUES(1, 'Fred') INSERT INTO Owner (OwnerID, OwnerName, Animal) VALUES(12, 'Bob', (SELECT AnimalID FROM Animal WHERE AnimalName='Fred')) Thanks for all the help. I was trying to avoid that, But I have one Self-referencing variable, so I'll have to do that. As for the rest, My job is a lot easier now
  6. What do you mean? If I sub in the TableNames and cols for values (Think of them as variables), I get a working query, (excluding the SELECT subquery)
  7. Hi I haven't found any definite information anywhere I've looked as to whether or not one can throw a SELECT into an INSERT Statement: INSERT INTO Table1(Col1, Col2, Col3) VALUES(Value1, SELECT Col6 FROM Table2 WHERE Col7 = 'aVariable' LIMIT 1, value3) What I'm trying to do is select a value from one column where it corresponds to some text that was retrieved a page earlier. (as in DeptNO and DeptDescription being the 2 columns) Is this possible? If it is, It would save a huge amount of code. Thanks in Advance riT-k0MA
  8. I'm using the PHP docuentation, though as far as I can see, it's or nromal SQL authentication. Unfortunatly I have to use Windows Authentication, which is why I was using the msdn stuff. Looks like I'll have to try and muddle through everything
  9. Ok. I'll take another look at it and see if I can do anything. Otherwise I'll have to search for another DB example to use. Thanks
  10. No. I just copied and pasted the code, thinking it was standalone.
  11. I took a break and viewed the code again. I think that it might be picking up the > as a "close tag" and viewing the rest as html. IF that's the case, how could I fix it?
  12. Title of te link: How to: Retrieve Data as an Array (SQL Server 2005 Driver for PHP) Unless m$ have screwed up, which is highly probable
  13. Hi again. I learn new code best by getting an example from somewhere and studying it. It's probably not the best way nut it works for me. Unfortunately, if the example code doesn't work I have no idea how to fix it. I got this from here <?php /* Connect to the local server using Windows Authentication and specify the AdventureWorks database as the database in use. */ $serverName = "(local)"; $connectionInfo = array( "Database"=>"AdventureWorks"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { echo "Could not connect.\n"; die( print_r( sqlsrv_errors(), true)); } /* Define the query. */ $tsql = "SELECT ProductID, UnitPrice, StockedQty FROM Purchasing.PurchaseOrderDetail WHERE StockedQty < 3 AND DueDate='2002-01-29'"; /* Execute the query. */ $stmt = sqlsrv_query( $conn, $tsql); if ( $stmt ) { echo "Statement executed.\n"; } else { echo "Error in statement execution.\n"; die( print_r( sqlsrv_errors(), true)); } /* Iterate through the result set printing a row of data upon each iteration.*/ while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) { echo "ProdID: ".$row[0]."\n"; echo "UnitPrice: ".$row[1]."\n"; echo "StockedQty: ".$row[2]."\n"; echo "-----------------\n"; } /* Free statement and connection resources. */ sqlsrv_free_stmt( $stmt); sqlsrv_close( $conn); ?> Obviously I changed the DB name and fields and datatypes. It worked perfectly fine yesterday. I tried to use a modified version of it this morning and it didn't work. I then tried the origional (slightly modified) version of the code. That didn't work. Both times the actual PHP code shows after " $connectionInfo = array( "Database"=> " no matter what's in front of the > ??? I really have no clue about what's going on and would be greatly enlightened and appreciative if someone could point out the fup. many Thanks in advance riT-k0MA
  14. Ok, I'll give it a try on monday. Thanks. Anyone else got some ideas I could also try?
  15. A blackbox function is any function which you know what you can put in and what comes out, but you know little or nothing about the workings of the function. Unfortunately AJAX is not possible, unless it'll work with Abyss. THanks for replying, though. On second thought maybe a simple bit of code can help... (I can post this from home, you see) <?php /*They say knowing a little about a subject is worse than knowing nothing at all. Someone please tell that to my boss.*/ echo"<form>"; echo"[table]"; echo"[tr]"; echo"[td]<input type=text size=15>[/td]"; echo"[td]<input type=[unknown] value=[unknown]t />[/td]"; // must trigger a function to ass text to the textfield echo"[/tr]"; echo"</table>"; echo"</form>"; echo"?>"; ";
  16. Hi I'm a PHP n00b. 3 days ago I was told to start learning PHP Yesterday I was told to port a VB app to PHP and to make sure it stays exactly the same. Unfortunately that means having a button in the middle of a form that, when clicked, returns a string. Sadly due to contract restrictions and confidentiality issues I can't even post a single line of the code This is going to be hard... I have a form, made with tables in tables in tables. (to get it to look identical to the VB form) In the middle of that form is a textbox and a button. When the button is clicked, without refreshing or navigating away from the page, it needs to call up a blackbox function, which will return a string that needs to be put in the textbox. Being such a PHP n00b I don't even know enough to successfully google my problem.. ??? If I haven't managed to confuse everyone horribly, does anyone know how I can solve this? I don't care whether the solution involves PHP, javascript, HTML or all three combined, just Please Help Me To Get It Working ??? Thanks a huge amount in advance
×
×
  • 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.