Jump to content

get details from mysql


christophe

Recommended Posts

Hi there

I have a table in mysql database with fields  like this

username          password            custorsupp

alex                sdjjdjiaislei          C

bloggs              djdjjsaowe          s




How would i get the value of custorsupp field from the database using php


And also how would i redirect a user according to this value


Thanks
Alex


Link to comment
Share on other sites

Hi Alex,

Have you done any PHP and MySQL integration?  If not, you should start with a simple tutorial like this one:

[url=http://devzone.zend.com/node/view/id/641]http://devzone.zend.com/node/view/id/641[/url]

I am assuming that you first want to verify a persons username and password, you can do this by querying the database for records where the username and password columns values match those entered by the user.  If you have this set up correctly and the person enteres valid details, this should return one record from the database.  You can then extract the value from the custorsupp column of this one record to use in proceeding.
Link to comment
Share on other sites

you will want something like this to get value of custorsup:

while ($row = mysql_fetch_array($result)) {

$value = $row['custorsupp'];

}

This will apply the value with c or s to the variable $value.  What the above is doing is actually looping thorugh all records returned and doing this for each record but as there should be only one record returned it should do it just the once.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.