Jump to content

Rich464

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Rich464's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. if that was supposed to say 'great' then thanx :) but not as great as these forums ;)
  2. why have  you commented all this out? /*echo("$name"); echo('\n'); $sql  = "INSERT INTO `Resume`  VALUES('','" . $name . "'," . $specialty . ",'$company','$address','$city','$state','$zip','$telephone','$email','$licensure','$certifications','$addcertifications','$addcomments')"; echo($sql); $error = mysql_query($sql); if ($error == TRUE)   echo('\nfucking shit worked'); else   echo(mysql_error());   */ How is your query going to work when you've commented the code out? AndyB got it straight away but you don't seem to have realised....
  3. assuming that the unique session ID is used as part of the authentication method otherwise there is no need to delete the cookie only to unset any global session variables and to call the session destroy function
  4. when wanting to end a session it is essential that you unset any session variables you have previously set, eg, session_start(); if(!isset($_REQUEST['logmeout'])){     echo "<center>Are you sure you want to logout?</center>";     echo "<center><a href=logout.php?logmeout=true>Yes[/url] |     <a href=javascript:history.back()>No[/url]"; } else { [color=green]unset($_SESSION['session_var_here']);[/color] session_destroy(); } ?> so you need to use unset(); on any session vars before you call session_destroy() or you will get the the problem you detailed
  5. Well I managed to gather what I needed to do from that, as your code still reports $dbname as an undefined variable. It works when the variables are declared as global INSIDE the function.....weird. Anyway thanks for your help  :) :D
  6. no,sorry. Man I really screwed this up trying to simplify it. Here I'll post the actual code. [code] config.php <?php $hostname = "Localhost"; //the hostname for the database server $username = "user"; //The username to access the database with $password = "password"; //the password to use to access the database $dbname = "db name"; //the actual name of the database to use ?> dbconnect.php <?php require ('config.php'); function db_connect() { //use values pulled from config.php $db = new mysqli($hostname,$username,$password,$dbname); return $db; } $conn = db_connect(); ?> [/code] the point is when the db_connect() function is called I get undefined variable warnings. I need to figure out why, or some way around it Why aren't the variables declared in the include file available inside the function?
  7. oh bugger, sorry. No I did put that (duh!) sorry I'm an idiot. ill amend it :P
  8. I was wondering if someone could help me with what is likely a simple variable scope problem. as per my code below, variables declared in an include file arent available inside functions that I declare the include from. Simplified version is below. Now I've read the PHP manual and searched the net on variable scope and I understand most of it, but none seem to cover this exact situation. It's a silly thing, and if someone could help me with it I'd really appreciate it, I'm using php 5 and MySQL 5 [code]config.php <?php $user = "user"; $pass = "pass"; ?> display.php <?php include ('config.php'); echo $user; //these seem to work fine echo $pass; //values are displayed correctly function display_vars() {   echo $user; //these give undefined variable warnings   echo $pass; //have tried using global too } display_vars()  ?>[/code] Cheers in advance  :-*
  9. oh man! your a star! Thanks for the quick turnaround, works perfectly appreciated :)
  10. Hi there, I'm having a (noobish) problem that I hope someone can help with. I have written a small script to insert information from a form and insert it into the database, which seems to work fine, and I can get another page to echo out the information. The problem I'm having is I'm using a textarea tag on my form and it doesn't retain any of the carriage returns when the contents of the text area are submittedby the form so when I echo the information out of the database on another page, its all on one line. I know why it does this but can't really think of a way around this. Anyone got any ideas, constructive help is much appreciated. Thanks in advance Rich [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
×
×
  • 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.