Jump to content

farris

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

farris's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i just recently finished making a website and got a webhost. when i did this i saw that they offer mailing list and i decided that i wanted to go back to the registration form to add in the mailing list part, which brings me to the first question. how do you post to 2 different locations? i need to post ALL the information to a php script that will add the users information to a database and then also separate the name and email to post to a cgi script. i know how to separate the data and such but im not sure how to post the information again. would the best way be to have a pop up or second page ask if the user wants to and have the information in hidden forms? my second question is related to the login. i realized after i had scripted the login system it was based completely on cookies, accessing a single cookie everytime a page loaded and then using that information to check the login. so i decided to use along with cookies but later found out again that they store the id in cookies also, and that defeats my purpose of using sessions. i know how to use GET for sessions but i dont want to use that because of session hijacking. so is there anyway to use post for session ids?
  2. im fairly new at this too but this is how ive been doing it... after you select the table you have to query the database using "mysql_query()" what you can do is access your mysql database and use a regular query string till you get the query string that you need such as [code]"SELECT league , country FROM tablename WHERE picture = "(some kind of identifer here)"[/code] that assumes the table your searching is called "tablename". it returns the fields league and country once you has a query string that returns that 2 values you want, put that into a value in your php if the query above worked then it would look like this [code]$findLeagueCountry = "SELECT league , country FROM tablename WHERE picture = "$picture";[/code] you should make some kind of variable, such as "$picture", that holds a value that corresponds with the  picture then put that query string into the "mysql_query()" and report that data into a $result variable like this [code]$result = mysql_query($findLeagueCountry);[/code] then you have to pull the information out of the $result something like this [code]while($row = mysql_fetch_array($result))   {   echo ($row['league']) ;   echo ("<br>") ;   echo ($row['country']) ;   }[/code] that *should* loop through the results and print out the results like i said im kinda new at this too but this is how ive been doing it with some login scripts ive been working on but it should give you a start any questions just ask
  3. it still doesnt return anything i tried echoing the 2 login variables and they came back correctly so all the information is being passed correctly from the previous page and the registration page uses the same database file to connect so that must be correct to just thought id rule out those 2 sources of error
  4. this is for a login script...just letting you know so the variables make sense... im trying to access a database and pull out the column "usercode" when the username and userpassword on a row is found [code]<?php // Database connection information include('../Connections/databaseconnect.php'); // Puts user input into variables $loginusername= $_POST[loginusername]; $loginuserpassword= $_POST[loginuserpassword]; //MySQL query string that points to the usercode information that we want so that we can put it into a cookie $finduser= "SELECT usercode FROM users WHERE username = '$loginusername' AND userpassword = '$loginuserpassoword'"; //Selects database and returns an error if it doesn't work mysql_select_db($db_database,$conn) or die(mysql_error()); //Puts MySQL query into a variable $result = mysql_query("$finduser"); //Pulls information from the array and displays it while($row = mysql_fetch_array($result))   {   echo $row['usercode'] . "<br>";   } ?>[/code] i tried the query directly on mysql and it returns the variable that i want without any problems i had originally tried to echo $result directly but i ran into the resource id #4 problem and when i researched that i found out about fetch array ive been trying to learn php for about a month and mysql for about 3 weeks so this could be something i just keep looking right over and not paying attention
×
×
  • 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.